Coconut Data Framework
beta
|
Functions to operate colors for OpenGL. More...
#import <Coconut/Coconut.h>
#import <OpenGL/gl.h>
Go to the source code of this file.
Classes | |
struct | CNColor |
Defines | |
#define | CNColorPartNum 4 |
Typedefs | |
typedef uint16_t | CNColor16 |
16bit color format to save/load file | |
Enumerations | |
enum | CNColorPartIndex { CNRedPos = 0, CNGreenPos = 1, CNBluePos = 2, CNAlphaPos = 3 } |
enum | CNBasicColorId { CNBlackId = 'k', CNRedId = 'r', CNGreenId = 'g', CNBlueId = 'b', CNYellowId = 'y', CNMagentaId = 'm', CNCyanId = 'c', CNWhiteId = 'w', CNForegroundColorId = '*', CNBackgroundColorId = '.' } |
Functions | |
static GLfloat | CNRedPartOfColor (const struct CNColor *src) |
Get red part in CNColor. | |
static GLfloat | CNGreenPartOfColor (const struct CNColor *src) |
Get green part in CNColor. | |
static GLfloat | CNBluePartOfColor (const struct CNColor *src) |
Get blue part in CNColor. | |
static GLfloat | CNAlphaPartOfColor (const struct CNColor *src) |
Get alpha part in CNColor. | |
static const GLfloat * | CNVectorInColor (const struct CNColor *src) |
Get vector of parts in CNColor. | |
static uint64_t | CNHashValueOfColor (const struct CNColor *src) |
Get hash value for CNColor object. | |
static int | CNCompareColor (const struct CNColor *src0, const struct CNColor *src1) |
Compare 2 colors. | |
static CNBasicColorId | CNColorToBasicId (const struct CNColor *src) |
Get color by color-id. | |
static unsigned int | CNColorPartToColor16Part (GLfloat src) |
Convert part of CNColor to CNColor16. | |
static CNColor16 | CNColorToColor16 (const struct CNColor *src) |
Convert CNColor to CNColor16. | |
Variables | |
struct CNColor * | CNBlack |
struct CNColor * | CNRed |
struct CNColor * | CNGreen |
struct CNColor * | CNBlue |
struct CNColor * | CNYellow |
struct CNColor * | CNMagenta |
struct CNColor * | CNCyan |
struct CNColor * | CNWhite |
struct CNColor * | CNForegroundColor |
struct CNColor * | CNBackgroundColor |
static const CNBasicColorId | CNNotBasicColorId = (CNBasicColorId) 0 |
Functions to operate colors for OpenGL.
#define CNColorPartNum 4 |
The number of components of CNColor
enum CNColorPartIndex |
enum CNBasicColorId |
Index of basic color in basic color table
static GLfloat CNRedPartOfColor | ( | const struct CNColor * | src | ) | [inline, static] |
Get red part in CNColor.
src | Source color |
References CNRedPos, and CNColor::vector.
Referenced by CNColorToColor16().
static GLfloat CNGreenPartOfColor | ( | const struct CNColor * | src | ) | [inline, static] |
Get green part in CNColor.
src | Source color |
References CNGreenPos, and CNColor::vector.
Referenced by CNColorToColor16().
static GLfloat CNBluePartOfColor | ( | const struct CNColor * | src | ) | [inline, static] |
Get blue part in CNColor.
src | Source color |
References CNBluePos, and CNColor::vector.
Referenced by CNColorToColor16().
static GLfloat CNAlphaPartOfColor | ( | const struct CNColor * | src | ) | [inline, static] |
Get alpha part in CNColor.
src | Source color |
References CNAlphaPos, and CNColor::vector.
Referenced by CNColorToColor16().
static const GLfloat* CNVectorInColor | ( | const struct CNColor * | src | ) | [inline, static] |
Get vector of parts in CNColor.
src | Source color |
References CNColor::vector.
static uint64_t CNHashValueOfColor | ( | const struct CNColor * | src | ) | [inline, static] |
Get hash value for CNColor object.
src | Source color |
References CNColor::hashValue.
static int CNCompareColor | ( | const struct CNColor * | src0, |
const struct CNColor * | src1 | ||
) | [inline, static] |
Compare 2 colors.
Pos-val | Src1 is bigger than src2. |
Neg-val | Src1 is smaller than src2. |
0 | Src1 and src2 are same |
src0 | Source color 0 |
src1 | Source color 1 |
References CNColor::hashValue.
static CNBasicColorId CNColorToBasicId | ( | const struct CNColor * | src | ) | [inline, static] |
Get color by color-id.
color_id | Basic color Id |
0 | The given color is NOT basic color |
src | Source color |
References CNBackgroundColorId, CNBlackId, CNBlueId, CNCyanId, CNForegroundColorId, CNGreenId, CNMagentaId, CNNotBasicColorId, CNRedId, CNWhiteId, and CNYellowId.
static unsigned int CNColorPartToColor16Part | ( | GLfloat | src | ) | [inline, static] |
Convert part of CNColor to CNColor16.
f
src | Source part of CNColor value |
Referenced by CNColorToColor16().
Convert CNColor to CNColor16.
src | Source CNColor value |
References CNAlphaPartOfColor(), CNBluePartOfColor(), CNColorPartToColor16Part(), CNGreenPartOfColor(), and CNRedPartOfColor().
struct CNColor* CNForegroundColor |
Dummy color for foreground
struct CNColor* CNBackgroundColor |
Dummy color for background
const CNBasicColorId CNNotBasicColorId = (CNBasicColorId) 0 [static] |
The color is which does not match basic color
Referenced by CNColorToBasicId().