UpdatePixelIndexes() 공개 메소드

Updates the pixel indexes.
public UpdatePixelIndexes ( IEnumerable lineIndexes ) : void
lineIndexes IEnumerable /// The enumerable byte array representing each row of pixels. ///
리턴 void
예제 #1
0
 /// <summary>
 /// Quantizes the image contained within the <see cref="ImageBuffer"/> returning the result.
 /// </summary>
 /// <param name="imageBuffer">
 /// The <see cref="ImageBuffer"/> for storing and manipulating pixel information..
 /// </param>
 /// <param name="colorCount">
 /// The maximum number of colors apply to the image.
 /// </param>
 /// <param name="lookups">
 /// The array of <see cref="Color32"/> containing indexed versions of the images colors.
 /// </param>
 /// <param name="alphaThreshold">
 /// All colors with an alpha value less than this will be considered fully transparent.
 /// </param>
 /// <returns>
 /// The quantized <see cref="Bitmap"/>.
 /// </returns>
 internal override Bitmap GetQuantizedImage(ImageBuffer imageBuffer, int colorCount, Color32[] lookups, int alphaThreshold)
 {
     Bitmap result = new Bitmap(imageBuffer.Image.Width, imageBuffer.Image.Height, PixelFormat.Format8bppIndexed);
     result.SetResolution(imageBuffer.Image.HorizontalResolution, imageBuffer.Image.VerticalResolution);
     ImageBuffer resultBuffer = new ImageBuffer(result);
     PaletteColorHistory[] paletteHistogram = new PaletteColorHistory[colorCount + 1];
     resultBuffer.UpdatePixelIndexes(IndexedPixels(imageBuffer, lookups, alphaThreshold, paletteHistogram));
     result.Palette = BuildPalette(result.Palette, paletteHistogram);
     return result;
 }
예제 #2
0
        /// <summary>
        /// Quantizes the image contained within the <see cref="ImageBuffer"/> returning the result.
        /// </summary>
        /// <param name="imageBuffer">
        /// The <see cref="ImageBuffer"/> for storing and manipulating pixel information..
        /// </param>
        /// <param name="colorCount">
        /// The maximum number of colors apply to the image.
        /// </param>
        /// <param name="lookups">
        /// The array of <see cref="Color32"/> containing indexed versions of the images colors.
        /// </param>
        /// <param name="alphaThreshold">
        /// All colors with an alpha value less than this will be considered fully transparent.
        /// </param>
        /// <returns>
        /// The quantized <see cref="Bitmap"/>.
        /// </returns>
        internal override Bitmap GetQuantizedImage(ImageBuffer imageBuffer, int colorCount, Color32[] lookups, int alphaThreshold)
        {
            Bitmap result = new Bitmap(imageBuffer.Image.Width, imageBuffer.Image.Height, PixelFormat.Format8bppIndexed);

            result.SetResolution(imageBuffer.Image.HorizontalResolution, imageBuffer.Image.VerticalResolution);
            ImageBuffer resultBuffer = new ImageBuffer(result);

            PaletteColorHistory[] paletteHistogram = new PaletteColorHistory[colorCount + 1];
            resultBuffer.UpdatePixelIndexes(IndexedPixels(imageBuffer, lookups, alphaThreshold, paletteHistogram));
            result.Palette = BuildPalette(result.Palette, paletteHistogram);
            return(result);
        }