Page 1 of 1
Re: Canvas Back-Color
Posted: Tue Apr 02, 2013 1:07 am
by IdeasVacuum
.....I haven't had a flicker problem but a pre-defined background colour might be useful at times, though if any redrawing is nescessary than the background needs to be re-drawn first.
Re: Canvas Back-Color
Posted: Tue Apr 02, 2013 3:05 am
by idle
make sure you're not making multiple StartDrawing StopDrawing to the canvas output while compositing the output
otherwise it will be alpha blending the whole canvas on each stopdrawing call.
It's better to composite the output into an image and then draw that to the canvas once it's complete.
Re: Canvas Back-Color
Posted: Tue Apr 02, 2013 7:47 am
by swan
I've often gone looking to see how to set the back color of a canvas gadget, can it be done ?
Re: Canvas Back-Color
Posted: Tue Apr 02, 2013 8:19 am
by Danilo
What mevedia.de is talking about is CanvasGadget re-size. If you re-size the CanvasGadget
using ResizeGadget to a larger size, PureBasic fills the new area with white color.
After that you redraw the content of the canvas, but there is white flickering for a moment.
Especially with large (screen size) CanvasGadget the repainting process takes some time, so
you see the white flickering. Changing the default background color would reduce it little bit
for dark CanvasGadget content, but there would still be flickering because the new area is first
filled with the background color and then again filled with the content.
Maybe another solution could be to disable automatic CanvasGadget redrawing with ResizeGadget
for a moment, draw on canvas, and then update display?
Could there be a platform independent callback get added to the CanvasGadget officially, so it does
not fill the new background automatically with a color? Instead it calls the user callback function,
if one was set using SetGadgetAttribute() or something like this. This would also avoid the 2 times re-painting,
first automatically by PB and then by the user, so the whole process could be faster...?
Re: Canvas Back-Color
Posted: Tue Apr 02, 2013 8:39 am
by Joris
idle wrote:make sure you're not making multiple StartDrawing StopDrawing to the canvas output while compositing the output
otherwise it will be alpha blending the whole canvas on each stopdrawing call.
It's better to composite the output into an image and then draw that to the canvas once it's complete.
This looks like the Windows function ValidateRect() is simulated somewhere in that stopdrawing call, is it ?
Re: Canvas Back-Color
Posted: Tue Apr 02, 2013 7:41 pm
by idle
Don't know exactly what it's doing Joris, it was just an assumption based on observation
Don't have any thoughts about how to avoid the flicker on resizing
Re: Canvas Back-Color
Posted: Tue Apr 02, 2013 7:46 pm
by Danilo
idle wrote:Don't have any thoughts about how to avoid the flicker on resizing
Move the topic to feature requests and wish list.

Re: Canvas Back-Color
Posted: Tue Apr 02, 2013 7:54 pm
by idle
+1
Re: Canvas Back-Color
Posted: Mon Mar 14, 2016 6:17 am
by Little John
Alexi wrote:The Canvas should be also able to use Alpha-Channel.
Yes, that would be very useful!
See for instance the following topics:
PNG + Transparency woes
Any gadget allowing transparent background?
Transparent background for canvas ?