Quantcast
Channel: OxyPlot (moved to GitHub)
Viewing all articles
Browse latest Browse all 2061

New Post: color palette in oxyimage

$
0
0
Maybe the palette should have 256 entries?

The following should work:
        [Test]
        publicvoid Discussion453825()
        {
            var data = newbyte[100 * 100];
            int k = 0;
            for (int i = 0; i < 100; i++)
            {
                for (int j = 0; j < 100; j++)
                {
                    data[i + (j * 100)] = (byte)(k++ % 256);
                }
            }

            var palette = OxyPalettes.Gray(256).Colors.ToArray();
            var im = OxyImage.FromIndexed8(100, 100, data, palette);
            File.WriteAllBytes("Discussion453825.bmp", im.GetData());
        }
I have added this as a unit test.

Viewing all articles
Browse latest Browse all 2061

Latest Images

Trending Articles



Latest Images