Wrong placement of CanvasGadget(?)
Posted: Tue Jun 11, 2024 9:49 am
The coordinates of this canvas should cover exactly the whole window. It seems it doesn't.
Using latest Chrome 67% zoom factor and maximized window on Windows 10 x86, white borders are visible.
PLEASE MAKE SURE THIS IMAGE IS DISPLAYED AT FULL SIZE

Supersizing the canvas or over-enlarging the box ( ) function's position parameters won't solve all of the problem. A thin line of blue background still shines through at the bottom.
PLEASE MAKE SURE THIS IMAGE IS DISPLAYED AT FULL SIZE

In fact, if you proceed like in these code examples, the page zoom of a browser will propably always mess-up with a few pixels of the screen. The canvas should, however, fill the entire screen; everything should be black.
mfG
Code: Select all
enableExplicit
define gadget
define window
declare sizing ( )
declare drawToCanvas ( )
procedure drawToCanvas ( )
shared gadget
if ( startDrawing ( canvasOutput ( gadget ) ) )
box ( #null,
#null,
gadgetWidth ( gadget ),
gadgetHeight ( gadget ),
#black )
stopDrawing ( )
endIf
endProcedure
procedure sizing ( )
shared gadget
shared window
resizeGadget ( gadget,
#null,
#null,
windowWidth ( window ),
windowHeight ( window ) )
drawToCanvas ( )
endProcedure
window = openWindow ( #pb_any,
#null,
#null,
#null,
#null,
"Everything black? Try zooming!",
#pb_window_background )
gadget = canvasGadget ( #pb_any,
#null,
#null,
#null,
#null )
bindEvent ( #pb_event_sizeWindow,
@ sizing ( ) )
sizing ( )
disableExplicit
Using latest Chrome 67% zoom factor and maximized window on Windows 10 x86, white borders are visible.
PLEASE MAKE SURE THIS IMAGE IS DISPLAYED AT FULL SIZE

Supersizing the canvas or over-enlarging the box ( ) function's position parameters won't solve all of the problem. A thin line of blue background still shines through at the bottom.
Code: Select all
enableExplicit
define gadget
define window
declare sizing ( )
declare drawToCanvas ( )
procedure drawToCanvas ( )
shared gadget
if ( startDrawing ( canvasOutput ( gadget ) ) )
box ( #null,
#null,
gadgetWidth ( gadget ),
gadgetHeight ( gadget ),
#black )
stopDrawing ( )
endIf
endProcedure
procedure sizing ( )
shared gadget
shared window
; Try it! It helps... but it does not seem to be all-correct:
resizeGadget ( gadget,
- 20,
- 20,
windowWidth ( window ) +
40,
windowHeight ( window ) +
40 )
drawToCanvas ( )
endProcedure
window = openWindow ( #pb_any,
#null,
#null,
#null,
#null,
"Everything black? Try zooming!",
#pb_window_background )
gadget = canvasGadget ( #pb_any,
#null,
#null,
#null,
#null )
bindEvent ( #pb_event_sizeWindow,
@ sizing ( ) )
sizing ( )
disableExplicit
PLEASE MAKE SURE THIS IMAGE IS DISPLAYED AT FULL SIZE

In fact, if you proceed like in these code examples, the page zoom of a browser will propably always mess-up with a few pixels of the screen. The canvas should, however, fill the entire screen; everything should be black.
mfG