Ejemplo n.º 1
0
 /// <summary>
 /// Writes the image pixel data to the stream.
 /// </summary>
 /// <typeparam name="TColor">The pixel format.</typeparam>
 /// <param name="image">The <see cref="QuantizedImage{TColor}"/> containing indexed pixels.</param>
 /// <param name="writer">The stream to write to.</param>
 private void WriteImageData <TColor>(QuantizedImage <TColor> image, EndianBinaryWriter writer)
     where TColor : struct, IPackedPixel, IEquatable <TColor>
 {
     using (LzwEncoder encoder = new LzwEncoder(image.Pixels, (byte)this.bitDepth))
     {
         encoder.Encode(writer.BaseStream);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Writes the image pixel data to the stream.
 /// </summary>
 /// <typeparam name="TPixel">The pixel format.</typeparam>
 /// <param name="image">The <see cref="QuantizedImage{TPixel}"/> containing indexed pixels.</param>
 /// <param name="writer">The stream to write to.</param>
 private void WriteImageData <TPixel>(QuantizedImage <TPixel> image, EndianBinaryWriter writer)
     where TPixel : struct, IPixel <TPixel>
 {
     using (LzwEncoder encoder = new LzwEncoder(image.Pixels, (byte)this.bitDepth))
     {
         encoder.Encode(writer.BaseStream);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Writes the image pixel data to the stream.
        /// </summary>
        /// <typeparam name="TColor">The pixel format.</typeparam>
        /// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
        /// <param name="image">The <see cref="QuantizedImage{TColor, TPacked}"/> containing indexed pixels.</param>
        /// <param name="writer">The stream to write to.</param>
        private void WriteImageData <TColor, TPacked>(QuantizedImage <TColor, TPacked> image, EndianBinaryWriter writer)
            where TColor : struct, IPackedPixel <TPacked>
            where TPacked : struct
        {
            byte[] indexedPixels = image.Pixels;

            LzwEncoder encoder = new LzwEncoder(indexedPixels, (byte)this.bitDepth);

            encoder.Encode(writer.BaseStream);
        }