123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using System;
- using System.Collections.Generic;
- 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;
- private List<Vector2D> oldTouches;
- public TouchImage(int width, int height)
- {
- image = new Image<Gray, byte>(width, height);
- oldTouches = new List<Vector2D>();
- }
- public void setTouchAt(int x, int y, TouchImageState tis)
- {
- image.Data[y, x, 0] = (byte)tis;
- int size = 5;
- if (tis == TouchImageState.touchTracked || tis == TouchImageState.touchDetected)
- {
- image.Draw(new CircleF(new System.Drawing.PointF(x, y), 5), new Gray((byte) tis), 0);
- }
- }
- public TouchImageState getStateAt(int x, int y)
- {
- return (TouchImageState)image.Data[y, x, 0];
- }
- }
- }
|