pub struct RenderOptions {
pub width: f32,
pub padding: Insets,
pub scale: f32,
pub theme: Theme,
pub fonts: FontHandle,
pub format: OutputFormat,
pub images: HashMap<String, Vec<u8>>,
pub header: Option<PageChrome>,
pub footer: Option<PageChrome>,
}Expand description
渲染入参。链式覆写;default() = 960 逻辑宽、亮色、scale 2、PNG、默认字体句柄。
Fields§
§width: f32逻辑内容宽(含左右内边距),默认 960。
padding: Insets页边距(逻辑像素)。
scale: f32超采样系数(输出 = 逻辑尺寸 × scale),默认 2.0。越大越清晰也越慢 / 越大。
theme: Theme视觉主题。
fonts: FontHandle字体栈句柄。
format: OutputFormat输出格式,默认 PNG。
images: HashMap<String, Vec<u8>>标记文本里 @名字 图片 → 字节。
header: Option<PageChrome>页眉条(可选):一行小字排在内容上方,与文档无关的固定标识(品牌 / 出处)。
页脚条(可选):一行小字排在内容下方,常放项目水印(如「abot · github.com/…」)。
Implementations§
Source§impl RenderOptions
impl RenderOptions
Sourcepub fn with_width(self, w: f32) -> Self
pub fn with_width(self, w: f32) -> Self
设逻辑内容宽。
Sourcepub fn with_padding(self, p: Insets) -> Self
pub fn with_padding(self, p: Insets) -> Self
设页边距(逻辑像素)。
Sourcepub fn with_theme(self, t: Theme) -> Self
pub fn with_theme(self, t: Theme) -> Self
设主题。
Sourcepub fn with_fonts(self, f: FontHandle) -> Self
pub fn with_fonts(self, f: FontHandle) -> Self
设字体句柄。
Sourcepub fn with_scale(self, s: f32) -> Self
pub fn with_scale(self, s: f32) -> Self
设超采样系数(清晰度档位,见 fast/sharp/ultra 预设)。
Sourcepub fn with_header(self, text: impl Into<String>) -> Self
pub fn with_header(self, text: impl Into<String>) -> Self
设页眉(默认形态:左对齐次要色小字 + 细线);要微调用 with_header_chrome。
Sourcepub fn with_header_chrome(self, c: PageChrome) -> Self
pub fn with_header_chrome(self, c: PageChrome) -> Self
设页眉(完整形态)。
设页脚(默认形态:居中次要色小字 + 细线,适合项目水印);微调用 with_footer_chrome。
设页脚(完整形态)。
Sourcepub fn with_format(self, f: OutputFormat) -> Self
pub fn with_format(self, f: OutputFormat) -> Self
设输出格式。
Sourcepub fn webp_or_png(self) -> Self
pub fn webp_or_png(self) -> Self
输出 WebP,但画布单边 > 16383px(WebP 上限)时自动落 PNG。
Trait Implementations§
Source§impl Clone for RenderOptions
impl Clone for RenderOptions
Source§fn clone(&self) -> RenderOptions
fn clone(&self) -> RenderOptions
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 RenderOptions
impl RefUnwindSafe for RenderOptions
impl Send for RenderOptions
impl Sync for RenderOptions
impl Unpin for RenderOptions
impl UnsafeUnpin for RenderOptions
impl UnwindSafe for RenderOptions
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