pub struct PixelWrapper {
    pub pixels: Pixels,
    // some fields omitted
}

Fields

pixels: Pixels

Implementations

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

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

Sets every pixel to the same color, this ignores translate

Draw an image at x, y

Draw a letter at a letter coord See TextSize::get_max_characters for maximum x and y

Draw a letter at pixel coord

Draws text in lines at most width chars long at pixel coord

Width should be max chars - x See TextSize::get_max_characters for maximum chars

Draws text in lines at most width chars long at letter coord

Width must be max chars - x See TextSize::get_max_characters for maximum x and y

Get the RGB values for a pixel Alpha will always be 255

If use_translate is true than the x,y will be updated with self.translate

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

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

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

Draw a filled rectangle from x1,y1 to x2,y2 in color

Draw a hollow rectangle from x1,y1 to x2,y2 in color

Draw line from x1,y1 to x2,y2 in color

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