makejpeg.cpp
////////////////////////////////////////
//This function turns a 16-bit pixel
//into an RGBQUAD value.
////////////////////////////////////////

This function turns a 16-bit pixel
into an RGBQUAD value.
This function turns a 16 - bit pixel into an RGBQUAD value .
RGBQUAD QuadFromWord (WORD b16)
{
   BYTE bytVals[] =
   {
     0,  16, 24, 32,  40, 48, 56, 64,
     72, 80, 88, 96, 104,112,120,128,
     136,144,152,160,168,176,184,192,
     200,208,216,224,232,240,248,255
   };
   WORD wR = b16;
   WORD wG = b16;
   WORD wB = b16;
   wR <<=  1;
   wR >>= 11;
   wG <<=  6;
   wG >>= 11;
   wB <<= 11;
   wB >>= 11;
   RGBQUAD rgb;
   rgb.rgbReserved = 0;
   rgb.rgbBlue     = bytVals[wB];
   rgb.rgbGreen    = bytVals[wG];
   rgb.rgbRed      = bytVals[wR];
   return rgb;
}
RGBQUAD QuadFromWord ( WORD b16 ) { BYTE bytVals [ ] = { 0 , 16 , 24 , 32 , 40 , 48 , 56 , 64 , 72 , 80 , 88 , 96 , 104 , 112 , 120 , 128 , 136 , 144 , 152 , 160 , 168 , 176 , 184 , 192 , 200 , 208 , 216 , 224 , 232 , 240 , 248 , 255 } ; WORD wR = b16 ; WORD wG = b16 ; WORD wB = b16 ; wR <<= 1 ; wR >>= 11 ; wG <<= 6 ; wG >>= 11 ; wB <<= 11 ; wB >>= 11 ; RGBQUAD rgb ; rgb . rgbReserved = 0 ; rgb . rgbBlue = bytVals [ wB ] ; rgb . rgbGreen = bytVals [ wG ] ; rgb . rgbRed = bytVals [ wR ] ; return rgb ; }
This function turns a 16-bit pixel
into an RGBQUAD value.
This function turns a 16 - bit pixel into an RGBQUAD value .