# color.cpp File Reference

Color Class. More...

`#include <ETL/angle>`
`#include "color.h"`
`#include <cstdio>`
`#include <sstream>`
`#include <iostream>`
`#include <iomanip>`

## Defines

#define | COLOR_EPSILON (0.000001f)

## Typedefs

typedef Color(* | blendfunc )(Color &, Color &, float)

## Functions

static Color | blendfunc_COMPOSITE (Color &src, Color &dest, float amount)
static Color | blendfunc_STRAIGHT (Color &src, Color &bg, float amount)
static Color | blendfunc_ONTO (Color &a, Color &b, float amount)
static Color | blendfunc_STRAIGHT_ONTO (Color &a, Color &b, float amount)
static Color | blendfunc_BRIGHTEN (Color &a, Color &b, float amount)
static Color | blendfunc_DARKEN (Color &a, Color &b, float amount)
static Color | blendfunc_ADD (Color &a, Color &b, float amount)
static Color | blendfunc_SUBTRACT (Color &a, Color &b, float amount)
static Color | blendfunc_DIFFERENCE (Color &a, Color &b, float amount)
static Color | blendfunc_MULTIPLY (Color &a, Color &b, float amount)
static Color | blendfunc_DIVIDE (Color &a, Color &b, float amount)
static Color | blendfunc_COLOR (Color &a, Color &b, float amount)
static Color | blendfunc_HUE (Color &a, Color &b, float amount)
static Color | blendfunc_SATURATION (Color &a, Color &b, float amount)
static Color | blendfunc_LUMINANCE (Color &a, Color &b, float amount)
static Color | blendfunc_BEHIND (Color &a, Color &b, float amount)
static Color | blendfunc_ALPHA_BRIGHTEN (Color &a, Color &b, float amount)
static Color | blendfunc_ALPHA_DARKEN (Color &a, Color &b, float amount)
static Color | blendfunc_SCREEN (Color &a, Color &b, float amount)
static Color | blendfunc_OVERLAY (Color &a, Color &b, float amount)
static Color | blendfunc_HARD_LIGHT (Color &a, Color &b, float amount)
static Color | blendfunc_ALPHA_OVER (Color &a, Color &b, float amount)

## Detailed Description

Color Class.

$Id$

## Define Documentation

#define COLOR_EPSILON (0.000001f)

Referenced by synfig::Color::blend(), blendfunc_BEHIND(), blendfunc_COMPOSITE(), blendfunc_DIVIDE(), and blendfunc_STRAIGHT().

## Typedef Documentation

typedef Color(* blendfunc)(Color &, Color &, float)

## Function Documentation

static Color blendfunc_COMPOSITE | ( | Color & | src,
|  | Color & | dest,
|  | float | amount |
| ) |  |  | `[static]`

References synfig::Color::alpha(), COLOR_EPSILON, synfig::Color::get_a(), synfig::Color::is_valid(), and synfig::Color::set_a().

Referenced by synfig::Color::blend(), blendfunc_BEHIND(), and blendfunc_ONTO().

static Color blendfunc_STRAIGHT | ( | Color & | src,
|  | Color & | bg,
|  | float | amount |
| ) |  |  | `[static]`

References synfig::Color::alpha(), COLOR_EPSILON, synfig::Color::get_a(), synfig::Color::is_valid(), and synfig::Color::set_a().

Referenced by synfig::Color::blend(), blendfunc_ALPHA_OVER(), and blendfunc_STRAIGHT_ONTO().

static Color blendfunc_ONTO | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References synfig::Color::alpha(), blendfunc_COMPOSITE(), synfig::Color::get_a(), and synfig::Color::set_a().

Referenced by synfig::Color::blend(), blendfunc_HARD_LIGHT(), blendfunc_OVERLAY(), and blendfunc_SCREEN().

static Color blendfunc_STRAIGHT_ONTO | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References blendfunc_STRAIGHT(), synfig::Color::get_a(), and synfig::Color::set_a().

Referenced by synfig::Color::blend().

static Color blendfunc_BRIGHTEN | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References synfig::Color::alpha(), synfig::Color::get_a(), synfig::Color::get_b(), synfig::Color::get_g(), synfig::Color::get_r(), synfig::Color::set_b(), synfig::Color::set_g(), and synfig::Color::set_r().

Referenced by synfig::Color::blend().

