Struct autopilot::bitmap::Bitmap
[−]
[src]
pub struct Bitmap {
pub image: DynamicImage,
pub size: Size,
pub scale: f64,
}Fields
image: DynamicImage
size: Size
Size of the bitmap in points.
scale: f64
Methods
impl Bitmap[src]
pub fn new(image: DynamicImage, scale: Option<f64>) -> Bitmap[src]
Creates a bitmap from the given DynamicImage, and scale if given
(defaults to 1).
pub fn bounds(&self) -> Rect[src]
Returns bounds of bitmap as a rect, with an origin of zero.
pub fn copy_to_pasteboard(&self) -> ImageResult<()>[src]
Copies image to pasteboard. Currently only supported on macOS.
pub fn cropped(&mut self, rect: Rect) -> ImageResult<Bitmap>[src]
Returns new Bitmap created from a portion of another.
pub fn get_pixel(&self, point: Point) -> Rgba<u8>[src]
pub fn bitmap_eq(&self, needle: &Bitmap, tolerance: Option<f64>) -> bool[src]
Returns true if bitmap is equal to needle with the given tolerance.
pub fn find_color(
&self,
needle: Rgba<u8>,
tolerance: Option<f64>,
rect: Option<Rect>,
start_point: Option<Point>
) -> Option<Point>[src]
&self,
needle: Rgba<u8>,
tolerance: Option<f64>,
rect: Option<Rect>,
start_point: Option<Point>
) -> Option<Point>
Attempts to find color inside rect in bmp from the given
start_point. Returns coordinates if found, or None if not. If
rect is None, bmp.bounds() is used instead. If start_point is
None, the origin of rect is used.
Tolerance is defined as a float in the range from 0 to 1, where 0 is an exact match and 1 matches anything.
pub fn find_every_color(
&self,
needle: Rgba<u8>,
tolerance: Option<f64>,
rect: Option<Rect>,
start_point: Option<Point>
) -> Vec<Point>[src]
&self,
needle: Rgba<u8>,
tolerance: Option<f64>,
rect: Option<Rect>,
start_point: Option<Point>
) -> Vec<Point>
Returns list of all coordinates inside rect in bmp matching
color from the given start_point. If rect is None,
bmp.bounds() is used instead. If start_point is None, the origin
of rect is used.
pub fn count_of_color(
&self,
needle: Rgba<u8>,
tolerance: Option<f64>,
rect: Option<Rect>,
start_point: Option<Point>
) -> u64[src]
&self,
needle: Rgba<u8>,
tolerance: Option<f64>,
rect: Option<Rect>,
start_point: Option<Point>
) -> u64
Returns count of color in bitmap. Functionally equivalent to:
find_every_color(color, tolerance, rect, start_point).count()
pub fn find_bitmap(
&self,
needle: &Bitmap,
tolerance: Option<f64>,
rect: Option<Rect>,
start_point: Option<Point>
) -> Option<Point>[src]
&self,
needle: &Bitmap,
tolerance: Option<f64>,
rect: Option<Rect>,
start_point: Option<Point>
) -> Option<Point>
Attempts to find needle inside rect in bmp from the given
start_point. Returns coordinates if found, or None if not. If
rect is None, bmp.bounds() is used instead. If start_point is
None, the origin of rect is used.
Tolerance is defined as a float in the range from 0 to 1, where 0 is an exact match and 1 matches anything.
pub fn find_every_bitmap(
&self,
needle: &Bitmap,
tolerance: Option<f64>,
rect: Option<Rect>,
start_point: Option<Point>
) -> Vec<Point>[src]
&self,
needle: &Bitmap,
tolerance: Option<f64>,
rect: Option<Rect>,
start_point: Option<Point>
) -> Vec<Point>
Returns list of all coordinates inside rect in bmp matching
needle from the given start_point. If rect is None,
bmp.bounds is used instead. If start_point is None, the origin
of rect is used.
pub fn count_of_bitmap(
&self,
needle: &Bitmap,
tolerance: Option<f64>,
rect: Option<Rect>,
start_point: Option<Point>
) -> u64[src]
&self,
needle: &Bitmap,
tolerance: Option<f64>,
rect: Option<Rect>,
start_point: Option<Point>
) -> u64
Returns count of occurrences of needle in bmp. Functionally equivalent to:
find_every_bitmap(color, tolerance, rect, start_point).count()
Trait Implementations
impl Clone for Bitmap[src]
fn clone(&self) -> Bitmap[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Debug for Bitmap[src]
fn fmt(&self, f: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more
impl PartialEq for Bitmap[src]
fn eq(&self, other: &Bitmap) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
This method tests for !=.