MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / BitmapGrayScale

Function BitmapGrayScale

src/Helpers.c:303–321  ·  view source on GitHub ↗

============================================================================= BitmapGrayScale() Gray scale color channel only

Source from the content-addressed store, hash-verified

301// Gray scale color channel only
302//
303BOOL BitmapGrayScale ( HBITMAP hbmp )
304{
305 BITMAP bmp;
306 if ( GetObject ( hbmp, sizeof ( BITMAP ), &bmp ) ) {
307 if ( bmp.bmBitsPixel == 32 ) {
308 int x, y;
309 RGBQUAD *prgba = bmp.bmBits;
310 for ( y = 0; y < bmp.bmHeight; y++ ) {
311 for ( x = 0; x < bmp.bmWidth; x++ ) {
312 prgba[x].rgbRed = prgba[x].rgbGreen = prgba[x].rgbBlue =
313 ( ( ( BYTE ) ( ( prgba[x].rgbRed * 38 + prgba[x].rgbGreen * 75 + prgba[x].rgbBlue * 15 ) >> 7 ) * 0x80 ) + ( 0xD0 * ( 255 - 0x80 ) ) ) >> 8;
314 }
315 prgba = ( RGBQUAD * ) ( ( LPBYTE ) prgba + bmp.bmWidthBytes );
316 }
317 return TRUE;
318 }
319 }
320 return FALSE;
321}
322
323
324//=============================================================================

Callers 1

CreateBarsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected