Skip to main content

Module picture

Module picture 

Source
Expand description

A picture in a note: as wide as its row and no wider than it is, as tall as its proportions make it, and drawn pixel for pixel where it can be.

What draws a frame is a CPU renderer, and of all it does, scaling a picture costs the most. A picture is therefore kept at the size it is shown at (see crate::images), and this widget draws it as it is kept: where the pixels kept are the pixels its room takes, each is taken as it is, and where they aren’t (a row narrower than the widest, a screen that turned out another scale than the picture was made for) it is scaled as any picture is, smoothly, and slower.

It is laid out by the size of the picture itself and not by what is kept of it, which is rounded to whole pixels: the room it takes is the room that was kept for it when its note said how large it is.

iced’s own picture widget asks the renderer how large the picture is when it is laid out, for which the renderer makes its own copy of it there and then; it draws it smoothly whatever its size; and it takes its proportions from the pixels. This one is told its size.

A click on a picture is a click on its row, and the picture takes none of them but one: with the right button, if it was told what that does. The toolkit’s own way of hearing a click, an area around a widget, takes every press of the left button for itself, whether it was told what one does or not, and the row would hear of none.

Structs§

Picture
A picture in a note. See the module docs.

Constants§

SAME_SIZE 🔒
How far, in pixels, what is kept of a picture may be from the room it is drawn in and still be drawn pixel for pixel: less than one. A row is seldom a whole number of pixels wide, and the picture kept is.

Functions§

filter 🔒
How a picture kept at kept pixels is drawn in room of room pixels: each pixel as it is, if they are the same size, and smoothly if not.
shown 🔒
How large a picture size large is shown in a row width wide: as wide as the row and no wider than it is, in its own proportions.