pub struct Graphics<'buffer> { /* private fields */ }

Implementations

Convert an x,y coord to idx for use with self.pixels

Get the canvas offset in pixels

Set the canvas offset in pixels

All drawing commands will be offset by this value

Adds delta to the current canvas offset

Copy entire pixels array to an image

Although the method takes &mut self it doesn’t mutate anything

Get top left pixel coord for letter px coord

Get width and height for string

Arguments
  • text - The string to be measured
  • width - The line width in characters
  • size - The text size to use when measuring
Returns

The width and height of the string in pixels

Draw an image at x, y

Draw renderable

Draw renderable

Update a pixel color, using [PixelWrapper::set_pixel] or [PixelWrapper::blend_pixel] depending on whether colors alpha is 255 or not

Sets every pixel to the same color, this ignores translate

Draw a letter at pos

Should only be used by Text::render text param must already be corrected wrapped

Set the RGB values for a pixel by blending it with the provided color This method uses alpha blending, note that the canvas pixels always have 255 alpha

Set the RGB values for a pixel This ignores alpha, so 255,0,0,0 will draw a red pixel

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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 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.