Struct gbm::SurfaceBufferHandle
source · pub struct SurfaceBufferHandle<T: 'static>(_, _);
Expand description
Handle to a front buffer of a surface
Methods from Deref<Target = BufferObject<T>>§
sourcepub fn width(&self) -> Result<u32, DeviceDestroyedError>
pub fn width(&self) -> Result<u32, DeviceDestroyedError>
Get the width of the buffer object
sourcepub fn height(&self) -> Result<u32, DeviceDestroyedError>
pub fn height(&self) -> Result<u32, DeviceDestroyedError>
Get the height of the buffer object
sourcepub fn stride(&self) -> Result<u32, DeviceDestroyedError>
pub fn stride(&self) -> Result<u32, DeviceDestroyedError>
Get the stride of the buffer object
sourcepub fn format(&self) -> Result<Format, DeviceDestroyedError>
pub fn format(&self) -> Result<Format, DeviceDestroyedError>
Get the format of the buffer object
sourcepub fn handle(&self) -> Result<BufferObjectHandle, DeviceDestroyedError>
pub fn handle(&self) -> Result<BufferObjectHandle, DeviceDestroyedError>
Get the handle of the buffer object
This is stored in the platform generic union BufferObjectHandle
type. However
the format of this handle is platform specific.
sourcepub fn map<'a, D, F, S>(
&'a self,
device: &Device<D>,
x: u32,
y: u32,
width: u32,
height: u32,
f: F
) -> Result<IoResult<S>, WrongDeviceError>where
D: AsRawFd + 'static,
F: FnOnce(&MappedBufferObject<'a, T>) -> S,
pub fn map<'a, D, F, S>(
&'a self,
device: &Device<D>,
x: u32,
y: u32,
width: u32,
height: u32,
f: F
) -> Result<IoResult<S>, WrongDeviceError>where
D: AsRawFd + 'static,
F: FnOnce(&MappedBufferObject<'a, T>) -> S,
Map a region of a gbm buffer object for cpu access
This function maps a region of a gbm bo for cpu read access.
sourcepub fn map_mut<'a, D, F, S>(
&'a mut self,
device: &Device<D>,
x: u32,
y: u32,
width: u32,
height: u32,
f: F
) -> Result<IoResult<S>, WrongDeviceError>where
D: AsRawFd + 'static,
F: FnOnce(&mut MappedBufferObject<'a, T>) -> S,
pub fn map_mut<'a, D, F, S>(
&'a mut self,
device: &Device<D>,
x: u32,
y: u32,
width: u32,
height: u32,
f: F
) -> Result<IoResult<S>, WrongDeviceError>where
D: AsRawFd + 'static,
F: FnOnce(&mut MappedBufferObject<'a, T>) -> S,
Map a region of a gbm buffer object for cpu access
This function maps a region of a gbm bo for cpu read/write access.
sourcepub fn write(
&mut self,
buffer: &[u8]
) -> Result<IoResult<()>, DeviceDestroyedError>
pub fn write(
&mut self,
buffer: &[u8]
) -> Result<IoResult<()>, DeviceDestroyedError>
Write data into the buffer object
If the buffer object was created with the BufferObjectFlags::Write
flag,
this function can be used to write data into the buffer object. The
data is copied directly into the object and it’s the responsibility
of the caller to make sure the data represents valid pixel data,
according to the width, height, stride and format of the buffer object.
sourcepub fn set_userdata(
&mut self,
userdata: T
) -> Result<Option<T>, DeviceDestroyedError>
pub fn set_userdata(
&mut self,
userdata: T
) -> Result<Option<T>, DeviceDestroyedError>
Sets the userdata of the buffer object.
If previously userdata was set, it is returned.
sourcepub fn clear_userdata(&mut self) -> Result<(), DeviceDestroyedError>
pub fn clear_userdata(&mut self) -> Result<(), DeviceDestroyedError>
Clears the set userdata of the buffer object.
sourcepub fn userdata(&self) -> Result<Option<&T>, DeviceDestroyedError>
pub fn userdata(&self) -> Result<Option<&T>, DeviceDestroyedError>
Returns a reference to set userdata, if any.
sourcepub fn userdata_mut(&mut self) -> Result<Option<&mut T>, DeviceDestroyedError>
pub fn userdata_mut(&mut self) -> Result<Option<&mut T>, DeviceDestroyedError>
Returns a mutable reference to set userdata, if any.
sourcepub fn take_userdata(&mut self) -> Result<Option<T>, DeviceDestroyedError>
pub fn take_userdata(&mut self) -> Result<Option<T>, DeviceDestroyedError>
Takes ownership of previously set userdata, if any.
This removes the userdata from the buffer object.