Struct cognitive_qualia::memory::Buffer
[−]
[src]
pub struct Buffer { /* fields omitted */ }
Container for all data required to draw an image.
Methods
impl Buffer
[src]
fn new(
format: PixelFormat,
width: usize,
height: usize,
stride: usize,
data: Vec<u8>
) -> Self
format: PixelFormat,
width: usize,
height: usize,
stride: usize,
data: Vec<u8>
) -> Self
Constructors Buffer
.
Will panic if passed data size does not match declared size.
fn empty() -> Self
Constructs empty Buffer
.
fn assign_from(&mut self, other: &Buffer)
Copies data from other
buffer to self
.
fn is_empty(&self) -> bool
Checks if buffer contains drawable data.
unsafe fn as_memory(&mut self) -> Memory
Converts Buffer
to memory.
Applications share memory with server. It is their responsibility to inform server which
buffer should be used and avoid drawing to it. The same way inner parts of compositor may
want to instruct render to draw surfaces for them and for simplicity they do this in the
same (relatively unsafe) way as clients. This method converts Buffer
to Memory
so it
can be used just as mapped memory obtained from client. It is programmes responsibility to
ensure Buffer
exists until Memory
exist and not to draw on it while it may be used for
rendering.
Trait Implementations
impl Clone for Buffer
[src]
fn clone(&self) -> Buffer
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Buffer
[src]
impl Image for Buffer
[src]
fn get_size(&self) -> Size
Get width and height of the image.
fn get_width(&self) -> usize
Return width of the image.
fn get_height(&self) -> usize
Returns height of the image.
impl Pixmap for Buffer
[src]
fn get_format(&self) -> PixelFormat
Returns pixel format of the pixmap.
fn get_stride(&self) -> usize
Return stride (width in bytes or one row) of the pixmap.
fn as_slice(&self) -> &[u8]
Returns data as slice.
fn as_mut_slice(&mut self) -> &mut [u8]
Returns data as mutable slice.
unsafe fn as_ptr(&self) -> *const u8
Returns data as pointer to u8
.