Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

wftk::Color Class Reference

Wrapper class for describing colors using 8-bits per red, green, blue, and alpha channels. More...

#include <color.h>

List of all members.

Public Types

typedef Resource< ColorResource
 refcounted resource
enum  { WFTK_TRANSPARENT, WFTK_OPAQUE }
 The alpha channel values for transparent and opaque. More...

Public Member Functions

 Color ()
 Default constructor. (opaque black).
 Color (Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha=WFTK_OPAQUE)
 Construct from a triple/quadruple. (R, G, B, A).
 Color (const SDL_Color &c)
 Construct from SDL_Color.
 Color (const std::string &name)
 Construct a named color (as find()).
 Color (const char *name)
 same thing, so compiler will autocreate temporaries from "foo"

Static Public Member Functions

static const Colorfind (const std::string &)
 Use the find method to retrieve a color by name (replaces use of static colors in wftk namespace).

Public Attributes

Uint8 r
 Red.
Uint8 g
 Green.
Uint8 b
 Blue.
Uint8 a
 Alpha.

Static Public Attributes

static ResourceRegistry< Color,
ResLoad, ResInval > 
registry
 Load bitmapped surface from file.

Friends

bool operator== (const Color &c1, const Color &c2)
 Compares colors (without alpha channel !).
bool operator!= (const Color &c1, const Color &c2)
 Inequality comparison.
bool operator< (const Color &c1, const Color &c2)
 for use with std::map
std::ostream & operator<< (std::ostream &s, const Color &c)
 Operator for output streams.


Detailed Description

Wrapper class for describing colors using 8-bits per red, green, blue, and alpha channels.


Member Enumeration Documentation

anonymous enum
 

The alpha channel values for transparent and opaque.

Enumerator:
WFTK_TRANSPARENT  The alpha value for transparent.
WFTK_OPAQUE  The alpha value for opaque.


Member Data Documentation

ResourceRegistry< Color, Color::ResLoad, Color::ResInval > Color::registry [static]
 

Load bitmapped surface from file.

Use the load() function to register a color resource, using a string specification for the color, giving values for RGB or RGBA, as integers from 0 to 255, e.g.:

   Color::registry.load("blue", "0 0 255");
   Color::registry.load("grey25", "128 128 128 64");
Use the find() macro to retrieve the color Resource. If the named color has not been registered, find() will return a transparent color.
   myWidget->setColor(&Color::registry.find("blue"));


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

Generated Tue Aug 9 18:40:26 2005.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.