[Implemented] Canvas Back-Color
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Canvas Back-Color
.....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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Canvas Back-Color
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.
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.
Windows 11, Manjaro, Raspberry Pi OS


Re: Canvas Back-Color
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
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...?
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
This looks like the Windows function ValidateRect() is simulated somewhere in that stopdrawing call, is it ?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.
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
Re: Canvas Back-Color
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
Don't have any thoughts about how to avoid the flicker on resizing
Windows 11, Manjaro, Raspberry Pi OS


Re: Canvas Back-Color
Move the topic to feature requests and wish list.idle wrote:Don't have any thoughts about how to avoid the flicker on resizing

-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Canvas Back-Color
Yes, that would be very useful!Alexi wrote:The Canvas should be also able to use Alpha-Channel.
See for instance the following topics:
PNG + Transparency woes
Any gadget allowing transparent background?
Transparent background for canvas ?