Struct cogl::Bitmap[][src]

pub struct Bitmap(_, _);

Implementations

impl Bitmap[src]

pub fn new_for_data(
    context: &Context,
    width: i32,
    height: i32,
    format: PixelFormat,
    rowstride: i32,
    data: &[u8]
) -> Bitmap
[src]

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_file(filename: &str) -> Result<Bitmap, Error>[src]

pub fn with_size(
    context: &Context,
    width: u32,
    height: u32,
    format: PixelFormat
) -> Bitmap
[src]

pub fn get_buffer(&self) -> Option<PixelBuffer>[src]

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 function will return None.

pub fn get_format(&self) -> PixelFormat[src]

Returns

the PixelFormat that the data for the bitmap is in.

pub fn get_height(&self) -> i32[src]

Returns

the height of the bitmap

pub fn get_rowstride(&self) -> i32[src]

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.

pub fn get_width(&self) -> i32[src]

Returns

the width of the bitmap

pub fn get_size_from_file(filename: &str) -> (bool, i32, i32)[src]

Parses an image file enough to extract the width and height of the bitmap.

filename

the file to check

width

return location for the bitmap width, or None

height

return location for the bitmap height, or None

Returns

true if the image was successfully parsed

Trait Implementations

impl Clone for Bitmap[src]

impl Debug for Bitmap[src]

impl Display for Bitmap[src]

impl Eq for Bitmap[src]

impl Hash for Bitmap[src]

impl IsA<Object> for Bitmap[src]

impl Ord for Bitmap[src]

impl<T: ObjectType> PartialEq<T> for Bitmap[src]

impl<T: ObjectType> PartialOrd<T> for Bitmap[src]

impl StaticType for Bitmap[src]

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

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 
[src]

impl<T> Cast for T where
    T: ObjectType
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: SetValue + Send + ToValue + ?Sized
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.