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