pub struct BitMapBackend<'a, P = RGBPixel>where
    P: PixelFormat,
{ /* private fields */ }
Expand description

The backend that drawing a bitmap

Warning

You should call .present()? on a BitMapBackend, not just drop it or allow it to go out of scope.

If the BitMapBackend is just dropped, it will make a best effort attempt to write the generated charts to the output file, but any errors that occcur (such as inability to create the output file) will be silently ignored.

Implementations

Create a new bitmap backend

Create a new bitmap backend that generate GIF animation

When this is used, the bitmap backend acts similar to a real-time rendering backend. When the program finished drawing one frame, use present function to flush the frame into the GIF file.

  • path: The path to the GIF file to create
  • dimension: The size of the GIF image
  • speed: The amount of time for each frame to display

Create a new bitmap backend which only lives in-memory

When this is used, the bitmap backend will write to a user provided u8 array (or Vec) in RGB pixel format.

Note: This function provides backward compatibility for those code that assumes Plotters uses RGB pixel format and maniuplates the in-memory framebuffer. For more pixel format option, use with_buffer_and_format instead.

  • buf: The buffer to operate
  • dimension: The size of the image in pixels
  • returns: The newly created bitmap backend

Create a new bitmap backend with a in-memory buffer with specific pixel format.

Note: This can be used as a way to manipulate framebuffer, mmap can be used on the top of this as well.

  • buf: The buffer to operate
  • dimension: The size of the image in pixels
  • returns: The newly created bitmap backend

Split a bitmap backend vertically into several sub drawing area which allows multi-threading rendering.

  • area_size: The size of the area
  • returns: The splitted backends that can be rendered in parallel

Trait Implementations

The error type reported by the backend
Get the dimension of the drawing backend in pixels
Ensure the backend is ready to draw
Finalize the drawing step and present all the changes. This is used as the real-time rendering support. The backend may implement in the following way, when ensure_prepared is called it checks if it needs a fresh buffer and present is called rendering all the pending changes on the screen. Read more
Draw a pixel on the drawing backend Read more
Draw a line on the drawing backend Read more
Draw a rectangle on the drawing backend Read more
Blit a bitmap on to the backend. Read more
Draw a path on the drawing backend Read more
Draw a circle on the drawing backend Read more
Draw a text on the drawing backend Read more
Estimate the size of the horizontal text if rendered on this backend. This is important because some of the backend may not have font ability. Thus this allows those backend reports proper value rather than ask the font rasterizer for that. Read more
Executes the destructor for this type. 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

Returns the argument unchanged.

Calls U::from(self).

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

Convert the type into a root drawing area
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.