Laxkit  0.0.7.1
Public Member Functions | Public Attributes
Laxkit::Palette Class Reference

A color palette. You can use a PaletteWindow to handle these. More...

Inheritance diagram for Laxkit::Palette:
Inheritance graph
[legend]

List of all members.

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::Attributedump_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 charwhattype ()
 Returns the type of anObject.
virtual anObjectduplicate (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
charfilename
charname
char is_read_in
int columns
PtrStack< PaletteEntrycolors
- Public Attributes inherited from Laxkit::anObject
int suppress_debug
DeleteRefCountedFunc deleteMe
 Called when the count is decremented to 0.
unsigned long object_id
charobject_idstr

Additional Inherited Members

- Protected Attributes inherited from Laxkit::anObject
int _count
 The reference count of the object.

Detailed Description

A color palette. You can use a PaletteWindow to handle these.

Can read and write Gimp palettes, as well as an Attribute ready format.

Todo:
*** needs better color management, have color space field, etc.... right now assumes ONLY rgb.

Member Function Documentation

void Laxkit::Palette::dump_in ( FILE *  f,
int  indent,
int  what,
anObject loadcontext,
LaxFiles::Attribute **  att 
)
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().

void Laxkit::Palette::dump_in_atts ( LaxFiles::Attribute att,
int  flag,
anObject loadcontext 
)
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.

void Laxkit::Palette::dump_out ( FILE *  f,
int  indent,
int  what,
anObject context 
)
virtual

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.


The documentation for this class was generated from the following files:

Mon Feb 17 2014 11:53:00, Laxkit