Skip to content

cyotek/Cyotek.Drawing.PaletteFormat.Fractint

Repository files navigation

Fractint Palette Map Serializer

This is a simple class for reading and writing System.Drawing.Color arrays to and from Fractint palette maps.

It has been designed to be either directly referenced in your own projects, or can be used as a serializer with Cyotek Color Palette Editor). The class has no dependencies and so the entire class can be embedded in your own code if required.

There is also a small test class to verify the critical bits of the code are doing what they should be.

Reading Palettes

Palette data can be read from any Stream

FractintPaletteSerializer reader = new FractintPaletteSerializer();
Stream stream = GetDataStream();
Color[] colors = reader.Load(stream);

However, for simplicity an overload is also available to load from a file

FractintPaletteSerializer reader = new FractintPaletteSerializer();
string fileName = "mypalette.map";
Color[] colors = reader.Load(fileName);

You can also use the CanLoad overloads to test if a given Stream or file contains a readable palette map.

Writing Palettes

As with reading, palette data can be written to either a Stream or a file.

FractintPaletteSerializer writer = new FractintPaletteSerializer();
string fileName = "mypalette.map";
Color[] colors = new[] { Color.Red, Color.Green, Color.Blue };
writer.Save(fileName);

Acknowledgements

The package icon is derived from Color, colors, palette icon by Nick Roach. The icon is licensed according the GNU General Public License, version 3.

The default.map file used in the test library taken from the Fractint SVN repository.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published