19 protected Bitmap bitmap;
20 protected ColorS tolerance =
new ColorS(25, 25, 25);
21 protected ColorS fillColor = ColorS.FromColor(Color.Black);
22 protected bool fillDiagonally =
false;
23 protected bool slow =
false;
26 protected int bitmapWidth = 0;
27 protected int bitmapHeight = 0;
28 protected int bitmapStride = 0;
29 protected int bitmapPixelFormatSize = 0;
30 protected byte[] bitmapBits =
null;
31 protected PixelFormat pixelFormat;
34 internal Stopwatch watch =
new Stopwatch();
38 protected bool[] pixelsChecked;
39 protected ColorS byteFillColor;
40 protected ColorS startColor;
50 if (configSource !=
null)
52 this.Bitmap = configSource.Bitmap;
53 this.FillColor = configSource.FillColor;
54 this.FillDiagonally = configSource.FillDiagonally; ;
55 this.Tolerance = configSource.Tolerance;
59 public ColorS FillColor
61 get {
return fillColor; }
62 set { fillColor = value; }
65 public bool FillDiagonally
67 get {
return fillDiagonally; }
68 set { fillDiagonally = value; }
71 public ColorS Tolerance
73 get {
return tolerance; }
74 set { tolerance = value; }
79 get {
return bitmap; }
86 public abstract void FloodFill(Point pt);
87 protected void PrepareForFloodFill(Point pt)
89 startColor = bitmap.GetPixel((
int)pt.X, (
int)pt.Y);
90 byteFillColor =
new ColorS(fillColor.B, fillColor.G, fillColor.R);
91 bitmapStride = bitmap.Stride;
92 bitmapPixelFormatSize = bitmap.PixelFormatSize;
93 pixelFormat = bitmap.PixelFormat;
94 bitmapBits = bitmap.Bytes;
95 bitmapWidth = bitmap.SizeX;
96 bitmapHeight = bitmap.SizeY;
97 pixelsChecked =
new bool[bitmapBits.Length / bitmapPixelFormatSize];