pub trait ImageExt: 'static {
// Required method
fn set_bytes(
&self,
data: &Bytes,
pixel_format: PixelFormat,
width: u32,
height: u32,
row_stride: u32,
) -> Result<(), Error>;
}
Required Methods§
Sourcefn set_bytes(
&self,
data: &Bytes,
pixel_format: PixelFormat,
width: u32,
height: u32,
row_stride: u32,
) -> Result<(), Error>
fn set_bytes( &self, data: &Bytes, pixel_format: PixelFormat, width: u32, height: u32, row_stride: u32, ) -> Result<(), Error>
Sets the image data stored inside a glib::Bytes
to be displayed by self
.
If the image data was successfully loaded, the self
will be invalidated.
In case of error, the error
value will be set, and this function will
return false
.
The image data contained inside the glib::Bytes
is copied in texture memory,
and no additional reference is acquired on the data
.
§data
the image data, as a glib::Bytes
§pixel_format
the Cogl pixel format of the image data
§width
the width of the image data
§height
the height of the image data
§row_stride
the length of each row inside data
§Returns
true
if the image data was successfully loaded,
and false
otherwise.