[][src]Struct graphics_buffer::RenderBuffer

pub struct RenderBuffer { /* fields omitted */ }

A buffer that can be rendered to with Piston's graphics library.

Enabling the piston_window_texture feature exposes a function called to_g2d_texture, with the following signature:

This example is not tested
pub fn to_g2d_texture(
    context: &mut G2dTextureContext,
    settings: &TextureSettings,
) -> Result<G2dTexture, Box<dyn std::error::Error>>;


impl RenderBuffer[src]

pub fn new(width: u32, height: u32) -> RenderBuffer[src]

Create a new RenderBuffer with the given witdth or height.

pub fn open<P: AsRef<Path>>(path: P) -> Result<RenderBuffer, Box<dyn Error>>[src]

Creates a new RenderBuffer by opening it from a file.

pub fn decode_from_bytes(bytes: &[u8]) -> ImageResult<RenderBuffer>[src]

Creates a new RenderBuffer by decoding image data.

pub fn clear(&mut self, color: [f32; 4])[src]

Clear the buffer with a color.

pub fn pixel(&self, x: u32, y: u32) -> [f32; 4][src]

Returns the color of the pixel at the given coordinates.

pub fn set_pixel(&mut self, x: u32, y: u32, color: [f32; 4])[src]

Sets the color of the pixel at the given coordinates.

Trait Implementations

impl Clone for RenderBuffer[src]

impl CreateTexture<()> for RenderBuffer[src]

impl Debug for RenderBuffer[src]

impl Deref for RenderBuffer[src]

type Target = RgbaImage

The resulting type after dereferencing.

impl From<DynamicImage> for RenderBuffer[src]

impl From<ImageBuffer<Rgba<u8>, Vec<u8>>> for RenderBuffer[src]

impl Graphics for RenderBuffer[src]

type Texture = RenderBuffer

The texture type associated with the back-end. Read more

impl ImageSize for RenderBuffer[src]

impl TextureOp<()> for RenderBuffer[src]

type Error = Error

The error when performing an operation.

impl UpdateTexture<()> for RenderBuffer[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> SetParameter for T

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.