Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
res
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

18-bit RGB VGA Palette Serializer

This is a simple class for reading and writing System.Drawing.Color arrays to and from 18-bit RGB VGA palettes.

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

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

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

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

You can also use the CanLoad overloads to test if a given Stream or file contains an 18-bit VGA palette.

Writing Palettes

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

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

Further Reading

Releases

No releases published

Packages

No packages published

Languages