00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __FIREVISION_UTILS_COLOR_RGB_H
00026 #define __FIREVISION_UTILS_COLOR_RGB_H
00027
00028 #define RGB_PIXEL_SIZE 3
00029 #define RGB_PIXEL_AT(RGB, width, x, y) ((RGB_t *)(RGB + ((y) * (width) * RGB_PIXEL_SIZE) + (x) * RGB_PIXEL_SIZE))
00030 #define RGB_CLEAR_PIXEL(RGB, width, x, y) memset(RGB + ((y) * (width) * RGB_PIXEL_SIZE) + (x) * RGB_PIXEL_SIZE, 0, RGB_PIXEL_SIZE);
00031 #define RGB_RED_AT(RGB, width, x, y) (RGB_PIXEL_AT(RGB, (width), (x), (y))->R)
00032 #define RGB_GREEN_AT(RGB, width, x, y) (RGB_PIXEL_AT(RGB, (width), (x), (y))->G)
00033 #define RGB_BLUE_AT(RGB, width, x, y) (RGB_PIXEL_AT(RGB, (width), (x), (y))->B)
00034 #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; }
00035 #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; }
00036 #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; }
00037
00038
00039 typedef struct {
00040 unsigned char R;
00041 unsigned char G;
00042 unsigned char B;
00043 } RGB_t;
00044
00045
00046 typedef struct {
00047 unsigned char B;
00048 unsigned char G;
00049 unsigned char R;
00050 } BGR_t;
00051
00052 void rgb_to_rgb_with_alpha_plainc(const unsigned char *rgb, unsigned char *rgb_alpha,
00053 unsigned int width, unsigned int height);
00054
00055 void rgb_to_bgr_with_alpha_plainc(const unsigned char *rgb, unsigned char *bgr_alpha,
00056 unsigned int width, unsigned int height);
00057
00058 void bgr_to_rgb_plainc(const unsigned char *BGR, unsigned char *RGB,
00059 unsigned int width, unsigned int height);
00060
00061 void convert_line_bgr_rgb(const unsigned char *BGR, unsigned char *RGB,
00062 unsigned int width, unsigned int height);
00063
00064 #endif