ARKBreedingStats.ArkOCR.StoreImageInAlphabet C# (CSharp) Метод

StoreImageInAlphabet() приватный Метод

private StoreImageInAlphabet ( int resolution, char letter, Bitmap source, int letterStart, int letterEnd ) : void
resolution int
letter char
source System.Drawing.Bitmap
letterStart int
letterEnd int
Результат void
        private void StoreImageInAlphabet(int resolution, char letter, Bitmap source, int letterStart, int letterEnd)
        {
            Rectangle cropRect = letterRect(source, letterStart, letterEnd); //new Rectangle(x, y, width, height);
            Bitmap target = new Bitmap(cropRect.Width, cropRect.Height);

            using (Graphics g = Graphics.FromImage(target))
            {
                g.DrawImage(source, new Rectangle(0, 0, target.Width, target.Height),
                                 cropRect,
                                 GraphicsUnit.Pixel);
            }

            alphabet[resolution, letter] = target;

            int pcount = 0;
            for (int i = 0; i < target.Width; i++)
                for (int j = 0; j < target.Height; j++)
                    if (target.GetPixel(i, j).R != 0)
                        pcount++;

            if (!hashMap.ContainsKey(pcount))
                hashMap[pcount] = new List<byte>();

            hashMap[pcount].Add((byte)letter);
        }