Пример #1
0
 private Bitmap ProduceBitmap2(Image img, ref Size size)
 {
     using (Bitmap resized = ImageTransform.ResizeImage(img, size, false, Interpolation))
     {
         using (Bitmap grayscale = ImageTransform.GrayScale(resized, Red / 100.0F, Green / 100.0F, Blue / 100.0F, -((100 - Brightness) / 100.0F), (Contrast / 100.0F), IsGrayScale ? ImageTransform.Formula.SimpleAverage : Formula))
         {
             using (Bitmap whiten = ImageTransform.Whitenize(grayscale, mWhitePoint, false))
             {
                 if (SelectedTool == Tool.Dithering)
                 {
                     return(ImageTransform.DitherImage(whiten, mDithering));
                 }
                 else if (SelectedTool == Tool.Centerline)
                 {
                     //apply variable threshold (if needed) + 50% threshold (always)
                     return(ImageTransform.Threshold(ImageTransform.Threshold(whiten, Threshold / 100.0F, UseThreshold), 50.0F / 100.0F, true));
                 }
                 else
                 {
                     return(ImageTransform.Threshold(whiten, Threshold / 100.0F, UseThreshold));
                 }
             }
         }
     }
 }
Пример #2
0
 private Bitmap ProduceBitmap(Image img, Size size)
 {
     if (SelectedTool == Tool.Vectorize && UseDownSampling && DownSampling > 1)             //if downsampling
     {
         using (Image downsampled = ImageTransform.ResizeImage(img, new Size((int)(size.Width * 1 / DownSampling), (int)(size.Height * 1 / DownSampling)), false, InterpolationMode.HighQualityBicubic))
             return(ProduceBitmap2(downsampled, ref size));
     }
     else
     {
         return(ProduceBitmap2(img, ref size));
     }
 }
Пример #3
0
        private void ResizeRecalc()
        {
            lock (this)
            {
                if (mResized != null)
                {
                    mResized.Dispose();
                }

                mResized = ImageTransform.ResizeImage(mOriginal, CalculateResizeToFit(mOriginal.Size, mBoxSize), false, Interpolation);
            }
        }
Пример #4
0
 private Bitmap ProduceBitmap2(Image img, ref Size size)
 {
     using (Bitmap resized = ImageTransform.ResizeImage(img, size, false, Interpolation))
     {
         using (Bitmap grayscale = ImageTransform.GrayScale(resized, Red / 100.0F, Green / 100.0F, Blue / 100.0F, -((100 - Brightness) / 100.0F), (Contrast / 100.0F), IsGrayScale ? ImageTransform.Formula.SimpleAverage : Formula))
         {
             if (SelectedTool == Tool.Dithering)
             {
                 return(ImageTransform.DitherImage(grayscale));
             }
             else
             {
                 return(ImageTransform.Threshold(grayscale, Threshold / 100.0F, UseThreshold));
             }
         }
     }
 }
Пример #5
0
 public void Invert()
 {
     mOriginal = ImageTransform.InvertingImage(mOriginal);
     ResizeRecalc();
     Refresh();
 }
Пример #6
0
 private Bitmap ProduceWhitepointDemo(Image img, Size size)
 {
     using (Bitmap resized = ImageTransform.ResizeImage(mResized, mResized.Size, false, Interpolation))
         using (Bitmap grayscale = ImageTransform.GrayScale(resized, Red / 100.0F, Green / 100.0F, Blue / 100.0F, -((100 - Brightness) / 100.0F), (Contrast / 100.0F), IsGrayScale ? ImageTransform.Formula.SimpleAverage : Formula))
             return(ImageTransform.Whitenize(grayscale, mWhitePoint, true));
 }