static Color blendfunc_DARKEN | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References synfig::Color::alpha(), f, synfig::Color::get_a(), synfig::Color::get_b(), synfig::Color::get_g(), synfig::Color::get_r(), synfig::Color::set_b(), synfig::Color::set_g(), and synfig::Color::set_r().

Referenced by synfig::Color::blend().

static Color blendfunc_ADD | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References synfig::Color::alpha(), synfig::Color::get_a(), synfig::Color::get_b(), synfig::Color::get_g(), synfig::Color::get_r(), synfig::Color::set_b(), synfig::Color::set_g(), and synfig::Color::set_r().

Referenced by synfig::Color::blend().

static Color blendfunc_SUBTRACT | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References synfig::Color::alpha(), synfig::Color::get_a(), synfig::Color::get_b(), synfig::Color::get_g(), synfig::Color::get_r(), synfig::Color::set_b(), synfig::Color::set_g(), and synfig::Color::set_r().

Referenced by synfig::Color::blend().

static Color blendfunc_DIFFERENCE | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References std::abs(), synfig::Color::alpha(), synfig::Color::get_a(), synfig::Color::get_b(), synfig::Color::get_g(), synfig::Color::get_r(), synfig::Color::set_b(), synfig::Color::set_g(), and synfig::Color::set_r().

Referenced by synfig::Color::blend().

static Color blendfunc_MULTIPLY | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References synfig::Color::get_a(), synfig::Color::get_b(), synfig::Color::get_g(), synfig::Color::get_r(), synfig::Color::set_b(), synfig::Color::set_g(), and synfig::Color::set_r().

Referenced by synfig::Color::blend().

static Color blendfunc_DIVIDE | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References COLOR_EPSILON, synfig::Color::get_a(), synfig::Color::get_b(), synfig::Color::get_g(), synfig::Color::get_r(), synfig::Color::set_b(), synfig::Color::set_g(), and synfig::Color::set_r().

Referenced by synfig::Color::blend().

static Color blendfunc_COLOR | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References synfig::Color::get_a(), synfig::Color::get_u(), synfig::Color::get_v(), and synfig::Color::set_uv().

Referenced by synfig::Color::blend().

static Color blendfunc_HUE | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References synfig::Color::get_a(), synfig::Color::get_hue(), and synfig::Color::set_hue().

Referenced by synfig::Color::blend().

static Color blendfunc_SATURATION | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References synfig::Color::get_a(), synfig::Color::get_s(), and synfig::Color::set_s().

Referenced by synfig::Color::blend().

static Color blendfunc_LUMINANCE | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References synfig::Color::get_a(), synfig::Color::get_y(), and synfig::Color::set_y().

Referenced by synfig::Color::blend().

static Color blendfunc_BEHIND | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

<

Todo:
  this is a hack

References blendfunc_COMPOSITE(), COLOR_EPSILON, synfig::Color::get_a(), and synfig::Color::set_a().

Referenced by synfig::Color::blend().

static Color blendfunc_ALPHA_BRIGHTEN | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References synfig::Color::get_a(), and synfig::Color::set_a().

Referenced by synfig::Color::blend().

static Color blendfunc_ALPHA_DARKEN | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References synfig::Color::get_a(), and synfig::Color::set_a().

Referenced by synfig::Color::blend().

static Color blendfunc_SCREEN | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References blendfunc_ONTO(), f, synfig::Color::get_b(), synfig::Color::get_g(), synfig::Color::get_r(), synfig::Color::set_b(), synfig::Color::set_g(), and synfig::Color::set_r().

Referenced by synfig::Color::blend().

static Color blendfunc_OVERLAY | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References blendfunc_ONTO(), f, synfig::Color::get_b(), synfig::Color::get_g(), synfig::Color::get_r(), synfig::Color::set_b(), synfig::Color::set_g(), and synfig::Color::set_r().

Referenced by synfig::Color::blend().

static Color blendfunc_HARD_LIGHT | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References blendfunc_ONTO(), synfig::Color::get_b(), synfig::Color::get_g(), synfig::Color::get_r(), synfig::Color::set_b(), synfig::Color::set_g(), and synfig::Color::set_r().

Referenced by synfig::Color::blend().

static Color blendfunc_ALPHA_OVER | ( | Color & | a,
|  | Color & | b,
|  | float | amount |
| ) |  |  | `[static]`

References blendfunc_STRAIGHT(), synfig::Color::get_a(), and synfig::Color::set_a().

Referenced by synfig::Color::blend().