synfig-core  1.0.3
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
synfig::CairoColor Class Reference

#include <cairocolor.h>

Public Types

typedef uint32_t value_type

Public Member Functions

unsigned char ceil_clamp (int x)
unsigned char floor_clamp (int x)
unsigned char clamp (int x)
unsigned char clamp (float x)
CairoColoroperator+= (const CairoColor &rhs)
CairoColoroperator-= (const CairoColor &rhs)
CairoColoroperator*= (const float &rhs)
CairoColoroperator/= (const float &rhs)
CairoColor operator+ (const CairoColor &rhs) const
CairoColor operator- (const CairoColor &rhs) const
CairoColor operator* (const float &rhs) const
CairoColor operator/ (const float &rhs) const
bool operator== (const CairoColor &rhs) const
bool operator!= (const CairoColor &rhs) const
CairoColor operator~ () const
bool is_valid () const
CairoColor premult_alpha () const
CairoColor demult_alpha () const
 CairoColor ()
 CairoColor (const unsigned char u)
 CairoColor (const unsigned char R, const unsigned char G, const unsigned char B, const unsigned char A=ceil)
 CairoColor (const CairoColor &c, const unsigned char A)
 CairoColor (const CairoColor &c)
 CairoColor (const Color &c)
 CairoColor (const CairoColorAccumulator &c)
 CairoColor (int r, int g, int b, int a)
value_type get_pixel () const
unsigned char get_a () const
unsigned char get_r () const
unsigned char get_g () const
unsigned char get_b () const
unsigned char get_alpha () const
const String get_string (void) const
void set_hex (String &str)
const String get_hex () const
CairoColorset_r (const unsigned char x)
CairoColorset_g (const unsigned char x)
CairoColorset_b (const unsigned char x)
CairoColorset_a (const unsigned char x)
CairoColorset_alpha (const unsigned char x)
float get_y () const
float get_u () const
float get_v () const
float get_s () const
CairoColorset_yuv (const float &y, const float &u, const float &v)
CairoColorset_y (const float &y)
CairoColorset_u (const float &u)
CairoColorset_v (const float &v)
CairoColorset_uv (const float &u, const float &v)
CairoColorset_s (const float &x)
Angle get_hue () const
Angle get_uv_angle () const
CairoColorset_hue (const Angle &theta)
CairoColorset_uv_angle (const Angle &theta)
CairoColorrotate_uv (const Angle &theta)
CairoColorset_yuv (const float &y, const float &s, const Angle &theta)

Static Public Member Functions

static const String char2hex (unsigned char c)
static unsigned char hex2char (String s)
static CairoColor YUV (const float &y, const float &u, const float &v, const unsigned char a=ceil)
static CairoColor YUV (const float &y, const float &s, const Angle &theta, const unsigned char a=ceil)
static CairoColor alpha ()
static CairoColor black ()
static CairoColor white ()
static CairoColor gray ()
static CairoColor magenta ()
static CairoColor red ()
static CairoColor green ()
static CairoColor blue ()
static CairoColor cyan ()
static CairoColor yellow ()
static CairoColor blend (CairoColor a, CairoColor b, float amount, Color::BlendMethod type=Color::BLEND_COMPOSITE)
static bool is_onto (Color::BlendMethod x)
static bool is_straight (Color::BlendMethod x)

Static Public Attributes

static const unsigned char ceil = 255
static const unsigned char floor = 0
static const float range = CairoColor::ceil - CairoColor::floor
static const value_type amask = 0xFF<<24
static const value_type rmask = 0xFF<<16
static const value_type gmask = 0xFF<<8
static const value_type bmask = 0xFF

Friends

class CairoColorAccumulator

Detailed Description

\ ARGB 32 bits Color class implementation \ for Cairo Image usage. \ Color channels are stored in a 32 bits value native endian aligened \ with this order A, R, G, B \ Operations over color channels \ that overflow or underflow the unsigned char value \ (get the value out of 0-255) aren't allowed and the \ value will remain at 0 or 255. Otherwise, there could \ be color cycling what will produce artifacts, since \ values outside 0-255 aren't allowed.

\ In this class color channels aren't alpha premultiplied \ When used on a alpha premultiplied surface the premultiplication \ and demultiplication has to be explicitly done by the user before \ and after being used on the Cairo Image surface.

Member Typedef Documentation

