Struct ggez::graphics::DrawParam[][src]

pub struct DrawParam {
    pub src: Rect,
    pub color: Color,
    pub trans: Transform,
}
Expand description

A struct containing all the necessary info for drawing a Drawable.

This struct implements the Default trait, so to set only some parameter you can just do:

let my_dest = glam::vec2(13.0, 37.0);
graphics::draw(ctx, drawable, DrawParam::default().dest(my_dest) );

As a shortcut, it also implements From for a variety of tuple types.

Fields

src: Rect

A portion of the drawable to clip, as a fraction of the whole image. Defaults to the whole image (0,0 to 1,1) if omitted.

color: Color

Default: white.

trans: Transform

Where to put the Drawable.

Implementations

Create a new DrawParam with default values.

Set the source rect

Set the dest point

Set the drawable color. This will be blended with whatever color the drawn object already is.

Set the rotation of the drawable.

Set the scaling factors of the drawable.

Set the transformation offset of the drawable.

Set the transformation matrix of the drawable.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Create a DrawParam from a location and color

Performs the conversion.

Create a DrawParam from a location, rotation and color

Performs the conversion.

Create a DrawParam from a location, rotation, offset and color

Performs the conversion.

Create a DrawParam from a location, rotation, offset, scale and color

Performs the conversion.

Create a DrawParam from a location. Note that this takes a single-element tuple. It’s a little weird but keeps the trait implementations from clashing.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.