Sign in to follow this  

Help with an interview question

Recommended Posts

hi I have received a questionnaire from one of the game companies but am not too sure how to answer this question. I would appreciate some insight in this Q: Write a function to expand an 8 bit to a 32 bit image Screen320x240x32 *Convert(Screen320x240x8 *pScreen, unsigned char iAlpha) { } using the following structure struct RGB16 { union u { unsigned short iFull; }; enum RGB16MASK { RGB16_RED_MASK = 0xF800, RGB16_GREEN_MASK = 0x07E0, RGB16_BLUE_MASK = 0x001F }; }; struct RGB32 { union u { unsigned int iFull; // all the color elements // together (8 bits per) unsigned char iElements[4]; // Separate color elements }; enum RGB32_ELEMENTS { R32EL_RED = 0, R32EL_GREEN, R32EL_BLUE, R32EL_ALPHA }; }; struct Screen320x240x32 { RGB32 *m_pScreen; // pointer to image data }; struct Screen320x240x8 { unsigned char *m_pScreen; // pointer to image data RGB16 m_aPalette[256]; // image’s palette }; regards pf

Share this post

Link to post
Share on other sites
This topic is now closed to further replies.
Sign in to follow this