/// <summary>
 /// Initializes a new instance of the <see cref="PaletteDitherProcessor{TPixel}"/> class.
 /// </summary>
 /// <param name="configuration">The configuration which allows altering default behaviour or extending the library.</param>
 /// <param name="definition">The <see cref="PaletteDitherProcessor"/> defining the processor parameters.</param>
 /// <param name="source">The source <see cref="Image{TPixel}"/> for the current processor instance.</param>
 /// <param name="sourceRectangle">The source area to process for the current processor instance.</param>
 protected PaletteDitherProcessor(Configuration configuration, PaletteDitherProcessor definition, Image <TPixel> source, Rectangle sourceRectangle)
     : base(configuration, source, sourceRectangle)
 {
     this.Definition    = definition;
     this.palette       = this.Configuration.MemoryAllocator.Allocate <TPixel>(definition.Palette.Length);
     this.paletteVector = this.Configuration.MemoryAllocator.Allocate <Vector4>(definition.Palette.Length);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PaletteDitherProcessor{TPixel}"/> class.
 /// </summary>
 /// <param name="configuration">The configuration which allows altering default behaviour or extending the library.</param>
 /// <param name="definition">The <see cref="PaletteDitherProcessor"/> defining the processor parameters.</param>
 /// <param name="source">The source <see cref="Image{TPixel}"/> for the current processor instance.</param>
 /// <param name="sourceRectangle">The source area to process for the current processor instance.</param>
 public PaletteDitherProcessor(Configuration configuration, PaletteDitherProcessor definition, Image <TPixel> source, Rectangle sourceRectangle)
     : base(configuration, source, sourceRectangle)
 {
     this.paletteLength = definition.Palette.Span.Length;
     this.dither        = definition.Dither;
     this.ditherScale   = definition.DitherScale;
     this.sourcePalette = definition.Palette;
 }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PaletteDitherProcessor{TPixel}"/> class.
        /// </summary>
        /// <param name="configuration">The configuration which allows altering default behaviour or extending the library.</param>
        /// <param name="definition">The <see cref="PaletteDitherProcessor"/> defining the processor parameters.</param>
        /// <param name="source">The source <see cref="Image{TPixel}"/> for the current processor instance.</param>
        /// <param name="sourceRectangle">The source area to process for the current processor instance.</param>
        public PaletteDitherProcessor(Configuration configuration, PaletteDitherProcessor definition, Image <TPixel> source, Rectangle sourceRectangle)
            : base(configuration, source, sourceRectangle)
        {
            this.dither = definition.Dither;

            ReadOnlySpan <Color> sourcePalette = definition.Palette.Span;

            this.paletteOwner = this.Configuration.MemoryAllocator.Allocate <TPixel>(sourcePalette.Length);
            Color.ToPixel(this.Configuration, sourcePalette, this.paletteOwner.Memory.Span);

            this.ditherProcessor = new DitherProcessor(
                this.Configuration,
                this.paletteOwner.Memory,
                definition.DitherScale);
        }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PaletteDitherProcessor{TPixel}"/> class.
 /// </summary>
 /// <param name="definition">The <see cref="PaletteDitherProcessor"/> defining the processor parameters.</param>
 /// <param name="source">The source <see cref="Image{TPixel}"/> for the current processor instance.</param>
 /// <param name="sourceRectangle">The source area to process for the current processor instance.</param>
 protected PaletteDitherProcessor(PaletteDitherProcessor definition, Image <TPixel> source, Rectangle sourceRectangle)
     : base(source, sourceRectangle)
 {
     this.Definition = definition;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PaletteDitherProcessor{TPixel}"/> class.
 /// </summary>
 protected PaletteDitherProcessor(PaletteDitherProcessor definition)
 {
     this.Definition = definition;
 }