Skip to main content

CT_GraphicUnit

Struct CT_GraphicUnit 

Source
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

Source

pub fn new(id: u32, boundary: impl Into<String>) -> Self

创建新的图形单元。

Source

pub fn name(self, name: impl Into<String>) -> Self

设置对象名称。

Source

pub fn visible(self, visible: bool) -> Self

设置可见性。

Source

pub fn ctm(self, ctm: [f64; 6]) -> Self

设置变换矩阵。

Source

pub fn draw_param(self, id: u32) -> Self

设置绘制参数引用。

Source

pub fn line_width(self, width: f64) -> Self

设置线宽。

Source

pub fn cap(self, cap: LineCapType) -> Self

设置线端帽类型。

Source

pub fn join(self, join: LineJoinType) -> Self

设置线连接类型。

Source

pub fn miter_limit(self, limit: f64) -> Self

设置斜接限制。

Source

pub fn dash_offset(self, offset: f64) -> Self

设置虚线偏移。

Source

pub fn dash_pattern(self, pattern: impl Into<String>) -> Self

设置虚线模式。

Source

pub fn alpha(self, alpha: u8) -> Self

设置透明度 (0-255)。

Source

pub fn get_id(&self) -> u32

获取对象 ID。

Source

pub fn get_boundary(&self) -> &str

获取边界框。

Source

pub fn get_name(&self) -> Option<&str>

获取对象名称。

Source

pub fn get_visible(&self) -> bool

获取可见性。

Source

pub fn get_ctm(&self) -> Option<[f64; 6]>

获取变换矩阵。

Source

pub fn get_alpha(&self) -> Option<u8>

获取透明度。

Source

pub fn to_xml_string(&self) -> String

序列化为 OFD XML 字符串。

Trait Implementations§

Source§

impl Clone for CT_GraphicUnit

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for CT_GraphicUnit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.