Exemplo 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);
        }
Exemplo 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;
 }
Exemplo 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);
        }
Exemplo 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);
 }
Exemplo 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;
 }
Exemplo 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;
 }
Exemplo 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();
 }
Exemplo 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;
 }