Skip to main content

Crate gfx

Crate gfx 

Source

Modules§

blend
blendmode
dash
flood
gradient
path
pathdata
raster
shapes
straight
stroke
tmask
xform

Structs§

Dc
the draw context of a target: clip (x0, y0, x1, y1 exclusive, in target pixels), origin, colour (straight and premultiplied), opacity
Surface
pixels of one image: rows of stride bytes (4 per pixel, A8: 1)

Constants§

CAP_BUTT
CAP_ROUND
CAP_SQUARE
COPY_PAR_MIN
a blit’s plain copy (XRGB source) from this many bytes on runs in row bands on the loop of set_parallel (gfxtest –bench-blit: a 1 MB copy takes about a fifth on 12 workers)
COPY_STREAM_MIN
… and from this many on with streaming stores (gfx::blend::copy_stream): source and target together no longer fit the caches, the target is not read first. A 4K frame (32 MB): 1.9 ms on 12 workers and the calling thread, 2.7 ms with plain stores, 5 ms on one thread (Ryzen 5 3600, DDR4-3200, a loaded machine; the memory’s limit for such a copy is about 1.7 ms there)
ERR_FAIL
ERR_LIMIT
ERR_NOMEM
FMT_A8
FMT_ARGB
FMT_PARGB
FMT_XRGB
FX_ONE
JOIN_BEVEL
JOIN_MITER
JOIN_ROUND
RULE_EVENODD
RULE_NONZERO
SFF_OPAQUE
SFF_OWNED

Functions§

div255
round(x / 255) for x in 0..=65025: ((x + 128) * 257) >> 16 (pmulhuw), equal to (x + 128 + ((x + 128) >> 8)) >> 8
parallel
the loop set by set_parallel
set_parallel
the loop large copies run on (Dc::blit, COPY_PAR_MIN); the UI runtime passes a wrapper of plat::parallel_for – gfx does not depend on plat. Without it they run on the calling thread (the same bytes)
try_zeroed
n zeroed bytes | None when the memory is not there (instead of an abort). A probe reservation first, then vec![0; n]: that is alloc_zeroed, whose fresh pages need no clearing pass.

Type Aliases§

ParallelFor
runs f(i) for every i in 0..n, possibly on several threads (img_core::ParallelFor)