pub struct Bitmap { /* private fields */ }
Implementations
sourceimpl Bitmap
impl Bitmap
sourcepub fn new_for_data(
width: u32,
height: u32,
format: PixelFormat,
rowstride: u32,
data: &[u8]
) -> Bitmap
pub fn new_for_data(
width: u32,
height: u32,
format: PixelFormat,
rowstride: u32,
data: &[u8]
) -> Bitmap
Creates a bitmap using some existing data. The data is not copied
so the application must keep the buffer alive for the lifetime of
the Bitmap
. This can be used for example with
Framebuffer::read_pixels_into_bitmap
to read data directly
into an application buffer with the specified rowstride.
context
A Context
width
The width of the bitmap.
height
The height of the bitmap.
format
The format of the pixel data.
rowstride
The rowstride of the bitmap (the number of bytes from the start of one row of the bitmap to the next).
data
A pointer to the data. The bitmap will take ownership of this data.
Returns
A new Bitmap
.
pub fn from_buffer(
buffer: Bytes,
format: PixelFormat,
width: u32,
height: u32,
rowstride: u32,
offset: i32
) -> Bitmap
pub fn from_file(filename: &str) -> Bitmap
pub fn with_size(
context: &Context,
width: u32,
height: u32,
format: PixelFormat
) -> Bitmap
sourcepub fn buffer(&self) -> Option<PixelBuffer>
pub fn buffer(&self) -> Option<PixelBuffer>
Returns
the PixelBuffer
that this
buffer uses for storage. Note that if the bitmap was created with
Bitmap::new_from_file
then it will not actually be using a
pixel buffer and this fn will return None
.
sourcepub fn format(&self) -> PixelFormat
pub fn format(&self) -> PixelFormat
Returns
the PixelFormat
that the data for the bitmap is in.
sourcepub fn rowstride(&self) -> u32
pub fn rowstride(&self) -> u32
Returns
the rowstride of the bitmap. This is the number of bytes between the address of start of one row to the address of the next row in the image.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Bitmap
impl Send for Bitmap
impl Sync for Bitmap
impl Unpin for Bitmap
impl UnwindSafe for Bitmap
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
sourcefn into_color(self) -> To
fn into_color(self) -> To
Convert into color
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.