/**************************** Inputs ****************************/ #if false define IREM_INPUT_JOY_LOW(PL, STATE, WAY, B01, B02, B04, B08) \ PORT_BIT(0x0001, STATE, IPT_JOYSTICK_ ##B01) WAY PORT_PLAYER(PL) \
define IREM_INPUT_JOY_HIGH(PL, STATE, WAY, B100, B200, B400, B800) \ PORT_BIT(0x0100, STATE, IPT_JOYSTICK_ ##B100) WAY PORT_PLAYER(PL) \
/// <summary> /// Поиск точек контура на изображении /// </summary> /// <param name="image">Входящее изображение</param> /// <param name="firstPix">Первая точка пересечения контура</param> /// <param name="сontourPointsImage">Список точек контура</param> /// <returns>Список точек контура</returns> private void ScaningImage(Bitmap image, Point firstPix, List <Point> сontourPointsImage) { int x = firstPix.X, y = firstPix.Y - 1; WAY DirectWay = WAY.North; int iteration = 0; bool work = true; while (work) { switch (DirectWay) { case WAY.North: { if (image.GetPixel(x, y).GetBrightness() < 1) //black ///left { if (!сontourPointsImage.Contains(new Point(x, y))) { сontourPointsImage.Add(new Point(x, y)); } x--; DirectWay = WAY.West; } else //white ///right { x++; DirectWay = WAY.East; } } break; case WAY.East: { if (image.GetPixel(x, y).GetBrightness() < 1) //black ///left { if (!сontourPointsImage.Contains(new Point(x, y))) { сontourPointsImage.Add(new Point(x, y)); } y--; DirectWay = WAY.North; } else //white ///right { y++; DirectWay = WAY.South; } } break; case WAY.South: { if (image.GetPixel(x, y).GetBrightness() < 1) //black ///left { if (!сontourPointsImage.Contains(new Point(x, y))) { сontourPointsImage.Add(new Point(x, y)); } x++; DirectWay = WAY.East; } else //white ///right { x--; DirectWay = WAY.West; } } break; case WAY.West: { if (image.GetPixel(x, y).GetBrightness() < 1) //black ///left { if (!сontourPointsImage.Contains(new Point(x, y))) { сontourPointsImage.Add(new Point(x, y)); } y++; DirectWay = WAY.South; } else //white ///right { y--; DirectWay = WAY.North; } } break; } iteration++; if (iteration > 9) { if (firstPix == new Point(x, y)) { work = false; } } } }