pub struct Layer {
pub shapes: Vec<Shape>,
pub sublayers: Vec<Layer>,
pub props: Inheritable<LayerProps>,
}Fields§
§shapes: Vec<Shape>§sublayers: Vec<Layer>§props: Inheritable<LayerProps>Implementations§
Source§impl Layer
impl Layer
pub fn new() -> Self
pub fn new_from(shapes: Vec<Shape>) -> Self
pub fn new_from_shapes_and_layers( shapes: Vec<Shape>, sublayers: Vec<Layer>, ) -> Self
pub fn new_from_file(path: &PathBuf) -> Result<Layer>
pub fn new_from_binary(binary_data: &Vec<u8>) -> Result<Layer>
pub fn set_props(&mut self, props: Inheritable<LayerProps>)
pub fn with_props(self, props: Inheritable<LayerProps>) -> Self
pub fn with_color(self, color: ColorRgb) -> Self
pub fn with_pen_width_cm(self, pen_width_cm: f32) -> Self
pub fn write_file(&self, path: &PathBuf) -> Result<()>
pub fn to_binary(&self) -> Result<Vec<u8>>
pub fn push(&mut self, shape: Shape)
pub fn push_path(&mut self, path: Path)
pub fn push_circle(&mut self, circle: Circle)
pub fn push_rect(&mut self, rect: Rect)
pub fn push_layer(&mut self, layer: Layer)
pub fn push_layer_flat(&mut self, layer: Layer)
pub fn push_many<I: IntoIterator<Item = Shape>>(&mut self, shapes: I)
pub fn iter(&self) -> Iter<'_, Shape>
pub fn iter_sublayers(&self) -> Iter<'_, Layer>
pub fn iter_flattened(&self) -> LayerFlattenedIterator<'_> ⓘ
pub fn len(&self) -> i32
pub fn is_empty(&self) -> bool
pub fn len_recursive(&self) -> i32
pub fn len_sublayers(&self) -> i32
pub fn to_svg(&self, scale: f32) -> Document
pub fn write_svg(&self, path: PathBuf, scale: f32) -> Result<()>
pub fn combine_shapes_flat(&self, max_angle_delta: Option<Angle>) -> Self
pub fn map_recursive_mut<F: Fn(&mut Shape)>(&mut self, f: F)
pub fn map_recursive<F: Fn(&Shape) -> Shape>(&self, f: F) -> Self
pub fn filter_recursive<F>(&self, f: F) -> Self
pub fn filter_recursive_mut<F>(&mut self, predicate: F)
pub fn mask_flattened( &self, mask: &Shape, sample_settings: &SampleSettings, ) -> Masked
pub fn mask_geo_flattened_inside( &self, mask: &Shape, sample_settings: &SampleSettings, ) -> Layer
pub fn mask_geo_flattened_outside( &self, mask: &Shape, sample_settings: &SampleSettings, ) -> Layer
pub fn simplify(&self, aggression_factor: f32) -> Self
pub fn mask_flattened_brute_force( &self, mask: &Shape, sample_settings: &SampleSettings, ) -> Masked
pub fn optimize(&self) -> Self
pub fn optimize_recursive(&self) -> Self
pub fn flatten(&self) -> Self
Trait Implementations§
Source§impl BoundingBox for Layer
impl BoundingBox for Layer
fn bounding_box(&self) -> Option<Rect>
Source§impl<'de> Deserialize<'de> for Layer
impl<'de> Deserialize<'de> for Layer
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FromIterator<Layer> for Layer
impl FromIterator<Layer> for Layer
Source§impl FromIterator<Shape> for Layer
impl FromIterator<Shape> for Layer
Auto Trait Implementations§
impl Freeze for Layer
impl RefUnwindSafe for Layer
impl Send for Layer
impl Sync for Layer
impl Unpin for Layer
impl UnwindSafe for Layer
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more