Skip to main content

Module loupe

Module loupe 

Source
Expand description

The loupe: the pixels under the pointer, magnified, in a square that follows it.

Experimental: may change in any release (docs/stability.md).

It shows displayed pixels: the viewport’s own tile textures, after the display transform, drawn again through a magnifying mapping and clipped to the loupe. On the GPU path the half-float tiles are sampled in a second paint callback (the same shader, its own uniforms), with no read back to the CPU; on the CPU path the tiles’ egui textures (nearest filtering) are drawn again. Each displayed pixel (an image pixel from 100 % up, a screen pixel below) becomes a square of magnification points, crisp, with an optional grid, a marker around the centre pixel and a readout of its values: as displayed (RGB, 0 to 255, and Lab) or as the source gave them (the scene values).

The loupe sits beside the pointer, above and to the right, and flips at the viewport’s edges. It is turned on by the application (a tool option: ViewportState::loupe_mut) or by a key (Loupe::key); the viewport signals each toggle (Signal::Loupe).

Structs§

Loupe
A viewport’s loupe settings.
LoupeFrame
What the loupe showed in the last frame (for tests and the debug bridge).
Sampling
How the loupe magnifies: what is at window physical pixel p lands at at + (p - center) × scale.

Enums§

Values
What the loupe’s readout shows.

Constants§

MAX_MAGNIFICATION
The largest magnification.
MIN_MAGNIFICATION
The smallest magnification.

Functions§

displayed
A scene colour (the source’s R, G and B, when it names them) as displayed: through the display stage, in 8 bits.
lab_from_srgb8
CIE Lab* (D65) of an 8-bit sRGB colour.
place
Where a loupe of size goes for a pointer: offset points above and to the right of it, flipped to the left at the right edge of bounds and below at its top, and kept inside when it does not fit either way.
readout_lines
The readout’s lines for a pixel: its coordinates and the mode, then its values as asked (none when the source gave nothing usable).
readout_templates
The widest text each line of the readout can hold, one per line: what the loupe’s readout block is measured from, so that its size stays the same while the values change, lag or go away.
stale
Whether the readout’s values shown for pixel are another pixel’s: the pointer moved on and the source has not answered yet.