Skip to main content

TileBrushCalculator

Struct TileBrushCalculator 

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

Calculates the rectangles and transform needed to render a tile brush.

Implementations§

Source§

impl TileBrushCalculator

Source

pub fn from_brush( brush: &dyn ITileBrush, content_size: Size, target_size: Size, ) -> Self

Creates a calculator for a tile brush.

  • brush - The brush to be rendered.
  • content_size - The size of the content of the tile brush.
  • target_size - The size of the control to which the brush is being rendered.
Source

pub fn new( tile_mode: TileMode, stretch: Stretch, alignment_x: AlignmentX, alignment_y: AlignmentY, source_rect: RelativeRect, destination_rect: RelativeRect, content_size: Size, target_size: Size, ) -> Self

Initializes a new instance of the TileBrushCalculator type.

  • tile_mode - The brush’s tile mode.
  • stretch - The brush’s stretch.
  • alignment_x - The brush’s horizontal alignment.
  • alignment_y - The brush’s vertical alignment.
  • source_rect - The brush’s source rect
  • destination_rect - The brush’s destination rect.
  • content_size - The size of the content of the tile brush.
  • target_size - The size of the control to which the brush is being rendered.
Source

pub fn is_valid(&self) -> bool

Upstream declares this get-only property and never assigns it, so it is always false.

Source

pub fn destination_rect(&self) -> Rect

Gets the rectangle on the destination control to which content should be rendered.

If the tile mode of the brush is repeating then this is describes rectangle of a single repeat of the tiled content.

Source

pub fn intermediate_clip(&self) -> Rect

Gets the clip rectangle on the intermediate image with which the brush content should be drawn when needs_intermediate is true.

Source

pub fn intermediate_size(&self) -> Size

Gets the size of the intermediate image that should be created when needs_intermediate is true.

Source

pub fn intermediate_transform(&self) -> Matrix

Gets the transform to be used when rendering to the intermediate image when needs_intermediate is true.

Source

pub fn needs_intermediate(&self) -> bool

Gets a value indicating whether an intermediate image should be created in order to render the tile brush.

Intermediate images are required when a brush’s tile mode is not repeating but the source and destination aspect ratios are unequal, as all of the currently supported rendering backends do not support non-tiled image brushes.

Source

pub fn source_rect(&self) -> Rect

Gets the area of the source content to be rendered.

Source

pub fn calculate_translate( alignment_x: AlignmentX, alignment_y: AlignmentY, source_rect: Rect, destination_rect: Rect, scale: Vector, ) -> Vector

Source

pub fn calculate_translate_sizes( alignment_x: AlignmentX, alignment_y: AlignmentY, source_size: Size, destination_size: Size, ) -> Vector

Source

pub fn calculate_intermediate_transform( tile_mode: TileMode, source_rect: Rect, destination_rect: Rect, scale: Vector, translate: Vector, ) -> (Matrix, Rect)

Returns the transform and the draw rectangle (upstream’s out drawRect).

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> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). 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 = !

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.