示例#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 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));
 }