/* rgb_frame.h * Header file for rgb frame class */ /* Author: Diego Iglesias * iglesias@andrew.cmu.edu * You may not use or distribute this software in part or whole * without the authors' consent. */ #ifndef RGB_FRAME_H #define RGB_FRAME_H #include "datatypes.h" #include "yuv_frame.h" #include "basic_support.h" #include #define MAX_RED 8 #define MAX_GREEN 8 #define MAX_BLUE 4 #define RED_BITS 3 #define GREEN_BITS 3 #define BLUE_BITS 2 class rgb_frame { /* functions */ public: /* constructor: must supply size of empty image to create */ rgb_frame(int rows = 288, int cols = 352); /* constructor: must supply file handle to read image from * status contains true on successful read from file and false on empty file * if file contains partial data, function will terminate program * with error */ rgb_frame(FILE*& fp, uint8& status); /* constructor: must supply yuv_frame to convert data from to rgb */ rgb_frame(yuv_frame* the_yuv_frame); /* write frame in raw binary, starting with r->g->b frames */ void write_raw_to_file(char* filename); /* transform rgb frame to 8bit colormap format */ void To8BitX(int* colormap, uint8* Frame8BitX); /* return the number of rows */ int get_num_rows(); /* return the number of columns */ int get_num_cols(); /* get the rgb image in a single dimensional array with format * r->g->b r->g->b r->g->b for each pixel in image. * this function will also do upsidedown of image as required * when using this with OpenGL's glTexImage2D or glDrawPixels */ void get_rgb_image(int image_width, int image_height, int max_image_width, int max_image_height, uint8* the_rgb_image); /* variables */ private: /* r, g and b image components are arrays of 8bit 0-255 resolution */ uint8 *r, *g, *b; /* number of rows and columns in image */ int num_rows; int num_cols; }; #endif