Constructor & Destructor Documentation

synfig::CairoColor::CairoColor ( )
inline
synfig::CairoColor::CairoColor ( const unsigned char  u)
inline
synfig::CairoColor::CairoColor ( const unsigned char  R,
const unsigned char  G,
const unsigned char  B,
const unsigned char  A = ceil 
)
inline
synfig::CairoColor::CairoColor ( const CairoColor c,
const unsigned char  A 
)
inline

References set_a().

synfig::CairoColor::CairoColor ( const CairoColor c)
inline
synfig::CairoColor::CairoColor ( const Color c)
inline
synfig::CairoColor::CairoColor ( const CairoColorAccumulator c)
inline

References clamp(), range, set_a(), set_b(), set_g(), and set_r().

synfig::CairoColor::CairoColor ( int  r,
int  g,
int  b,
int  a 
)
inline

References clamp(), set_a(), set_b(), set_g(), and set_r().

Member Function Documentation

unsigned char synfig::CairoColor::ceil_clamp ( int  x)
inline

References ceil.

Referenced by operator+=().

unsigned char synfig::CairoColor::floor_clamp ( int  x)
inline

References floor.

Referenced by operator-=().

unsigned char synfig::CairoColor::clamp ( int  x)
inline

References ceil, and floor.

Referenced by CairoColor(), clamp(), operator*=(), and operator/=().

unsigned char synfig::CairoColor::clamp ( float  x)
inline

References clamp().

CairoColor& synfig::CairoColor::operator+= ( const CairoColor rhs)
inline
CairoColor& synfig::CairoColor::operator-= ( const CairoColor rhs)
inline
CairoColor& synfig::CairoColor::operator*= ( const float &  rhs)
inline
CairoColor& synfig::CairoColor::operator/= ( const float &  rhs)
inline
CairoColor synfig::CairoColor::operator+ ( const CairoColor rhs) const
inline

References CairoColor().

CairoColor synfig::CairoColor::operator- ( const CairoColor rhs) const
inline

References CairoColor().

CairoColor synfig::CairoColor::operator* ( const float &  rhs) const
inline

References CairoColor().

CairoColor synfig::CairoColor::operator/ ( const float &  rhs) const
inline

References CairoColor().

bool synfig::CairoColor::operator== ( const CairoColor rhs) const
inline

References get_a(), get_b(), get_g(), and get_r().

bool synfig::CairoColor::operator!= ( const CairoColor rhs) const
inline

References get_a(), get_b(), get_g(), and get_r().

CairoColor synfig::CairoColor::operator~ ( ) const
inline
bool synfig::CairoColor::is_valid ( ) const
inline
CairoColor synfig::CairoColor::premult_alpha ( ) const
inline
CairoColor synfig::CairoColor::demult_alpha ( ) const
inline
value_type synfig::CairoColor::get_pixel ( ) const
inline
unsigned char synfig::CairoColor::get_a ( ) const
inline
unsigned char synfig::CairoColor::get_r ( ) const
inline
unsigned char synfig::CairoColor::get_g ( ) const
inline
unsigned char synfig::CairoColor::get_b ( ) const
inline
unsigned char synfig::CairoColor::get_alpha ( ) const
inline
const String synfig::CairoColor::get_string ( void  ) const

References get_a(), and get_hex().

const String synfig::CairoColor::char2hex ( unsigned char  c)
static

References ceil, and synfig::Color::real2hex().

Referenced by get_hex().

unsigned char synfig::CairoColor::hex2char ( String  s)
static
void synfig::CairoColor::set_hex ( String str)
const String synfig::CairoColor::get_hex ( ) const
inline

References char2hex(), get_b(), get_g(), and get_r().

Referenced by get_string().

CairoColor& synfig::CairoColor::set_r ( const unsigned char  x)
inline
CairoColor& synfig::CairoColor::set_g ( const unsigned char  x)
inline
CairoColor& synfig::CairoColor::set_b ( const unsigned char  x)
inline
CairoColor& synfig::CairoColor::set_a ( const unsigned char  x)
inline
CairoColor& synfig::CairoColor::set_alpha ( const unsigned char  x)
inline

References set_a().

float synfig::CairoColor::get_y ( ) const
inline

References synfig::EncodeYUV, get_b(), get_g(), get_r(), and range.

Referenced by set_u(), set_uv(), and set_v().

