Blitz3D+ Command Reference

CanvasPixelHeight ( canvas )

Parameters

canvas - canvas gadget to measure

Description

Returns the height of a canvas's render surface in physical pixels.

Requires Extended language mode.

This is the real pixel height of the surface you draw on - the size CanvasBuffer, CameraViewport and CanvasMouseY all work in. It usually differs from GadgetHeight, which reports logical 96-DPI units: on a display scaled to 150%, a 400-unit-tall canvas is 600 pixels tall.

Because the canvas resizes with its window (via SetGadgetLayout), read it every frame rather than once at startup. The samples call CameraViewport camera,0,0,CanvasPixelWidth(canvas),CanvasPixelHeight(canvas) at the top of the render loop so the 3D view always fills the current canvas exactly.

See it working in the world editor shell sample.

See also: CanvasPixelWidth, CanvasMouseY, CanvasBuffer, GadgetHeight, CameraViewport.

Index