/// <summary> /// Initializes a new instance of the <see cref="GifEncoderCore"/> class. /// </summary> /// <param name="memoryManager">The <see cref="MemoryManager"/> to use for buffer allocations.</param> /// <param name="options">The options for the encoder.</param> public GifEncoderCore(MemoryManager memoryManager, IGifEncoderOptions options) { this.memoryManager = memoryManager; this.textEncoding = options.TextEncoding ?? GifConstants.DefaultEncoding; this.quantizer = options.Quantizer; this.ignoreMetadata = options.IgnoreMetadata; }
/// <summary> /// Initializes a new instance of the <see cref="GifEncoderCore"/> class. /// </summary> /// <param name="memoryAllocator">The <see cref="MemoryAllocator"/> to use for buffer allocations.</param> /// <param name="options">The options for the encoder.</param> public GifEncoderCore(MemoryAllocator memoryAllocator, IGifEncoderOptions options) { this.memoryAllocator = memoryAllocator; this.textEncoding = options.TextEncoding ?? GifConstants.DefaultEncoding; this.quantizer = options.Quantizer; this.colorTableMode = options.ColorTableMode; }
/// <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, IGifEncoderOptions options) where TColor : struct, IPixel <TColor> { GifEncoderCore encoder = new GifEncoderCore(options); encoder.Encode(image, stream); }
/// <inheritdoc/> public void Encode <TColor>(Image <TColor> image, Stream stream, IEncoderOptions options) where TColor : struct, IPixel <TColor> { IGifEncoderOptions gifOptions = GifEncoderOptions.Create(options); this.Encode(image, stream, gifOptions); }
/// <summary> /// Initializes a new instance of the <see cref="GifEncoderCore"/> class. /// </summary> /// <param name="configuration">The configuration which allows altering default behaviour or extending the library.</param> /// <param name="options">The options for the encoder.</param> public GifEncoderCore(Configuration configuration, IGifEncoderOptions options) { this.configuration = configuration; this.memoryAllocator = configuration.MemoryAllocator; this.quantizer = options.Quantizer; this.colorTableMode = options.ColorTableMode; }
/// <summary> /// Initializes a new instance of the <see cref="GifEncoderCore"/> class. /// </summary> /// <param name="configuration">The configuration which allows altering default behaviour or extending the library.</param> /// <param name="options">The options for the encoder.</param> public GifEncoderCore(Configuration configuration, IGifEncoderOptions options) { this.configuration = configuration; this.memoryAllocator = configuration.MemoryAllocator; this.quantizer = options.Quantizer; this.colorTableMode = options.ColorTableMode; this.pixelSamplingStrategy = options.GlobalPixelSamplingStrategy; }
/// <summary> /// Initializes a new instance of the <see cref="GifEncoderCore"/> class. /// </summary> /// <param name="options">The options for the encoder.</param> public GifEncoderCore(IGifEncoderOptions options) { this.textEncoding = options.TextEncoding ?? GifConstants.DefaultEncoding; this.quantizer = options.Quantizer; this.threshold = options.Threshold; this.paletteSize = options.PaletteSize; this.ignoreMetadata = options.IgnoreMetadata; }
/// <summary> /// Initializes a new instance of the <see cref="GifEncoderCore"/> class. /// </summary> /// <param name="options">The options for the encoder.</param> public GifEncoderCore(IGifEncoderOptions options) { this.options = options ?? new GifEncoderOptions(); }
/// <summary> /// Initializes a new instance of the <see cref="GifEncoderCore"/> class. /// </summary> /// <param name="memoryAllocator">The <see cref="MemoryAllocator"/> to use for buffer allocations.</param> /// <param name="options">The options for the encoder.</param> public GifEncoderCore(MemoryAllocator memoryAllocator, IGifEncoderOptions options) { this.memoryAllocator = memoryAllocator; this.quantizer = options.Quantizer; this.colorTableMode = options.ColorTableMode; }
/// <summary> /// Saves the image to the given stream with the gif format. /// </summary> /// <typeparam name="TColor">The pixel format.</typeparam> /// <param name="source">The image this method extends.</param> /// <param name="stream">The stream to save the image to.</param> /// <param name="options">The options for the encoder.</param> /// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception> /// <returns> /// The <see cref="Image{TColor}"/>. /// </returns> public static Image <TColor> SaveAsGif <TColor>(this Image <TColor> source, Stream stream, IGifEncoderOptions options) where TColor : struct, IPixel <TColor> { GifEncoder encoder = new GifEncoder(); encoder.Encode(source, stream, options); return(source); }