pub struct Image<Storage: ?Sized> { /* private fields */ }Implementations§
Source§impl<Storage: AsRef<[u8]> + ?Sized> Image<Storage>
impl<Storage: AsRef<[u8]> + ?Sized> Image<Storage>
Sourcepub fn put_subimage_request<R>(
&self,
drawable: impl Into<Drawable>,
gc: impl Into<Gcontext>,
src_x: usize,
src_y: usize,
width: usize,
height: usize,
dst_x: i16,
dst_y: i16,
discard_reply: bool,
raw_request_handler: impl FnOnce(RawRequest<'_, '_>) -> R,
) -> R
pub fn put_subimage_request<R>( &self, drawable: impl Into<Drawable>, gc: impl Into<Gcontext>, src_x: usize, src_y: usize, width: usize, height: usize, dst_x: i16, dst_y: i16, discard_reply: bool, raw_request_handler: impl FnOnce(RawRequest<'_, '_>) -> R, ) -> R
Get a PutImageRequest that could be used to send a part of this
image to the display.
Source§impl<Storage: AsRef<[u8]>> Image<Storage>
impl<Storage: AsRef<[u8]>> Image<Storage>
Sourcepub fn new(
storage: Storage,
width: u16,
height: u16,
format: Format,
byte_order: ImageOrder,
scanline_pad: u8,
) -> Self
pub fn new( storage: Storage, width: u16, height: u16, format: Format, byte_order: ImageOrder, scanline_pad: u8, ) -> Self
Create a new Image from a Storage and its individual parameters.
Sourcepub fn with_display(
storage: Storage,
width: u16,
height: u16,
image_format: ImageFormat,
depth: u8,
setup: &Setup,
) -> Result<Self>
pub fn with_display( storage: Storage, width: u16, height: u16, image_format: ImageFormat, depth: u8, setup: &Setup, ) -> Result<Self>
Create a new Image, but use a specific Display to set certain important values.
Sourcepub fn into_storage(self) -> Storage
pub fn into_storage(self) -> Storage
Convert the image back into its Storage.
Sourcepub fn map_storage<R, F>(self, f: F) -> Image<R>where
F: FnOnce(Storage) -> R,
pub fn map_storage<R, F>(self, f: F) -> Image<R>where
F: FnOnce(Storage) -> R,
Map the storage for this image.
This function assumes that nothing else about the image is changed.
Source§impl<Storage: AsRef<[u8]> + ?Sized> Image<Storage>
impl<Storage: AsRef<[u8]> + ?Sized> Image<Storage>
pub fn borrow(&self) -> Image<&[u8]>
Sourcepub fn pixel(&self, x: usize, y: usize) -> u32
pub fn pixel(&self, x: usize, y: usize) -> u32
Get the value of the pixel at the given coordinates.
Sourcepub fn put_image_request(
&self,
drawable: impl Into<Drawable>,
gc: impl Into<Gcontext>,
dst_x: i16,
dst_y: i16,
) -> PutImageRequest<'_>
pub fn put_image_request( &self, drawable: impl Into<Drawable>, gc: impl Into<Gcontext>, dst_x: i16, dst_y: i16, ) -> PutImageRequest<'_>
Create a PutImageRequest for this image.
Sourcepub fn crop(
&self,
x: usize,
y: usize,
width: usize,
height: usize,
) -> Image<Vec<u8>>
pub fn crop( &self, x: usize, y: usize, width: usize, height: usize, ) -> Image<Vec<u8>>
Crop this image down to the given dimensions.
§Performance
This function creates a new image and then manually copies all of the
pixels from this image to that one, using the pixel and set_pixel
functions. This usually leads to poor performance.
Source§impl Image<Vec<u8>>
impl Image<Vec<u8>>
Sourcepub fn from_get_image_reply(
reply: GetImageReply,
width: u16,
height: u16,
format: ImageFormat,
setup: &Setup,
) -> Result<Self>
pub fn from_get_image_reply( reply: GetImageReply, width: u16, height: u16, format: ImageFormat, setup: &Setup, ) -> Result<Self>
Create a new image based on a GetImageReply.
Trait Implementations§
Source§impl<Storage: ?Sized> AsMut<Storage> for Image<Storage>
impl<Storage: ?Sized> AsMut<Storage> for Image<Storage>
Source§fn as_mut(&mut self) -> &mut Storage
fn as_mut(&mut self) -> &mut Storage
Converts this type into a mutable reference of the (usually inferred) input type.
Source§impl<Storage: Ord + ?Sized> Ord for Image<Storage>
impl<Storage: Ord + ?Sized> Ord for Image<Storage>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<Storage: PartialOrd + ?Sized> PartialOrd for Image<Storage>
impl<Storage: PartialOrd + ?Sized> PartialOrd for Image<Storage>
impl<Storage: Copy + ?Sized> Copy for Image<Storage>
impl<Storage: Eq + ?Sized> Eq for Image<Storage>
impl<Storage: ?Sized> StructuralPartialEq for Image<Storage>
Auto Trait Implementations§
impl<Storage> Freeze for Image<Storage>
impl<Storage> RefUnwindSafe for Image<Storage>where
Storage: RefUnwindSafe + ?Sized,
impl<Storage> Send for Image<Storage>
impl<Storage> Sync for Image<Storage>
impl<Storage> Unpin for Image<Storage>
impl<Storage> UnwindSafe for Image<Storage>where
Storage: UnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more