pub enum DrawItem {
Text {Show 14 fields
x: f32,
y: f32,
font_id: u16,
size: f32,
width: f32,
text: String,
source: String,
source_map: Vec<u32>,
origin: Option<SourceRange>,
pseudo_element: Option<NodeId>,
features: Features,
color: Color,
glyphs: Vec<Glyph>,
layer: i32,
},
Rect {
x: f32,
y: f32,
w: f32,
h: f32,
color: Color,
layer: i32,
},
Image {
x: f32,
y: f32,
w: f32,
h: f32,
asset: u32,
alpha: u8,
layer: i32,
},
Background {Show 13 fields
x: f32,
y: f32,
w: f32,
h: f32,
radii: Corners,
tile_x: f32,
tile_y: f32,
tile_w: f32,
tile_h: f32,
repeat: bool,
asset: u32,
alpha: u8,
layer: i32,
},
Rounded {
x: f32,
y: f32,
w: f32,
h: f32,
radii: Corners,
ring: Edges,
color: Color,
layer: i32,
},
}Expand description
A single paint operation. Deliberately tiny: text, rules, images, and the rounded boxes a border radius draws.
Variants§
Text
A run of shaped glyphs sharing a font, size, and baseline.
Fields
text: StringThe text the glyphs were shaped from, which the glyphs’ ranges index. A painter that draws characters rather than glyphs draws these.
source: StringWhat the author wrote, where text-transform or small
capitals made that differ from what was shaped, and empty
where the two are the same. Text extraction and copy and
paste return this rather than text: a title set in
capitals is read back in the case it was written in.
source_map: Vec<u32>The offset in source of every byte boundary of text,
so source_map[range.start]..source_map[range.end] is the
source a glyph stands for. Empty alongside source.
origin: Option<SourceRange>Where the run was written: the content node it was shaped
from and the bytes of that node’s own text it stands for.
The runs that name one node tile it, so a cursor in the
manuscript lands on a run and a run lands back on the
manuscript. The text of ::before and ::after names the
id of that pseudo-element. Absent on text the engine adds
to the book: a folio, a running head, a scene break’s
ornament, and a table’s header row set again on a later
page.
pseudo_element: Option<NodeId>The pseudo-element the run was cut from: a drop cap, the
line a paragraph opens on, or the text of ::before or
::after. origin still names the text it stands for.
Rect
Filled rectangle: rules, borders, backgrounds.
Fields
Image
Placed image; asset indexes the asset table.
Fields
Background
An image painted behind a box: the page’s own, or a block’s border box.
The box is what the image is clipped to, and the tile is
where one copy of it is drawn, which may reach outside the
box. A painter clips to the box, draws the tile, and repeats
the tile across and down the box where repeat asks for it.
Fields
Rounded
A filled box with rounded corners: a background, or a border drawn as a ring.
The outer shape is the box with its corners rounded by radii.
Where ring is zero on all four edges, the whole shape is
filled. Otherwise the fill is the band between the outer shape
and an inner one: the box ring in from each edge, with the
corners Corners::inside gives.
Implementations§
Source§impl DrawItem
impl DrawItem
Sourcepub const PAGE_BACKGROUND: i32 = i32::MIN
pub const PAGE_BACKGROUND: i32 = i32::MIN
The layer a page’s own background paints in: under every layer
a stylesheet can name. Where a stylesheet names no z-index,
the text of a page still covers the background. A stylesheet
that names this number paints over the background as well. The
page puts its own background in first, and one layer keeps the
order it arrived in.
Sourcepub const PAGE_FURNITURE: i32 = i32::MAX
pub const PAGE_FURNITURE: i32 = i32::MAX
The layer a page’s margin boxes paint in: over every layer a stylesheet can name. A page number and a running head stay visible whatever layer the blocks of the book are raised to.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DrawItem
impl<'de> Deserialize<'de> for DrawItem
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for DrawItem
Auto Trait Implementations§
impl Freeze for DrawItem
impl RefUnwindSafe for DrawItem
impl Send for DrawItem
impl Sync for DrawItem
impl Unpin for DrawItem
impl UnsafeUnpin for DrawItem
impl UnwindSafe for DrawItem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.