pub struct CT_GraphicUnit {Show 13 fields
pub id: u32,
pub boundary: String,
pub name: Option<String>,
pub visible: bool,
pub ctm: Option<[f64; 6]>,
pub draw_param: Option<u32>,
pub line_width: Option<f64>,
pub cap: Option<LineCapType>,
pub join: Option<LineJoinType>,
pub miter_limit: Option<f64>,
pub dash_offset: Option<f64>,
pub dash_pattern: Option<String>,
pub alpha: Option<u8>,
}Expand description
对应 Java: org.ofdrw.core.pageDescription.CT_GraphicUnit
图元对象是版式文档中页面上呈现内容的最基本单元。 所有页面显示内容(文字、图形、图像等)都属于图元对象, 或是图元对象的组合。对应 GB/T 33190-2016 第 8.5 节图 45 表 34。
Fields§
§id: u32对象 ID,在页面内唯一。
boundary: String对象边界框 “topLeftX topLeftY width height”(单位 mm)。
name: Option<String>对象名称(可选),用于标识图元。
visible: bool可见性。true 表示可见(默认),false 表示隐藏。
ctm: Option<[f64; 6]>变换矩阵(可选),6 个元素的仿射变换矩阵。
draw_param: Option<u32>绘制参数引用 ID(可选)。
line_width: Option<f64>线宽(mm)。
cap: Option<LineCapType>线端帽类型。
join: Option<LineJoinType>线连接类型。
miter_limit: Option<f64>斜接限制。
dash_offset: Option<f64>虚线偏移。
dash_pattern: Option<String>虚线模式(如 “4 2” 表示 4mm 实线 2mm 间隔)。
alpha: Option<u8>透明度 (0-255),255 表示完全不透明。
Implementations§
Source§impl CT_GraphicUnit
impl CT_GraphicUnit
Sourcepub fn draw_param(self, id: u32) -> Self
pub fn draw_param(self, id: u32) -> Self
设置绘制参数引用。
Sourcepub fn line_width(self, width: f64) -> Self
pub fn line_width(self, width: f64) -> Self
设置线宽。
Sourcepub fn cap(self, cap: LineCapType) -> Self
pub fn cap(self, cap: LineCapType) -> Self
设置线端帽类型。
Sourcepub fn join(self, join: LineJoinType) -> Self
pub fn join(self, join: LineJoinType) -> Self
设置线连接类型。
Sourcepub fn miter_limit(self, limit: f64) -> Self
pub fn miter_limit(self, limit: f64) -> Self
设置斜接限制。
Sourcepub fn dash_offset(self, offset: f64) -> Self
pub fn dash_offset(self, offset: f64) -> Self
设置虚线偏移。
Sourcepub fn dash_pattern(self, pattern: impl Into<String>) -> Self
pub fn dash_pattern(self, pattern: impl Into<String>) -> Self
设置虚线模式。
Sourcepub fn get_boundary(&self) -> &str
pub fn get_boundary(&self) -> &str
获取边界框。
Sourcepub fn get_visible(&self) -> bool
pub fn get_visible(&self) -> bool
获取可见性。
Sourcepub fn to_xml_string(&self) -> String
pub fn to_xml_string(&self) -> String
序列化为 OFD XML 字符串。
Trait Implementations§
Source§impl Clone for CT_GraphicUnit
impl Clone for CT_GraphicUnit
Source§fn clone(&self) -> CT_GraphicUnit
fn clone(&self) -> CT_GraphicUnit
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CT_GraphicUnit
impl RefUnwindSafe for CT_GraphicUnit
impl Send for CT_GraphicUnit
impl Sync for CT_GraphicUnit
impl Unpin for CT_GraphicUnit
impl UnsafeUnpin for CT_GraphicUnit
impl UnwindSafe for CT_GraphicUnit
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