pub struct BufferedImageLuminanceSource { /* private fields */ }Expand description
This LuminanceSource implementation is meant for J2SE clients and our blackbox unit tests.
The image is converted to greyscale once at construction; everything else
delegates to Luma8LuminanceSource, inheriting its zero-copy cropping and
shared buffers.
@author dswitkin@google.com (Daniel Switkin) @author Sean Owen @author code@elektrowolle.de (Wolfgang Jung)
Implementations§
Source§impl BufferedImageLuminanceSource
impl BufferedImageLuminanceSource
pub fn new(image: DynamicImage) -> Self
Trait Implementations§
Source§impl Clone for BufferedImageLuminanceSource
impl Clone for BufferedImageLuminanceSource
Source§fn clone(&self) -> BufferedImageLuminanceSource
fn clone(&self) -> BufferedImageLuminanceSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BufferedImageLuminanceSource
impl Debug for BufferedImageLuminanceSource
Source§impl LuminanceSource for BufferedImageLuminanceSource
impl LuminanceSource for BufferedImageLuminanceSource
const SUPPORTS_CROP: bool = true
const SUPPORTS_ROTATION: bool = true
Source§fn get_row(&self, y: usize) -> Option<Cow<'_, [u8]>>
fn get_row(&self, y: usize) -> Option<Cow<'_, [u8]>>
Fetches one row of luminance data from the underlying platform’s bitmap. Values range from
0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have
to bitwise and with 0xff for each value. It is preferable for implementations of this method
to only fetch this row rather than the whole image, since no 2D Readers may be installed and
getMatrix() may never be called. Read more
Source§fn get_column(&self, x: usize) -> Cow<'_, [u8]>
fn get_column(&self, x: usize) -> Cow<'_, [u8]>
Get a column of the image. Borrowed only when the underlying storage
makes a column contiguous; otherwise an owned copy.
Source§fn get_matrix(&self) -> Cow<'_, [u8]>
fn get_matrix(&self) -> Cow<'_, [u8]>
Fetches luminance data for the underlying bitmap. Values should be fetched using:
{@code int luminance = array[y * width + x] & 0xff} Read more
Source§fn get_height(&self) -> usize
fn get_height(&self) -> usize
@return The height of the bitmap.
Source§fn crop(
&self,
left: usize,
top: usize,
width: usize,
height: usize,
) -> Result<Self>
fn crop( &self, left: usize, top: usize, width: usize, height: usize, ) -> Result<Self>
Returns a new object with cropped image data. Implementations may keep a reference to the
original data rather than a copy. Only callable if isCropSupported() is true. Read more
Source§fn invert(&mut self)
fn invert(&mut self)
@return a wrapper of this {@code LuminanceSource} which inverts the luminances it returns – black becomes
white and vice versa, and each value becomes (255-value).
Source§fn rotate_counter_clockwise(&self) -> Result<Self>
fn rotate_counter_clockwise(&self) -> Result<Self>
Returns a new object with rotated image data by 90 degrees counterclockwise.
Only callable if {@link #isRotateSupported()} is true. Read more
Source§fn rotate_counter_clockwise_45(&self) -> Result<Self>
fn rotate_counter_clockwise_45(&self) -> Result<Self>
Returns a new object with rotated image data by 45 degrees counterclockwise.
Only callable if {@link #isRotateSupported()} is true. Read more
fn get_luma8_point(&self, x: usize, y: usize) -> u8
Source§fn is_crop_supported(&self) -> bool
fn is_crop_supported(&self) -> bool
@return Whether this subclass supports cropping.
Source§fn is_rotate_supported(&self) -> bool
fn is_rotate_supported(&self) -> bool
@return Whether this subclass supports counter-clockwise rotation.
fn invert_block_of_bytes(&self, vec_to_invert: Vec<u8>) -> Vec<u8> ⓘ
Auto Trait Implementations§
impl Freeze for BufferedImageLuminanceSource
impl RefUnwindSafe for BufferedImageLuminanceSource
impl Send for BufferedImageLuminanceSource
impl Sync for BufferedImageLuminanceSource
impl Unpin for BufferedImageLuminanceSource
impl UnsafeUnpin for BufferedImageLuminanceSource
impl UnwindSafe for BufferedImageLuminanceSource
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.