pub struct Shape {
pub shape_type: ShapeType,
pub x: u32,
pub y: u32,
pub width: u32,
pub height: u32,
pub fill: Option<ShapeFill>,
pub gradient: Option<GradientFill>,
pub line: Option<ShapeLine>,
pub text: Option<String>,
pub id: Option<u32>,
pub rotation: Option<i32>,
pub hyperlink: Option<Hyperlink>,
}Expand description
Shape definition
Fields§
§shape_type: ShapeType§x: u32§y: u32§width: u32§height: u32§fill: Option<ShapeFill>§gradient: Option<GradientFill>§line: Option<ShapeLine>§text: Option<String>§id: Option<u32>Optional fixed shape ID for connector anchoring
rotation: Option<i32>Rotation in degrees (0-360)
hyperlink: Option<Hyperlink>Optional hyperlink
Implementations§
Source§impl Shape
impl Shape
Sourcepub fn new(
shape_type: ShapeType,
x: u32,
y: u32,
width: u32,
height: u32,
) -> Self
pub fn new( shape_type: ShapeType, x: u32, y: u32, width: u32, height: u32, ) -> Self
Create a new shape
Sourcepub fn with_rotation(self, degrees: i32) -> Self
pub fn with_rotation(self, degrees: i32) -> Self
Set shape rotation in degrees
Sourcepub fn with_hyperlink(self, hyperlink: Hyperlink) -> Self
pub fn with_hyperlink(self, hyperlink: Hyperlink) -> Self
Set shape hyperlink
Sourcepub fn with_gradient(self, gradient: GradientFill) -> Self
pub fn with_gradient(self, gradient: GradientFill) -> Self
Set gradient fill
Sourcepub fn from_dimensions(
shape_type: ShapeType,
x: Dimension,
y: Dimension,
width: Dimension,
height: Dimension,
) -> Self
pub fn from_dimensions( shape_type: ShapeType, x: Dimension, y: Dimension, width: Dimension, height: Dimension, ) -> Self
Create a shape using flexible Dimension units for position and size.
use ppt_rs::core::Dimension;
use ppt_rs::generator::shapes::{Shape, ShapeType};
// Position at 10% from left, 20% from top; size = 80% width, 2 inches height
let shape = Shape::from_dimensions(
ShapeType::Rectangle,
Dimension::Ratio(0.1), Dimension::Ratio(0.2),
Dimension::Ratio(0.8), Dimension::Inches(2.0),
);Sourcepub fn at(self, x: Dimension, y: Dimension) -> Self
pub fn at(self, x: Dimension, y: Dimension) -> Self
Set position using flexible Dimension units (fluent).
use ppt_rs::core::Dimension;
use ppt_rs::generator::shapes::{Shape, ShapeType};
let shape = Shape::new(ShapeType::Rectangle, 0, 0, 914400, 914400)
.at(Dimension::Ratio(0.5), Dimension::Ratio(0.5));Sourcepub fn with_dimensions(self, width: Dimension, height: Dimension) -> Self
pub fn with_dimensions(self, width: Dimension, height: Dimension) -> Self
Set size using flexible Dimension units (fluent).
use ppt_rs::core::Dimension;
use ppt_rs::generator::shapes::{Shape, ShapeType};
let shape = Shape::new(ShapeType::Rectangle, 0, 0, 0, 0)
.with_dimensions(Dimension::Inches(3.0), Dimension::Cm(5.0));Trait Implementations§
Source§impl Positioned for Shape
impl Positioned for Shape
Auto Trait Implementations§
impl Freeze for Shape
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnsafeUnpin for Shape
impl UnwindSafe for Shape
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