User Area and ScrollArea()



  • I am a bit confused about using ScrollArea() for my User Area (UA).
    I want to display a lot of textures in my UA.

    So, I created a UA with a scroll area and using the slider part of the textures are shown.
    However, it is a bit slow, because the textures are all drawn using DrawBitmap() in DrawMsg().
    I added SetClippingRegion(x1,y1,x2,y2), but that did not made things faster.

    Reading the manual, I see that I can use ScrollArea(), only showing a part of the total UA.

    Questions:

    • do I use ScrollArea() in DrawMsg()
    • do I still use DrawBitmap() to draw the textures?
    • if not where do I draw all the textures, I later on display only a part using ScrollArea().

    Could please provide some pseudo code or an example to show UA, DrawBitmap(), ScrollArea()?



  • So far I tried this, but no success.
    In Command of the main dialog, I do the ScrollArea() call.
    The 'visible' UA is 330x584. The actual (virtual) UA is larger in the y direction.

                self.area.ScrollArea(0,584, 0, 584, 330, 2*584)
                #self.area.Redraw()
    

    Adding Redraw() dit not help.
    I added no ScrollArea() in the Area class.



  • Hi @pim do you really want to use ScrollArea, to manually scroll your GeUserArea, or you want to have an external ScrollGroup that will scroll your GeUserArea automatically (If this is the case then you can find an example in Redrawing GeUserArea in ScrollGroup with Slider Input.
    Note that there is a behavior change in R21 for GeUserArea, now only the needed part is redrawn, so you may see some speeded in R21+.

    But I don't think the Scroll Area will help you to provide faster result in any case, what the function does, is simply offsetting the rendered area part but you still need to draw completely the GeUserArea with all the DrawBitmap, make sure to use BMP_NORMAL to have a faster result, moreover if speed is really the main issue you try to fix, I encourage you to read Profiling Python Plugins.

    Cheers,
    Maxime.



  • Yes, I use the auto way.
    I thought that using ScrollArea() it would only display that part (no need to draw the other parts).
    So, fill the virtual UA once and then display parts of it using ScrollArea().

    But if "you still need to draw completely the GeUserArea with all the DrawBitmap", there will be no speed benefit.

    I will try it under R21 and will read "Profiling Python Plugins".

    Thank you, Pim

    24fbc034-a80c-42f0-acb3-77deffeadaec-image.png


Log in to reply