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>>,
}Expand description
渲染入参。链式覆写;default() = 720 逻辑宽、亮色、scale 2、PNG、默认字体句柄。
Fields§
§width: f32逻辑内容宽(含左右内边距),默认 720。
padding: Insets页边距(逻辑像素)。
scale: f32超采样系数(输出 = 逻辑尺寸 × scale),默认 2.0。越大越清晰也越慢 / 越大。
theme: Theme视觉主题。
fonts: FontHandle字体栈句柄。
format: OutputFormat输出格式,默认 PNG。
images: HashMap<String, Vec<u8>>标记文本里 @名字 图片 → 字节。
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_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