Laxkit
0.0.7.1
|
A color palette. You can use a PaletteWindow to handle these. More...
Public Member Functions | |
virtual void | dump_out (FILE *f, int indent, int what, anObject *savecontext) |
virtual void | dump_in (FILE *f, int indent, int what, anObject *loadcontext, LaxFiles::Attribute **att) |
virtual LaxFiles::Attribute * | dump_out_atts (LaxFiles::Attribute *att, int what, anObject *savecontext) |
Dump out the palette to an Attribute, in standard format (what is ignored). | |
virtual void | dump_in_atts (LaxFiles::Attribute *att, int flag, anObject *loadcontext) |
virtual int | AddRGB (const char *name, int r, int g, int b, int max) |
virtual int | AddRGBA (const char *name, int r, int g, int b, int a, int max) |
virtual int | AddCMYK (const char *name, int c, int m, int y, int k, int max) |
virtual int | AddCMYKA (const char *name, int c, int m, int y, int k, int a, int max) |
virtual int | AddGray (const char *name, int g, int max) |
virtual int | AddGrayA (const char *name, int g, int a, int max) |
Public Member Functions inherited from LaxFiles::DumpUtility | |
virtual | ~DumpUtility () |
Empty virtual destructor. | |
Public Member Functions inherited from Laxkit::anObject | |
anObject () | |
Set object_id=getUniqueNumber(). | |
virtual | ~anObject () |
Empty virtual destructor. | |
virtual const char * | whattype () |
Returns the type of anObject. | |
virtual anObject * | duplicate (anObject *ref=NULL) |
virtual int | inc_count () |
Increment the data's count by 1. Returns count. | |
virtual int | dec_count () |
Decrement the count of the data, deleting if count is less than or equal to 0. | |
virtual int | the_count () |
Public Attributes | |
int | defaultmaxcolor |
int | default_colorspace |
char * | filename |
char * | name |
char | is_read_in |
int | columns |
PtrStack< PaletteEntry > | colors |
Public Attributes inherited from Laxkit::anObject | |
int | suppress_debug |
DeleteRefCountedFunc | deleteMe |
Called when the count is decremented to 0. | |
unsigned long | object_id |
char * | object_idstr |
Additional Inherited Members | |
Protected Attributes inherited from Laxkit::anObject | |
int | _count |
The reference count of the object. |
A color palette. You can use a PaletteWindow to handle these.
Can read and write Gimp palettes, as well as an Attribute ready format.
|
virtual |
what==0 normal Attribute format..
or LAX_GIMP_PALETTE
Reimplemented from LaxFiles::DumpUtility.
References LaxFiles::IntAttribute(), LaxFiles::IntListAttribute(), and makestr().
Referenced by Laxkit::PaletteWindow::LoadPalette().
|
virtual |
Expects value for colors to be like "1 2 3 name\n1 2 3 name\n...". The final value is always assumed to be the name. This will read in any number of initial numbers, then the first non-number character signals the start of the name of the color.
Implements LaxFiles::DumpUtility.
References Laxkit::PtrStack< T >::e, LaxFiles::IntAttribute(), LaxFiles::IntListAttribute(), makestr(), and Laxkit::PtrStack< T >::n.
Assumes the palette is already read in. filename is ignored.
If what==LAX_GIMP_PALETTE and the number of channels for the color does not equal 3, then the palette will not necessarily be readable by the Gimp, for instance, which assumes "r g b Name".
Out:
name Blah Palette columns 10 maxcolor 255 #if you say 1.0 for maxcolor, then channels are floating point in range [0..1] colors \ 0 0 0 Black 255 255 255 White 255 0 0 Red #r g b Name
If what==-1, the dump out a pseudocode mockup of the default file format.
Implements LaxFiles::DumpUtility.