/// <summary> /// Check whether a image is match at specific location on the screen capture /// </summary> /// <param name="target">The image</param> /// <param name="p">The location on the screen capture</param> /// <returns></returns> public static bool IsMatch(Bitmap target, Point p) { Bitmap src = CaptureScreen(); bool answer = MyBitmap.IsMatch(src, target, p); src.Dispose(); return(answer); }
/// <summary> /// find the location of specific image on the screen /// </summary> /// <param name="target">the image to find</param> /// <returns>the location of specific image on the screen, failedPoint would be returned if such point didn't exist</returns> public static Point FindImage(Bitmap target) { Bitmap src = CaptureScreen(); Point answer = MyBitmap.FindImage(src, target); src.Dispose(); return(answer); }
/// <summary> /// find the location of target bitmapdata on the source bitmapdata /// </summary> /// <param name="sd">the source bitmapdata</param> /// <param name="td">the target bitmapdata</param> /// <returns>the location of target bitmapdata on the source bitmapdata, if the point didn't exist, failedPoint would be returned</returns> public static Point FindImage(BitmapData sd, BitmapData td) { for (int i = 0; i + td.Height <= sd.Height; i++) { for (int j = 0; j + td.Width <= sd.Width; j++) { if (MyBitmap.IsMatch(sd, td, new Point(j, i))) { return(new Point(j, i)); } } } return(failedPoint); }