pub struct VectorObject {
pub header: Vec<u8>,
pub point_size: usize,
pub points: Vec<Vec<u8>>,
}Expand description
One stroke or shape. header and every point keep their raw bytes.
Fields§
§header: Vec<u8>The header bytes (its size is the first u32).
point_size: usizeBytes per point (from the header).
points: Vec<Vec<u8>>Each point’s bytes.
Implementations§
Source§impl VectorObject
impl VectorObject
Sourcepub fn header_size(&self) -> usize
pub fn header_size(&self) -> usize
Header size in bytes (88, 92 or 96 in CSP files; 24 for some old objects).
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
The shape is closed (FLAG_CLOSED).
Sourcepub fn main_color(&self) -> [u8; 3]
pub fn main_color(&self) -> [u8; 3]
Main colour as 8-bit RGB (each channel is stored as 32 bits whose top byte is the 8-bit value).
Sourcepub fn brush_size(&self) -> Option<f64>
pub fn brush_size(&self) -> Option<f64>
Brush size in pixels (None for header layouts without one).
Sourcepub fn set_brush_size(&mut self, size: f64)
pub fn set_brush_size(&mut self, size: f64)
Sets the brush size, for header layouts that have one.
Sourcepub fn brush_styles(&self) -> Vec<u32>
pub fn brush_styles(&self) -> Vec<u32>
Brush style ids (BrushStyle.MainId) the header refers to.
Sourcepub fn shape_kind(&self) -> Option<u32>
pub fn shape_kind(&self) -> Option<u32>
The first settings word of a header-96 object (balloons and frames), which names the kind of shape: 0x130 a balloon, 0x111 or 0x311 a balloon’s tail, 0x410 a frame (values seen in the corpus).
Sourcepub fn is_balloon_tail(&self) -> bool
pub fn is_balloon_tail(&self) -> bool
A balloon’s tail (drawn with the line of the balloon before it).
Sourcepub fn coordinates(&self) -> Vec<(f64, f64)>
pub fn coordinates(&self) -> Vec<(f64, f64)>
(x, y) of every point, in layer pixels.
Source§impl VectorObject
impl VectorObject
Sourcepub fn brush_style(&self) -> Option<u32>
pub fn brush_style(&self) -> Option<u32>
The brush style id (BrushStyle.MainId) a new object copying this
one should use: the only id of an 88-byte header, the one at +76 of
larger headers (the second; the first of a 92-byte header can be 0).
Sourcepub fn new_line(line: &NewVectorLine, brush_style: u32) -> Option<VectorObject>
pub fn new_line(line: &NewVectorLine, brush_style: u32) -> Option<VectorObject>
A black line drawn with brush style brush_style. None for lines
with fewer than two points.
Sourcepub fn new_frame(
frame: &NewFrame,
template: &FrameTemplate,
brush_style: u32,
) -> Option<VectorObject>
pub fn new_frame( frame: &NewFrame, template: &FrameTemplate, brush_style: u32, ) -> Option<VectorObject>
A closed frame border laid out like template, drawn with brush
style brush_style. None for outlines with fewer than three points.