Struct libnotcurses_sys::examples::utils::Canvas[][src]

pub struct Canvas {
    pub h: u32,
    pub w: u32,
    pub buf: Vec<u8>,
}
Expand description

A rectangular array of pixels that can be individually colored.

Fields

h: u32

The height.

w: u32

The width.

buf: Vec<u8>

A bytes buffer.

Implementations

New white Canvas.

New custom colored Canvas.

Returns the canvas size in cartesian coordinates.

Returns

Cartesian coordinates, goes from the bottom-left to the top-right corner.

(beg_y, end_y, beg_x, end_x)

    ↓ beg_x (-)   0.  (+) end_x ↓
                  ↓
    ·---------------------------· ← end_y (+)
    |                           |
    |                           |
    |                           |
    |             +             | ← 0.
    |                           |
    |                           |
    |                           |
    ·---------------------------· ← beg_y (-)

Returns the canvas size in screen coordinates.

Returns

Screen coordinates, goes from the top-left to the bottom-right corner.

(beg_y, end_y, beg_x, end_x)

    ↓ beg_x (0)          end_x ↓
    +---------------------------· ← beg_y (0)
    |                           |
    |                           |
    |                           |
    |                           |
    |                           |
    |                           |
    |                           |
    ·---------------------------· ← end_y

Assigns a color to a pixel, using cartesian coordinates.

Assigns a color to a pixel, using screen coordinates.

Performs conversion from screen coordinates to cartesian coordiantes.

In screen coordinates the origin (0,0) is at the top left:

  • y increases towards the bottom.
  • x increases towards the right.

Performs conversion from cartesian coordinates to screen coordiantes.

In cartesian coordiantes the origin (0,0) is at the center:

  • y increases towards the top and decreases towards the bottom.
  • x increases towards the right and decreases towards the left.

Trait Implementations

Formats the value using the given formatter. Read more

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