Skip to main content

LineImagePattern

Struct LineImagePattern 

Source
pub struct LineImagePattern<F: PatternFilter> { /* private fields */ }
Expand description

Image pattern for line rendering.

Port of C++ line_image_pattern<Filter>. Stores a copy of the pattern image extended with dilation borders for the filter to access neighboring pixels.

Implementations§

Source§

impl<F: PatternFilter> LineImagePattern<F>

Source

pub fn new() -> Self

Create an empty pattern with the specified filter type.

Source

pub fn with_source<S: ImagePatternSource>(src: &S) -> Self

Create a pattern initialized from a source.

Source

pub fn create<S: ImagePatternSource>(&mut self, src: &S)

Initialize or reinitialize the pattern from a source image.

Port of C++ line_image_pattern::create.

Source

pub fn pattern_width(&self) -> i32

Pattern width in subpixel coordinates (for repeating).

Source

pub fn line_width(&self) -> i32

Line width in subpixel coordinates (half-height of pattern).

Source

pub fn width(&self) -> f64

Width in floating-point (returns height, matching C++ behavior).

Source

pub fn pixel(&self, p: &mut Rgba8, x: i32, y: i32)

Get a pixel from the pattern at the given subpixel coordinates.

Port of C++ line_image_pattern::pixel.

Trait Implementations§

Source§

impl<F: PatternFilter> ImageLinePattern for LineImagePattern<F>

Source§

fn pattern_width(&self) -> i32

Pattern width in subpixel coordinates (for repeating).
Source§

fn line_width(&self) -> i32

Line width in subpixel coordinates (half-height of pattern).
Source§

fn width(&self) -> f64

Width in floating-point (returns height, matching C++ behavior).
Source§

fn pixel(&self, p: &mut Rgba8, x: i32, y: i32)

Get a pixel from the pattern at the given subpixel coordinates.

Auto Trait Implementations§

§

impl<F> Freeze for LineImagePattern<F>

§

impl<F> RefUnwindSafe for LineImagePattern<F>
where F: RefUnwindSafe,

§

impl<F> Send for LineImagePattern<F>
where F: Send,

§

impl<F> Sync for LineImagePattern<F>
where F: Sync,

§

impl<F> Unpin for LineImagePattern<F>
where F: Unpin,

§

impl<F> UnwindSafe for LineImagePattern<F>
where F: UnwindSafe,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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.