CanvasGadget - change background color !
For fixing many flickering problems
CanvasGadget change background color
Re: CanvasGadget change background color
I use different background colors, but I have no flickering problems.walbus wrote:many flickering problems
Have you an example?
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: CanvasGadget change background color
Hi,
on me NV simulator, unfortunately, i have changed the code now to PB 5.30B2
The old version without flickering is to time still for download (2014.5)
On resizing i become with 5.3 (to time- i looking further to fix it) flickerung, i can´t fix it.
On 5.22 resizing it´s absolutely smooth with graphic and text.
Now i must remove this feature, with a only black screen it´s now OK.
I think, it´s simple the canvas enhance for a changed background.
On creating the canvas new it blinking shortly white, this is my problem.
A way is, i make the canvas ever maximum available wide and height from the window
Then, i must not create the canvas by resizing new
Now it´s on this score ok, but the new code looking not good for me
Unfortunately, the code is big and with many includes
Here is the download path, if you want looking.
I change the download in the next day´s to the new version, but it´s to time not necessary.
This simulator is one of the best available, he have many tousends downloads worldwide.
http://www.nachtoptik.de/NV-and-sight-simulator.html
regards werner
on me NV simulator, unfortunately, i have changed the code now to PB 5.30B2
The old version without flickering is to time still for download (2014.5)
On resizing i become with 5.3 (to time- i looking further to fix it) flickerung, i can´t fix it.
On 5.22 resizing it´s absolutely smooth with graphic and text.
Now i must remove this feature, with a only black screen it´s now OK.
I think, it´s simple the canvas enhance for a changed background.
On creating the canvas new it blinking shortly white, this is my problem.
A way is, i make the canvas ever maximum available wide and height from the window
Then, i must not create the canvas by resizing new
Now it´s on this score ok, but the new code looking not good for me
Unfortunately, the code is big and with many includes
Here is the download path, if you want looking.
I change the download in the next day´s to the new version, but it´s to time not necessary.
This simulator is one of the best available, he have many tousends downloads worldwide.
http://www.nachtoptik.de/NV-and-sight-simulator.html
regards werner
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: CanvasGadget change background color
Requested here: http://www.purebasic.fr/english/viewtop ... =3&t=54195
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: CanvasGadget change background color
Yep, many thanks,
i am not lucky with the white canvas background.
I have fixed the problem in the NV simulator so :
This code working ONLY with PB5.30 >
But, i am not lucky with this code , but it works
i am not lucky with the white canvas background.
I have fixed the problem in the NV simulator so :
This code working ONLY with PB5.30 >
But, i am not lucky with this code , but it works

Code: Select all
OpenWindow(0,300,300,600,600,"",#PB_Window_SystemMenu | #PB_Window_SizeGadget)
CanvasGadget(0,0,0,600,600)
StartDrawing(CanvasOutput(0))
Box(0,0,WindowWidth(0),WindowHeight(0),RGB(0,0,255))
StopDrawing()
min_win_x=300 : min_win_y=300 : max_win_x=1200 : max_win_y=1200
WindowBounds(0,min_win_x,min_win_y-MenuHeight(),max_win_x,max_win_y-MenuHeight()) ; Min and max window
Global win_resized
Procedure SizeWindowHandler()
Shared max_win_x,max_win_y
If EventWindow()=0 ; Window 0
If Not win_resized
CanvasGadget(0,0,0,max_win_x,max_win_y) ; Flicker fix
StartDrawing(CanvasOutput(0))
Box(0,0,max_win_x,max_win_y,RGB(0,0,255))
StopDrawing()
EndIf
win_resized=1
EndIf
EndProcedure
BindEvent (#PB_Event_SizeWindow,@SizeWindowHandler())
Repeat
If win_resized
win_resized=0
CanvasGadget(0,0,0,WindowWidth(0),WindowHeight(0))
StartDrawing(CanvasOutput(0))
Box(0,0,WindowWidth(0),WindowHeight(0),RGB(0,0,255))
StopDrawing()
EndIf
Until WaitWindowEvent()=#PB_Event_CloseWindow
Last edited by walbus on Mon Jun 02, 2014 8:50 pm, edited 1 time in total.
Re: CanvasGadget change background color
WaitWindowEvent ? in a callback of window events ?
Here is my code for Canvas-Resize without "flicker" (Windows 7, PB 5.30)

Here is my code for Canvas-Resize without "flicker" (Windows 7, PB 5.30)
Code: Select all
Enumeration
#Window
#Gadget
EndEnumeration
Procedure SizeWindowHandler()
ResizeGadget(#Gadget, 0, 0, WindowWidth(#Window), WindowHeight(#Window))
If StartDrawing(CanvasOutput(#Gadget))
Box(0, 0, OutputWidth(), OutputHeight(), RGB(0,0,255))
StopDrawing()
EndIf
EndProcedure
OpenWindow(#Window, 300, 300, 600, 600, "Canvas Example", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
WindowBounds(#Window, 300, 300, 1200, 1200)
CanvasGadget(#Gadget,0,0,600,600)
SizeWindowHandler()
BindEvent(#PB_Event_SizeWindow, @SizeWindowHandler(), #Window)
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: CanvasGadget change background color
Ah, yep, i have oversight it .. thanks, i am looking now for your code...
resizegadget, yes , simple
Many thanks !!!
But, i have a menu, and the flickering is back now with your code ( I think, i must drinking a beer ) , strange
resizegadget, yes , simple

But, i have a menu, and the flickering is back now with your code ( I think, i must drinking a beer ) , strange