float synfig::CairoColor::get_u ( ) const
inline
float synfig::CairoColor::get_v ( ) const
inline
float synfig::CairoColor::get_s ( ) const
inline

References get_u(), and get_v().

Referenced by set_hue().

CairoColor& synfig::CairoColor::set_yuv ( const float &  y,
const float &  u,
const float &  v 
)
inline
CairoColor& synfig::CairoColor::set_y ( const float &  y)
inline

References get_u(), get_v(), and set_yuv().

CairoColor& synfig::CairoColor::set_u ( const float &  u)
inline

References get_v(), get_y(), and set_yuv().

CairoColor& synfig::CairoColor::set_v ( const float &  v)
inline

References get_u(), get_y(), and set_yuv().

CairoColor& synfig::CairoColor::set_uv ( const float &  u,
const float &  v 
)
inline

References get_y(), and set_yuv().

Referenced by rotate_uv(), set_hue(), and set_s().

CairoColor& synfig::CairoColor::set_s ( const float &  x)
inline

References get_u(), get_v(), and set_uv().

static CairoColor synfig::CairoColor::YUV ( const float &  y,
const float &  u,
const float &  v,
const unsigned char  a = ceil 
)
inlinestatic

References CairoColor().

Angle synfig::CairoColor::get_hue ( ) const
inline

References get_u(), and get_v().

Referenced by get_uv_angle().

Angle synfig::CairoColor::get_uv_angle ( ) const
inline

References get_hue().

CairoColor& synfig::CairoColor::set_hue ( const Angle theta)
inline

References get_s(), and set_uv().

Referenced by set_uv_angle().

CairoColor& synfig::CairoColor::set_uv_angle ( const Angle theta)
inline

References set_hue().

CairoColor& synfig::CairoColor::rotate_uv ( const Angle theta)
inline

References get_u(), get_v(), and set_uv().

CairoColor& synfig::CairoColor::set_yuv ( const float &  y,
const float &  s,
const Angle theta 
)
inline

References set_yuv().

static CairoColor synfig::CairoColor::YUV ( const float &  y,
const float &  s,
const Angle theta,
const unsigned char  a = ceil 
)
inlinestatic

References CairoColor().

static CairoColor synfig::CairoColor::alpha ( )
inlinestatic
static CairoColor synfig::CairoColor::black ( )
inlinestatic

References CairoColor(), and floor.

static CairoColor synfig::CairoColor::white ( )
inlinestatic

References CairoColor(), and ceil.

static CairoColor synfig::CairoColor::gray ( )
inlinestatic

References CairoColor(), and ceil.

static CairoColor synfig::CairoColor::magenta ( )
inlinestatic

References CairoColor(), ceil, and floor.

static CairoColor synfig::CairoColor::red ( )
inlinestatic

References CairoColor(), ceil, and floor.

static CairoColor synfig::CairoColor::green ( )
inlinestatic

References CairoColor(), ceil, and floor.

static CairoColor synfig::CairoColor::blue ( )
inlinestatic

References CairoColor(), ceil, and floor.

static CairoColor synfig::CairoColor::cyan ( )
inlinestatic

References CairoColor(), ceil, and floor.

static CairoColor synfig::CairoColor::yellow ( )
inlinestatic

References CairoColor(), ceil, and floor.

CairoColor synfig::CairoColor::blend ( CairoColor  a,
CairoColor  b,
float  amount,
Color::BlendMethod  type = Color::BLEND_COMPOSITE 
)
static
static bool synfig::CairoColor::is_onto ( Color::BlendMethod  x)
inlinestatic
static bool synfig::CairoColor::is_straight ( Color::BlendMethod  x)
inlinestatic

Friends And Related Function Documentation

friend class CairoColorAccumulator
friend

Member Data Documentation

const unsigned char synfig::CairoColor::ceil = 255
static
const unsigned char synfig::CairoColor::floor = 0
static
const float synfig::CairoColor::range = CairoColor::ceil - CairoColor::floor
static
const value_type synfig::CairoColor::amask = 0xFF<<24
static

Referenced by set_a().

const value_type synfig::CairoColor::rmask = 0xFF<<16
static

Referenced by set_r().

const value_type synfig::CairoColor::gmask = 0xFF<<8
static

Referenced by set_g().

const value_type synfig::CairoColor::bmask = 0xFF
static

Referenced by set_b().


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