Пример #1
0
 private void ChangeInputImage()
 {
     int inputSize = (int)nInputSize.Value;
     ComputeInputScaleSquare();
     inputImage = new ArrayImage(inputSize);
     inputGraphics.Clear(Color.Black);
     RefreshInputView();
     UpdateScale();
 }
Пример #2
0
 private void LoadInputView(Bitmap bitmap)
 {
     int inSize = bitmap.Width;
     nInputSize.Value = inSize;
     ComputeInputScaleSquare();
     inputImage = new ArrayImage(inSize);
     UnsafeBitmap bmp = new UnsafeBitmap(bitmap);
     inputGraphics.Clear(Color.Black);
     bmp.LockBitmap();
     for (int y = 0; y < inSize; ++y)
     {
         for (int x = 0; x < inSize; ++x)
         {
             if (bmp.GetPixel(x, y).red < 50)
             {
                 inputImage[x, y] = PixelMonoColorEnum.Black;
                 inputGraphics.FillRectangle(Brushes.Black, (float)x * inputScaleSquare, (float)y * inputScaleSquare, inputScaleSquare, inputScaleSquare);
             }
             else
             {
                 inputImage[x, y] = PixelMonoColorEnum.White;
                 inputGraphics.FillRectangle(Brushes.White, (float)x * inputScaleSquare, (float)y * inputScaleSquare, inputScaleSquare, inputScaleSquare);
             }
         }
     }
     bmp.UnlockBitmap();
 }