Ejemplo n.º 1
0
        /// <summary>
        /// Encodes the image to the specified stream from the <see cref="Image{TColor}"/>.
        /// </summary>
        /// <typeparam name="TColor">The pixel format.</typeparam>
        /// <param name="image">The <see cref="Image{TColor}"/> to encode from.</param>
        /// <param name="stream">The <see cref="Stream"/> to encode the image data to.</param>
        /// <param name="options">The options for the encoder.</param>
        public void Encode <TColor>(Image <TColor> image, Stream stream, IBmpEncoderOptions options)
            where TColor : struct, IPixel <TColor>
        {
            BmpEncoderCore encoder = new BmpEncoderCore(options);

            encoder.Encode(image, stream);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BmpEncoderCore"/> class.
 /// </summary>
 /// <param name="options">The encoder options.</param>
 /// <param name="memoryAllocator">The memory manager.</param>
 public BmpEncoderCore(IBmpEncoderOptions options, MemoryAllocator memoryAllocator)
 {
     this.memoryAllocator = memoryAllocator;
     this.bitsPerPixel    = options.BitsPerPixel;
     this.writeV4Header   = options.SupportTransparency;
     this.quantizer       = options.Quantizer ?? KnownQuantizers.Octree;
 }
Ejemplo n.º 3
0
        /// <inheritdoc/>
        public void Encode <TColor>(Image <TColor> image, Stream stream, IEncoderOptions options)
            where TColor : struct, IPixel <TColor>
        {
            IBmpEncoderOptions bmpOptions = BmpEncoderOptions.Create(options);

            this.Encode(image, stream, bmpOptions);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BmpEncoderCore"/> class.
 /// </summary>
 /// <param name="options">The encoder options.</param>
 /// <param name="memoryAllocator">The memory manager.</param>
 public BmpEncoderCore(IBmpEncoderOptions options, MemoryAllocator memoryAllocator)
 {
     this.memoryAllocator = memoryAllocator;
     this.bitsPerPixel    = options.BitsPerPixel;
     this.writeV4Header   = options.SupportTransparency;
     this.quantizer       = options.Quantizer ?? new OctreeQuantizer(dither: true, maxColors: 256);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BmpEncoderCore"/> class.
 /// </summary>
 /// <param name="options">The encoder options</param>
 /// <param name="memoryAllocator">The memory manager</param>
 public BmpEncoderCore(IBmpEncoderOptions options, MemoryAllocator memoryAllocator)
 {
     this.memoryAllocator = memoryAllocator;
     this.bitsPerPixel    = options.BitsPerPixel;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BmpEncoderCore"/> class.
 /// </summary>
 /// <param name="options">The encoder options</param>
 public BmpEncoderCore(IBmpEncoderOptions options)
 {
     this.bitsPerPixel = options.BitsPerPixel;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BmpEncoderCore"/> class.
 /// </summary>
 /// <param name="options">The encoder options</param>
 /// <param name="memoryManager">The memory manager</param>
 public BmpEncoderCore(IBmpEncoderOptions options, MemoryManager memoryManager)
 {
     this.memoryManager = memoryManager;
     this.bitsPerPixel  = options.BitsPerPixel;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BmpEncoderCore"/> class.
 /// </summary>
 /// <param name="options">The options for the encoder.</param>
 public BmpEncoderCore(IBmpEncoderOptions options)
 {
     this.options = options ?? new BmpEncoderOptions();
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BmpEncoderCore"/> class.
 /// </summary>
 /// <param name="options">The encoder options.</param>
 /// <param name="memoryAllocator">The memory manager.</param>
 public BmpEncoderCore(IBmpEncoderOptions options, MemoryAllocator memoryAllocator)
 {
     this.memoryAllocator = memoryAllocator;
     this.bitsPerPixel    = options.BitsPerPixel;
     this.writeV4Header   = options.SupportTransparency;
 }