Skip to main content
GameDev.net gamedev.net
🔒 Locked

Help with an interview question

Started by pfullsack Oct 22, 2005 at 10:37 AM 0 replies 400+ views
Original Post
pfullsack
pfullsack
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
SiCrane
SiCrane
Cheating on an interview question isn't a good thing.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.