Skip to main content

SkiaDevice

Struct SkiaDevice 

Source
pub struct SkiaDevice { /* private fields */ }
Expand description

tiny-skia based raster device.

Implementations§

Source§

impl SkiaDevice

Source

pub fn new(width: u32, height: u32) -> Self

Create a new device with the given page dimensions and default PNG output.

Defers the full-page pixmap allocation — only a 1×1 placeholder is created here. The full pixmap is allocated lazily in replay_and_show only when the non-banded rendering path is needed.

Source

pub fn with_sink_factory( width: u32, height: u32, sink_factory: Box<dyn PageSinkFactory>, ) -> Self

Create a new device with a custom page sink factory.

Source

pub fn set_use_viewport_path(&mut self, on: bool)

Route rendering through the viewport pipeline. Used by the visual test runner’s --device viewport-png mode.

Source

pub fn set_layer_set(&mut self, layer_set: LayerSet)

Replace the device’s OCG visibility overrides.

The empty default has every layer fall back to its default_visible baked into the display list. Callers building a layer panel hand in a populated LayerSet each render pass.

Source

pub fn layer_set(&self) -> &LayerSet

Read-only view of the device’s current OCG visibility overrides.

Source

pub fn pixmap(&self) -> &Pixmap

Get the underlying pixmap (for testing).

Source

pub fn set_system_cmyk_bytes(&mut self, bytes: Arc<Vec<u8>>)

Set the system CMYK ICC profile bytes for ICC-aware rendering.

Source

pub fn set_no_aa(&mut self, no_aa: bool)

Disable anti-aliasing for all fill/stroke operations.

Trait Implementations§

Source§

impl Drop for SkiaDevice

Available on crate feature ps-device only.
Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl OutputDevice for SkiaDevice

Available on crate feature ps-device only.
Source§

fn fill_path(&mut self, path: &PsPath, params: &FillParams)

Fill a path with the given color.
Source§

fn stroke_path(&mut self, path: &PsPath, params: &StrokeParams)

Stroke a path with the given parameters.
Source§

fn clip_path(&mut self, path: &PsPath, params: &ClipParams)

Intersect the current clip region with the given path.
Source§

fn init_clip(&mut self)

Reset clipping to the full page.
Source§

fn erase_page(&mut self)

Erase the page (fill with white).
Source§

fn show_page(&mut self, output_path: &str) -> Result<(), String>

Output the current page (e.g., save PNG) and return Ok/Err.
Source§

fn draw_image(&mut self, sample_data: &[u8], params: &ImageParams)

Draw an image from raw sample data.
Source§

fn paint_axial_shading(&mut self, params: &AxialShadingParams)

Paint an axial (linear) gradient shading.
Source§

fn paint_radial_shading(&mut self, params: &RadialShadingParams)

Paint a radial gradient shading.
Source§

fn paint_mesh_shading(&mut self, params: &MeshShadingParams)

Paint a Gouraud-shaded triangle mesh.
Source§

fn paint_patch_shading(&mut self, params: &PatchShadingParams)

Paint a Coons/tensor-product patch mesh.
Source§

fn paint_pattern_fill(&mut self, params: &PatternFillParams)

Paint a tiled pattern fill.
Source§

fn page_size(&self) -> (u32, u32)

Page dimensions in device pixels.
Source§

fn replay_and_show( &mut self, list: DisplayList, output_path: &str, ) -> Result<(), String>

Replay a display list and write output in one step.
Source§

fn finish(&mut self) -> Result<(), String>

Wait for any pending background render to complete.
Source§

fn set_trim_box(&mut self, _llx: f64, _lly: f64, _urx: f64, _ury: f64)

Set the trim box for the next page (PDF points, lower-left origin). Only meaningful for PDF output; other devices ignore this.
Source§

fn finish_with_context(&mut self, _ctx: &Context) -> Result<(), String>

Called after interpretation finishes, with access to the interpreter context.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Downcast to a concrete type. Override in implementations that need to be accessed after rendering (e.g., PdfDevice for in-memory output).

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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, <T as TryFrom<U>>::Error>

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.