Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
rgb.h
1
2
/***************************************************************************
3
* rgb.h - RGB specific methods, macros and constants
4
*
5
* Created: Sat Aug 12 14:58:02 2006
6
* based on colorspaces.h from Tue Feb 23 13:49:38 2005
7
* Copyright 2005-2006 Tim Niemueller [www.niemueller.de]
8
*
9
****************************************************************************/
10
11
/* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version. A runtime exception applies to
15
* this software (see LICENSE.GPL_WRE file mentioned below for details).
16
*
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU Library General Public License for more details.
21
*
22
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
23
*/
24
25
#ifndef __FIREVISION_UTILS_COLOR_RGB_H
26
#define __FIREVISION_UTILS_COLOR_RGB_H
27
28
namespace
firevision {
29
#if 0
/* just to make Emacs auto-indent happy */
30
}
31
#endif
32
33
#define RGB_PIXEL_SIZE 3
34
#define RGB_PIXEL_AT(RGB, width, x, y) ((RGB_t *)(RGB + ((y) * (width) * RGB_PIXEL_SIZE) + (x) * RGB_PIXEL_SIZE))
35
#define RGB_CLEAR_PIXEL(RGB, width, x, y) memset(RGB + ((y) * (width) * RGB_PIXEL_SIZE) + (x) * RGB_PIXEL_SIZE, 0, RGB_PIXEL_SIZE);
36
#define RGB_RED_AT(RGB, width, x, y) (RGB_PIXEL_AT(RGB, (width), (x), (y))->R)
37
#define RGB_GREEN_AT(RGB, width, x, y) (RGB_PIXEL_AT(RGB, (width), (x), (y))->G)
38
#define RGB_BLUE_AT(RGB, width, x, y) (RGB_PIXEL_AT(RGB, (width), (x), (y))->B)
39
#define RGB_SET_RED(RGB, width, x, y) {RGB_t *p=RGB_PIXEL_AT(RGB, (width), (x), (y)); p->R=255; p->G=0; p->B=0; }
40
#define RGB_SET_GREEN(RGB, width, x, y) {RGB_t *p=RGB_PIXEL_AT(RGB, (width), (x), (y)); p->R=0; p->G=255; p->B=0; }
41
#define RGB_SET_BLUE(RGB, width, x, y) {RGB_t *p=RGB_PIXEL_AT(RGB, (width), (x), (y)); p->R=0; p->G=0; p->B=255; }
42
43
/** Structure defining an RGB pixel (in R-G-B byte ordering). */
44
typedef
struct
{
45
unsigned
char
R
;
/**< R value */
46
unsigned
char
G
;
/**< G value */
47
unsigned
char
B
;
/**< B value */
48
}
RGB_t
;
49
50
/** Structure defining an RGB pixel (in B-G-R byte ordering). */
51
typedef
struct
{
52
unsigned
char
B
;
/**< B value */
53
unsigned
char
G
;
/**< G value */
54
unsigned
char
R
;
/**< R value */
55
}
BGR_t
;
56
57
void
rgb_to_rgb_with_alpha_plainc(
const
unsigned
char
*rgb,
unsigned
char
*rgb_alpha,
58
unsigned
int
width,
unsigned
int
height);
59
60
void
rgb_to_bgr_with_alpha_plainc(
const
unsigned
char
*rgb,
unsigned
char
*bgr_alpha,
61
unsigned
int
width,
unsigned
int
height);
62
63
void
bgr_to_rgb_plainc(
const
unsigned
char
*BGR,
unsigned
char
*RGB,
64
unsigned
int
width,
unsigned
int
height);
65
66
void
convert_line_bgr_rgb(
const
unsigned
char
*BGR,
unsigned
char
*RGB,
67
unsigned
int
width,
unsigned
int
height);
68
69
}
// end namespace firevision
70
71
#endif
src
libs
fvutils
color
rgb.h
Generated by
1.8.1.1