Exemplo n.º 1
0
    public void SetPointByBitmap(uint[] uintArrBmp, int bmpWidth, int bmpHeight, ClickPointDto dto)
    {
        List <Point> pointList = new List <Point>();

        foreach (uint[] uintArrTarget in dto.ColorsList)
        {
            for (int i = 0; i < uintArrBmp.Length; i++)
            {
                int x = i % bmpWidth;
                int y = bmpHeight - i / bmpWidth;

                // 先頭1pixelが検索対象の色と一致している、かつ、
                // 既にマッチ済の座標の近辺ではない、かつ、
                // すべての検索対象カラーがマッチした場合、その座標を保存
                if (uintArrBmp[i] == uintArrTarget[0] &&
                    IsNotContainsPoints(pointList, x, y, 180, 100) &&
                    IsMatchAllColor(uintArrBmp, bmpWidth, i, uintArrTarget, dto.Width)
                    )
                {
                    pointList.Add(new Point(x, y));
                }
            }
        }
        dto.Points = pointList.ToArray();
    }
Exemplo n.º 2
0
 /// <summary>
 /// 第一引数のbitmapに、第2引数のDTOの色配列が存在する場合、その座標を設定します.
 /// </summary>
 /// <param name="bmp"></param>
 /// <param name="dtos"></param>
 public void SetPointByBitmap(Bitmap bmp, ClickPointDto[] dtos)
 {
     uint[] uintArrBmp = ConvertBitmapToUintArray(bmp);
     for (int i = 0; i < dtos.Length; i++)
     {
         ClickPointDto dto = dtos[i];
         SetPointByBitmap(uintArrBmp, bmp.Width, bmp.Height, dto);
     }
 }