Exemplo n.º 1
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));
     }
 }
Exemplo n.º 2
0
        private void ResizeRecalc()
        {
            lock (this)
            {
                if (mResized != null)
                {
                    mResized.Dispose();
                }

                mResized = ImageTransform.ResizeImage(mOriginal, CalculateResizeToFit(mOriginal.Size, mBoxSize), false, Interpolation);
            }
        }
Exemplo n.º 3
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
                 {
                     return(ImageTransform.Threshold(whiten, Threshold / 100.0F, UseThreshold));
                 }
             }
         }
     }
 }
Exemplo n.º 4
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));
 }