Skip to main content

OfdPageGraphics2D

Struct OfdPageGraphics2D 

Source
pub struct OfdPageGraphics2D {
    pub page_width: f64,
    pub page_height: f64,
    pub draw_param: OfdGraphics2DDrawParam,
    pub object_count: u32,
}
Expand description

OFD 页面 2D 图形上下文。

对应 Java: org.ofdrw.graphics2d.OFDPageGraphics2D

绑定到单个 OFD 页面的绘图上下文,持有当前绘制参数和页面尺寸。 Java 版提供完整的 Graphics2D API(drawLine / fillRect / drawString 等); Rust 版保留上下文状态,具体绘制由上层引擎实现。

Fields§

§page_width: f64

页面宽度(mm)。

§page_height: f64

页面高度(mm)。

§draw_param: OfdGraphics2DDrawParam

当前绘制参数。

§object_count: u32

已绘制的对象计数。

Implementations§

Source§

impl OfdPageGraphics2D

Source

pub fn new(page_width: f64, page_height: f64) -> Self

创建新的页面图形上下文。

Source

pub fn draw_param(self, param: OfdGraphics2DDrawParam) -> Self

设置绘制参数。

Source

pub fn page_width(&self) -> f64

获取页面宽度。

Source

pub fn page_height(&self) -> f64

获取页面高度。

Source

pub fn object_count(&self) -> u32

获取已绘制对象数。

Source

pub fn increment_object_count(&mut self)

增加对象计数(模拟绘制操作)。

Trait Implementations§

Source§

impl Clone for OfdPageGraphics2D

Source§

fn clone(&self) -> OfdPageGraphics2D

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 OfdPageGraphics2D

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.