Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uint32_t blue = 0, red = 0 , green = 0, alpha = 0, factor = 0 , shift = 0;
- // some initial calculation to calculate factor shift and R G B init values all are expected to be initilized with 16 bit unsigned
- //pSRC is 32 bbp flat pixel array and count is total pixels count
- for( int i = 0; i < count; i++ )
- {
- blue += *psrc++;
- green += *psrc++;
- green += *psrc++;
- alpha += *psrc++;
- *pDest++ = static_cast< uint_8 >( ( blue * factor ) >> shift );
- *pDest++ = static_cast< uint_8 >( ( green * factor ) >> shift );
- *pDest++ = static_cast< uint_8 >( ( red * factor ) >> shift );
- *pDest++ = static_cast< uint_8 >( ( alpha * factor ) >> shift );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement