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 namespace firevision {
00029 #if 0
00030 }
00031 #endif
00032
00033 #define RGB_PIXEL_SIZE 3
00034 #define RGB_PIXEL_AT(RGB, width, x, y) ((RGB_t *)(RGB + ((y) * (width) * RGB_PIXEL_SIZE) + (x) * RGB_PIXEL_SIZE))
00035 #define RGB_CLEAR_PIXEL(RGB, width, x, y) memset(RGB + ((y) * (width) * RGB_PIXEL_SIZE) + (x) * RGB_PIXEL_SIZE, 0, RGB_PIXEL_SIZE);
00036 #define RGB_RED_AT(RGB, width, x, y) (RGB_PIXEL_AT(RGB, (width), (x), (y))->R)
00037 #define RGB_GREEN_AT(RGB, width, x, y) (RGB_PIXEL_AT(RGB, (width), (x), (y))->G)
00038 #define RGB_BLUE_AT(RGB, width, x, y) (RGB_PIXEL_AT(RGB, (width), (x), (y))->B)
00039 #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; }
00040 #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; }
00041 #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; }
00042
00043
00044 typedef struct {
00045 unsigned char R;
00046 unsigned char G;
00047 unsigned char B;
00048 } RGB_t;
00049
00050
00051 typedef struct {
00052 unsigned char B;
00053 unsigned char G;
00054 unsigned char R;
00055 } BGR_t;
00056
00057 void rgb_to_rgb_with_alpha_plainc(const unsigned char *rgb, unsigned char *rgb_alpha,
00058 unsigned int width, unsigned int height);
00059
00060 void rgb_to_bgr_with_alpha_plainc(const unsigned char *rgb, unsigned char *bgr_alpha,
00061 unsigned int width, unsigned int height);
00062
00063 void bgr_to_rgb_plainc(const unsigned char *BGR, unsigned char *RGB,
00064 unsigned int width, unsigned int height);
00065
00066 void convert_line_bgr_rgb(const unsigned char *BGR, unsigned char *RGB,
00067 unsigned int width, unsigned int height);
00068
00069 }
00070
00071 #endif