[][src]Struct screen_13::gpu::write::WriteOp

pub struct WriteOp { /* fields omitted */ }

Writes an iterator of source textures onto a destination texture, using optional modes.

WriteOp is intended to provide high speed image splatting for tile maps, bitmap drawing, filtered image stretching, etc... Although generic 3D transforms are offered, the main use of this operation is 2D image composition.

NOTE: When no image filtering or resizing is required the CopyOp may provide higher performance. TODO: We can specialize for this so the API is the same, round the edge.

Examples

Writing a nine-sliced UI graphic:

use screen_13::prelude_all::*;

...

fn render_ui() {
    // We've already sliced up a UI box image (🔪 top left, 🔪 top, 🔪 top right, ...)
    let slices: [BitmapRef; 9] = ...
    let render: &Render = ...

    render.write().
        .with_mode(WriteMode::Blend(0x7f, BlendMode::ColorDodge))
        .with_preserve()
        .record(&mut [
            // top left
            Write::tile_position(&slices[0], Area::new(0, 0, 32, 32), Coord::new(0, 0)),

            // top
            Write::tile_position(&slices[1], Area::new(32, 0, 384, 32), Coord::new(32, 0)),

            // top right
            Write::tile_position(&slices[2], Area::new(426, 0, 32, 32), Coord::new(426, 0)),

            ...
        ]);
}

Implementations

impl WriteOp[src]

#[must_use]pub fn with_mode(&mut self, mode: Mode) -> &mut Self[src]

Sets the current write mode.

#[must_use]pub fn with_preserve(&mut self) -> &mut Self[src]

Preserves the contents of the destination texture. Without calling this function the existing contents of the destination texture will not be composited into the final result.

#[must_use]pub fn with_preserve_is(&mut self, val: bool) -> &mut Self[src]

Sets whether the destination texture will be composited into the final result or not.

pub fn record(&mut self, writes: &mut [Write<'_>])[src]

Submits the given writes for hardware processing.

Trait Implementations

impl Drop for WriteOp[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.