12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Emgu.CV;
- using Emgu.CV.Structure;
- using bbiwarg.Utility;
- namespace bbiwarg.Images
- {
- public enum TouchImageState
- {
- none = 0,
- touchArea = 1,
- touchAreaMatched = 2,
- touchAreaStatusBar = 3,
- touchDetected = 4,
- touchTracked = 5
- }
- class TouchImage
- {
- private Image<Gray, byte> image;
- public TouchImage(int width, int height)
- {
- image = new Image<Gray, byte>(width, height);
- }
- public void setStateAt(Point point, TouchImageState state)
- {
- setStateAt(point.X, point.Y, state);
- }
- public void setStateAt(int x, int y, TouchImageState state)
- {
- image.Data[y, x, 0] = (byte)state;
- int size = 5;
- if (state == TouchImageState.touchTracked || state == TouchImageState.touchDetected)
- {
- image.Draw(new CircleF(new System.Drawing.PointF(x, y), size), new Gray((byte)state), 0);
- }
- }
- public TouchImageState getStateAt(int x, int y)
- {
- return (TouchImageState)image.Data[y, x, 0];
- }
- }
- }
|