Skip to main content

Crate brushkit_preview

Crate brushkit_preview 

Source
Expand description

Tip bitmaps for every brush file this workspace reads.

preview_abr, preview_brush and preview_brushset each take the whole file as bytes and return one PreviewEntry per brush in file order, available or not. A brush whose tip cannot be rendered is reported with a reason rather than dropped, so a caller can lay out a complete grid.

Every function here is pure over &[u8]: no filesystem, no threads, so the crate builds for wasm32-unknown-unknown.

Modules§

procreate
Reading Procreate .brush and .brushset archives: the guarded zip and plist readers, the Shape.png decoder and the two name/member lookups the preview API needs.

Structs§

ContactSheetConfig
GrayscaleBitmap
PreviewEntry
PreviewError
PreviewOptions
PreviewSet
SheetBrush

Enums§

SheetBackground
TipImageError
TipPreview
UnavailableReason

Constants§

MAX_IMPORT_DIMENSION

Functions§

can_synthesize
decode_tip_image
Decode an imported brush-tip image (PNG/JPEG bytes) into a grayscale tip buffer. Alpha becomes intensity when the image has an alpha channel; otherwise luminance is inverted (dark = opaque), matching Photoshop’s convention.
downsample
Box-filter bitmap so its larger side is at most max_side (>= 1). Returns a clone when it already fits. Average of the covered source pixels per destination pixel, the same filter generate_preview_png uses.
generate_contact_sheet_png
generate_preview_png
A 200 px RGBA thumbnail: black ink, alpha from the tip’s gray value.
preview_abr
Tips for a Photoshop .abr pack.
preview_brush
The tip of a single Procreate .brush: one entry at index 0, read from the archive’s root rather than from a member directory.
preview_brushset
Tips for a Procreate .brushset.
synthesize_computed_tip
Rasterize a monochrome elliptical tip from computed-brush geometry.
tip_bitmap_of
Both formats use the same polarity — a Shape.png is white=stamp coverage and a TipBitmap is 255=full ink — so the pixels are copied unchanged.
to_grayscale