Results 1 to 5 of 5

Thread: [RESOLVED] VB6 Question : Possible RC6 bug in opacity.

  1. #1

    Thread Starter
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,218

    Resolved [RESOLVED] VB6 Question : Possible RC6 bug in opacity.

    I think this one is solely for Olaf Schmidt.

    I think I may have discovered a bug in RC6 where opacity changes implemented in CC.RenderSurfaceContent are not being carried out as expected.

    My program has a right click menu option to display the 'about' pane. It is meant to fade in and out smoothly.



    In my RC6 programs I found that the opacity fade in/out did not work properly. The first time the program fades an image, it works, but the fade out does not.
    Subsequent calls to the same routine shows the fade in doing something rather strange, an immediate fadein, not a smooth fade in as expected. Subsequent calls to the routine cause instant changes from 0 to full opacity and vice versa.

    The interesting thing is that this does NOT happen with the same code using RC5.

    Using RC6 I am manipulating the opacity of an image (about) from a Cairo.imageList, increasing the opacity using a cTimer in small increments. Nice and simple, it causes the form containing the about.png image to fade into full opacity, then it stops the timer.

    Code:
    Private Sub tmrFadeIn_Timer()
    
       On Error GoTo tmrFadeIn_Timer_Error
            fMain.aboutForm.Show ' starts off at zero opacity
            opacity = opacity + 0.05
            If opacity >= 1 Then
                opacity = 1
    
                tmrFadeIn.Enabled = False
    
                Exit Sub
            End If
        W.Refresh
    
       On Error GoTo 0
       Exit Sub
    
    tmrFadeIn_Timer_Error:
    
        MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure tmrFadeIn_Timer of Class Module cwAbout"
    End Sub
    When the image is clicked there is another timer that fades the image out. It supposedly does the opposite of the fadeIn.

    Code:
    Private Sub tmrFadeOut_Timer()
    
       On Error GoTo tmrFadeOut_Timer_Error
    
            opacity = opacity - 0.05
            If opacity < 0 Then
                opacity = 0
    
                tmrFadeOut.Enabled = False
                fMain.aboutForm.Hide
    
                Exit Sub
            End If
        W.Refresh
    
       On Error GoTo 0
       Exit Sub
    
    tmrFadeOut_Timer_Error:
    
        MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure tmrFadeOut_Timer of Class Module cwAbout"
    End Sub
    Unfortunately the fade out never seems to operate. It appears to set the opacity to maximum all in one go.

    The opacity is determined using a property.

    Code:
    Public Property Let opacity(ByVal newValue As Double)
       On Error GoTo opacityLet_Error
    
      If mopacity <> newValue Then mopacity = newValue Else Exit Property
    
       On Error GoTo 0
       Exit Property
    
    opacityLet_Error:
    
        MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure opacity of Class Module cwAbout"
    End Property
    
    Public Property Get opacity() As Double
       On Error GoTo opacityGet_Error
    
      opacity = mopacity
    
       On Error GoTo 0
       Exit Property
    
    opacityGet_Error:
    
        MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure opacity of Class Module cwAbout"
    End Property
    - and finally rendered into CC As RC6.cCairoContext

    Code:
    Private Sub Draw(ByRef CC As cCairoContext, ByVal dx As Single, ByVal dy As Single, ByVal mopacity As Double)
       On Error GoTo Draw_Error
    
        CC.RenderSurfaceContent "about", aboutxo, aboutyo, , , , mopacity
    
    End Sub
    The above is just sample code to explain the simplicity of what my programs is trying to do - the actual code can be found in the later attachments.

    The reason why I suspect RC6 has a bug is that the same code above works perfectly in RC5.

    -oOo-

    As a test to confirm this, I took a working RC5 program that has the same code, same functionality, that fades in and out perfectly every time using RC5. I simply upgraded it to RC6, replacing the BIN folder, adding a project reference to RC6, removing all references to RC5 in config. and code.

    What I then received is the same jerky fade in/out as per my original RC6 program.

    The RC5 program that demonstrates a smooth fade in is this:
    https://github.com/yereverluvinuncle...arth-gauge-VB6

    The RC6 program that is jerky is this one:
    https://github.com/yereverluvinuncle...-JustClock-VB6

    I will shortly attach two stripped out programs, one for RC5, the other for RC6 that demonstrate the problem
    Last edited by yereverluvinuncleber; Nov 28th, 2023 at 10:26 AM. Reason: Added image
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  2. #2

    Thread Starter
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,218

    Re: VB6 Question : Possible RC6 bug in opacity.

    This the sample RC5 demo program. It won't let me upload it here, so it is on github instead.

    [link to program removed as the repository has been deleted]
    Last edited by yereverluvinuncleber; Nov 30th, 2023 at 06:34 AM. Reason: [link to program removed as the repository has been deleted]
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  3. #3

    Thread Starter
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,218

    Re: VB6 Question : Possible RC6 bug in opacity.

    This is the sample RC6 demo program.

    [link to program removed as the repository has been deleted]
    Last edited by yereverluvinuncleber; Nov 30th, 2023 at 06:34 AM.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  4. #4
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,173

    Re: VB6 Question : Possible RC6 bug in opacity.

    Quote Originally Posted by yereverluvinuncleber View Post
    This is the sample RC6 demo program.

    https://github.com/yereverluvinuncle...Demo%20RC6.zip
    There's a few optimizations in the RC6-Widget-RenderTree, how (and under what conditions) -
    Widgets are refreshed "from the ground up" - or not...
    (compared to RC5, which almost always refreshed from the ground up).

    So, if you play with transparencies like you did, you will have to help the RC6-Widget in question a little bit,
    to clear its former Surface-content, before rendering "new stuff with new Alpha-Values" onto it:

    If you enhance your Draw-routine with 3 extra-lines like that:
    Code:
    Private Sub Draw(ByRef CC As cCairoContext, ByVal dx As Single, ByVal dy As Single, ByVal mMyOpacity As Double)
       On Error GoTo Draw_Error
        CC.Operator = CAIRO_OPERATOR_CLEAR
          CC.Paint 'clear the whole background of this Widgets underlying Surface via Clear-Operator 
        CC.Operator = CAIRO_OPERATOR_OVER 'switch back to the default-Operator
        
        CC.RenderSurfaceContent "about", aboutxo, aboutyo, , , , mMyOpacity
        ...
    Then everything should be fine...

    Olaf

  5. #5

    Thread Starter
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,218

    Re: VB6 Question : Possible RC6 bug in opacity.

    That works perfectly. That took me a long time to drill down into for diagnosis. I wanted to be sure that I knew what I was talking about.

    Thankyou.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width