/// <summary> /// 区域快速找所有字。模糊找字。 /// </summary> public List<Point> FindAllStrFast(int x1, int y1, int x2, int y2, string text, string color_format, double sim = 0.9) { string result = win.Dmsoft.FindStrFastEx(x1, y1, x2, y2, text, color_format, sim); int count = win.Dmsoft.GetResultCount(result); List<Point> points = new List<Point>(); COMParam<int> x = new COMParam<int>(0); COMParam<int> y = new COMParam<int>(0); for(int i = 0; i < count; i++) { win.Dmsoft.GetResultPos(result, i, out x.Data, out y.Data); points.Add(new Point(x.Value, y.Value)); } return points; }
/// <summary> /// 查找指定区域内的图片,位图必须是24位色格式,支持透明色,当图像上下左右4个顶点的颜色一样时,则这个颜色将作为透明色处理. /// </summary> /// <param name="x1"></param> /// <param name="y1"></param> /// <param name="x2"></param> /// <param name="y2"></param> /// <param name="pic_name"></param> /// <param name="delta_color"></param> /// <param name="sim"></param> /// <param name="dir"></param> /// <returns></returns> public Point FindPic(int x1,int y1,int x2,int y2,string pic_name,string delta_color="000000",double sim=0.9,int dir=0) { COMParam<int> x = new COMParam<int>(0); COMParam<int> y = new COMParam<int>(0); win.Dmsoft.FindPic(x1, y1, x2, y2, pic_name, delta_color, sim, dir, out x.Data, out y.Data); return new Point(x.Value, y.Value); }
/// <summary> /// 多点查找颜色坐标,从左上角第一个点为远点查找其他偏移点的颜色,返回匹配率最高的坐标 /// </summary> /// <param name="x1"></param> /// <param name="y1"></param> /// <param name="x2"></param> /// <param name="y2"></param> /// <param name="first_color"></param> /// <param name="offset_color"></param> /// <param name="sim"></param> /// <param name="dir"></param> /// <returns></returns> public Point FindMultiColor(int x1,int y1,int x2,int y2,string first_color,string offset_color,double sim=0.9,int dir=0) { COMParam<int> x = new COMParam<int>(0); COMParam<int> y = new COMParam<int>(0); win.Dmsoft.FindMultiColor(x1, y1, x2, y2, first_color, offset_color, sim, dir, out x.Data, out y.Data); return new Point(x.Value, y.Value); }
/// <summary> /// 查找一个像素的颜色 查找指定区域内符合颜色的像素点返回第一个坐标 /// </summary> /// <param name="x1"></param> /// <param name="y1"></param> /// <param name="x2"></param> /// <param name="y2"></param> /// <param name="color"></param> /// <param name="sim"></param> /// <param name="dir"></param> /// <returns></returns> public Point FindColor(int x1, int y1, int x2, int y2, string color, double sim = 0.9, int dir = 0) { COMParam<int> intX = new COMParam<int>(0); COMParam<int> intY = new COMParam<int>(1); win.Dmsoft.FindColor(x1, y1, x2, y2, color, sim, dir, out intX.Data, out intY.Data); return new Point(intX.Value, intX.Value); }
/// <summary> /// 窗口坐标转客户区坐标 /// </summary> /// <param name="x">x坐标</param> /// <param name="y">y坐标</param> public Point ScreenToClient(int x, int y) { COMParam<int> intX = new COMParam<int>(x); COMParam<int> intY = new COMParam<int>(y); dm.ScreenToClient(Hwnd, ref intX.Data, ref intY.Data); return new Point(intX.Value, intY.Value); }
/// <summary> /// 区域用系统字库查找。系统字库找字一般不适用于游戏,成功率也低。 /// </summary> /// <param name="x1"></param> /// <param name="y1"></param> /// <param name="x2"></param> /// <param name="y2"></param> /// <param name="text"></param> /// <param name="color_format"></param> /// <param name="sim"></param> /// <param name="fontInfo"></param> /// <returns></returns> public Point FindStrWithFont(int x1,int y1,int x2,int y2,string text,string color_format,double sim,FontInfo fontInfo) { COMParam<int> x = new COMParam<int>(0); COMParam<int> y = new COMParam<int>(0); win.Dmsoft.FindStrWithFont(x1, y1, x2, y2, text, color_format, sim, fontInfo.Name, fontInfo.Size, fontInfo.Flag,out x.Data,out y.Data); return new Point(x.Value, y.Value); }
/// <summary> /// 快速模糊查找。模糊找字。 /// </summary> /// <param name="x1"></param> /// <param name="y1"></param> /// <param name="x2"></param> /// <param name="y2"></param> /// <param name="text"></param> /// <param name="color_format"></param> /// <param name="sim"></param> /// <returns></returns> public Point FindStrFast(int x1, int y1, int x2, int y2, string text, string color_format, double sim = 0.9) { COMParam<int> x = new COMParam<int>(0); COMParam<int> y = new COMParam<int>(0); win.Dmsoft.FindStrFast(x1, y1, x2, y2, text, color_format, sim, out x.Data, out y.Data); return new Point(x.Value, y.Value); }