Skip to content

DPI Scaling

Narta Xaymar Dirks edited this page Oct 31, 2026 · 2 revisions

DPI scaling on Windows

The original programs have no manifest, so Windows treats them as not aware of the DPI and stretches their window by the scaling of the display (150 % makes an 800x600 window cover 1200x900 physical pixels and look blurry). blitzcc embeds an application manifest in every program it builds for Windows that declares per monitor DPI awareness (version 2), support for long paths and the Windows versions 7 to 11. The window of Graphics is therefore as many pixels large as asked for, the mouse coordinates are pixels of the window, and GraphicsWidth, GraphicsHeight and the display modes are physical pixels.

The manifest is a resource that blitzcc writes next to the program while linking; no resource compiler is needed. A program built with --llvm-flag that names a .res file or a manifest (-Wl,/manifestinput:...) keeps its own and does not get this one. For MinGW targets the linker lld is used, because the GNU linker does not take resource files.

The windows of BlitzPlus

The windows that CreateWindow makes are the exception: they are scaled by the display like the windows of the original, which Windows stretches, only sharp. On a display at 150 % a window made 400 by 300 has 600 by 450 pixels, its gadgets and text are drawn one and a half times as big, and the program keeps counting in its own units: the sizes and places of gadgets, ClientWidth(Desktop()), the mouse and the buffer of a canvas are the numbers it gave (the picture of a canvas is enlarged when the window is drawn). The scale is that of the display the window is on (SDL_GetWindowDisplayScale: 1.5 for Windows at 150 %, 2 for a Retina display on macOS, the fractional scale of a Wayland output); a window that moves to a display with another scale changes its pixels, not its units. A program reads the scale with WindowScale#(window) and opts out of the scaling with WindowScaling 0: a unit is a pixel again, the desktop is reported in pixels, and every open window tells its scale in percent with the event $805 (EventData(), 150 for 150 %), again whenever it moves to a display of another scale, so the program can size its gadgets itself. WindowScaling 1 restores the scaling. BLITZLLVM_GUI_SCALE sets the scale for every window instead, 0 turns the scaling off like WindowScaling 0, only for the whole program and without a word in the code. See Windows-of-BlitzPlus.

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally