pub struct Pixel {
pub y: u16,
pub x: u16,
}Expand description
Represents a single 2D pixel coordinate within an image.
§Overview
A Pixel stores its position using unsigned x and y coordinates,
implementing ordering (Ord, PartialOrd) such that pixels sort in
row-major (y, x) order.
Fields§
§y: u16The vertical coordinate of the pixel.
x: u16The horizontal coordinate of the pixel.
Implementations§
Source§impl Pixel
impl Pixel
Sourcepub fn color(self, image: &DynamicImage) -> Color
pub fn color(self, image: &DynamicImage) -> Color
Retrieves the color of this pixel from the provided DynamicImage.
Sourcepub fn set(self, image: &mut DynamicImage, color: Color)
pub fn set(self, image: &mut DynamicImage, color: Color)
Sets the color of this pixel in the given image.
Sourcepub fn neighbors(self, image: &DynamicImage) -> PixelSet
pub fn neighbors(self, image: &DynamicImage) -> PixelSet
Returns a PixelSet containing all valid neighboring pixels around
this pixel, considering up to 8 adjacent positions.
Trait Implementations§
Source§impl Ord for Pixel
impl Ord for Pixel
Source§impl PartialOrd for Pixel
impl PartialOrd for Pixel
impl Copy for Pixel
impl Eq for Pixel
impl StructuralPartialEq for Pixel
Auto Trait Implementations§
impl Freeze for Pixel
impl RefUnwindSafe for Pixel
impl Send for Pixel
impl Sync for Pixel
impl Unpin for Pixel
impl UnwindSafe for Pixel
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more