Example #1
0
            internal DitheringSessionRaster(IQuantizingSession quantizer, ErrorDiffusionDitherer ditherer, IBitmapData source)
            {
                this.quantizer = quantizer;
                this.ditherer  = ditherer;
                ImageWidth     = source.Width;
                imageHeight    = source.Height;
                byBrightness   = ditherer.byBrightness ?? quantizer.Palette?.IsGrayscale ?? false;

                // Initializing a circular buffer for the diffused errors.
                // This helps to minimize used memory because it needs only a few lines to be stored.
                // Another solution could be to store resulting colors instead of just the errors but then the color
                // entries would be clipped not just in the end but in every iteration, and small errors would be lost
                // that could stack up otherwise.
                // See also the ErrorDiffusionDitherer constructor for more comments on why using floats.
                errorsBuffer = new CircularList <(float, float, float)[]>(ditherer.matrixHeight);
Example #2
0
 internal DitheringSessionSerpentine(IQuantizingSession quantizer, ErrorDiffusionDitherer ditherer, IReadableBitmapData source)
     : base(quantizer, ditherer, source)
 {
     this.source         = source;
     preprocessedResults = new Color32[ImageWidth];
 }