Skip to main content

Module combine

Module combine 

Source
Expand description

Combine Images: several pictures laid out on one canvas and saved as a new PNG. In Eagle this is a plugin (combine-images); this is falcon’s own small version, not a copy of it.

plan is the layout maths: a row scales every picture to the tallest one’s height, a column to the widest one’s width, and a grid fits each inside one cell (the largest width by the largest height), centred. The canvas is kept to MAX_SIDE and MAX_PIXELS: past them everything, gaps included, is scaled down together.

stage does the work without touching the library, so it can run on another thread: one picture is decoded at a time, in sRGB and turned by its EXIF orientation (thumbnail::decode_for_display), an animation gives its first frame, and the result is 8 bits per channel. The sources are only read. The caller commits the Staged import.

Structs§

Cell
Where one picture goes on the canvas.
Combined
A finished combine, ready for crate::Library::commit_import.
Options
What the user chose.
Plan
A worked-out layout.

Enums§

Layout
How the pictures are arranged.

Constants§

MAX_PIXELS
The most pixels in a result: 400 MB in memory, which image’s default 512 MB limit can still read back for the thumbnail and the viewer.
MAX_SIDE
The longest side of a result. Past it the picture is scaled down.

Functions§

can_combine
Formats stage can read (lower-case, no dot): what the image crate decodes among falcon’s picture formats. SVG, RAW and QuickLook formats aren’t here.
compose
Draws the pictures at paths on one canvas. keep_going hears of each one before it is read, and returning false stops with Ok(None).
display_size
A picture’s size as it will be shown, from its header alone: an EXIF quarter turn swaps the sides.
plan
Lays out pictures of these sizes (width, height), keeping the canvas within MAX_SIDE and MAX_PIXELS. Fails when there are no pictures, one has no pixels, or they can’t fit even at 1 px each.
stage
Combines the pictures and stages the PNG for import with import. See compose for keep_going; it also hears of the save, as step paths.len().