public override Image <TPixel> GetImage()
            {
                Image <TPixel> image = base.GetImage();
                TPixel         color = default(TPixel);

                color.FromRgba32(new Rgba32(this.r, this.g, this.b, this.a));

                image.Mutate(x => x.Fill(color));
                return(image);
            }
예제 #2
0
                public void ConstructPalette(TPixel[] palette, ref int index)
                {
                    if (this.leaf)
                    {
                        // Set the color of the palette entry
                        var    vector = Vector3.Clamp(new Vector3(this.red, this.green, this.blue) / this.pixelCount, Vector3.Zero, new Vector3(255));
                        TPixel pixel  = default;
                        pixel.FromRgba32(new Rgba32((byte)vector.X, (byte)vector.Y, (byte)vector.Z, byte.MaxValue));
                        palette[index] = pixel;

                        // Consume the next palette index
                        this.paletteIndex = index++;
                    }
                    else
                    {
                        // Loop through children looking for leaves
                        for (int i = 0; i < 8; i++)
                        {
                            this.children[i]?.ConstructPalette(palette, ref index);
                        }
                    }
                }