#include "FiveWin.ch"
function Main()
local oBmp
// DEFINE BITMAP oBmp FILENAME "c:\fwh\bitmaps\about.bmp" // No alpha
DEFINE BITMAP oBmp FILENAME "c:\fwh\bitmaps\AlphaBmp\trash.bmp" // with alpha
MsgInfo( HasAlpha( oBmp:hBitmap ) )
oBmp:End()
return nil
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
HB_FUNC( HASALPHA )
{
HBITMAP hBmp = ( HBITMAP ) hb_parnl( 1 );
HDC hDC = GetDC( GetDesktopWindow() );
BITMAPINFO bmi;
void * bits;
unsigned long ul;
BOOL bAlpha = FALSE;
memset( &bmi, 0, sizeof( BITMAPINFO ) );
bmi.bmiHeader.biSize = sizeof( BITMAPINFOHEADER );
GetDIBits( hDC, hBmp, 0, 1, NULL, &bmi, DIB_RGB_COLORS );
// hb_retnl( bmi.bmiHeader.biSize );
bits = hb_xgrab( bmi.bmiHeader.biSize );
GetDIBits( hDC, hBmp, 0, bmi.bmiHeader.biHeight, &bits, &bmi, DIB_RGB_COLORS );
for( ul = 0; ul < bmi.bmiHeader.biSize; ul += 4 )
if( ( ( char * ) bits )[ ul + 3 ] != 0 )
bAlpha = TRUE;
hb_xfree( bits );
ReleaseDC( GetDesktopWindow(), hDC );
hb_retl( bAlpha );
}
#pragma ENDDUMP
#include "FiveWin.ch"
function Main()
local oBmp
// DEFINE BITMAP oBmp FILENAME "c:\fwh\bitmaps\about.bmp" // No alpha
DEFINE BITMAP oBmp FILENAME "c:\fwh\bitmaps\AlphaBmp\trash.bmp" // with alpha
MsgInfo( HasAlpha( oBmp:hBitmap ) )
oBmp:End()
return nil
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
HB_FUNC( HASALPHA )
{
HBITMAP hBmp = ( HBITMAP ) hb_parnl( 1 );
HDC hDC = GetDC( GetDesktopWindow() );
BITMAPINFO bmi;
void * bits;
unsigned long ul;
BOOL bAlpha = FALSE;
memset( &bmi, 0, sizeof( BITMAPINFO ) );
bmi.bmiHeader.biSize = sizeof( BITMAPINFOHEADER );
GetDIBits( hDC, hBmp, 0, 1, NULL, &bmi, DIB_RGB_COLORS );
bits = hb_xgrab( bmi.bmiHeader.biSizeImage );
GetDIBits( hDC, hBmp, 0, bmi.bmiHeader.biHeight, &bits, &bmi, DIB_RGB_COLORS );
for( ul = 0; ul < bmi.bmiHeader.biSize; ul += 4 )
if( ( ( char * ) bits )[ ul + 3 ] != 0 )
bAlpha = TRUE;
hb_xfree( bits );
ReleaseDC( GetDesktopWindow(), hDC );
hb_retl( bAlpha );
}
#pragma ENDDUMP
#include "FiveWin.ch"
function Main()
local oBmp
// DEFINE BITMAP oBmp FILENAME "c:\fwh\bitmaps\about.bmp" // No alpha
DEFINE BITMAP oBmp FILENAME "c:\fwh\bitmaps\AlphaBmp\explorer.bmp" // with alpha
MsgInfo( HasAlpha( oBmp:hBitmap ) )
oBmp:End()
return nil
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
HB_FUNC( HASALPHA )
{
HBITMAP hBmp = ( HBITMAP ) hb_parnl( 1 );
HDC hDC = GetDC( GetDesktopWindow() );
BITMAPINFO bmi;
void * bits;
unsigned long ul;
BOOL bAlpha = FALSE;
memset( &bmi, 0, sizeof( BITMAPINFO ) );
bmi.bmiHeader.biSize = sizeof( BITMAPINFOHEADER );
GetDIBits( hDC, hBmp, 0, 1, NULL, &bmi, DIB_RGB_COLORS );
bits = hb_xgrab( bmi.bmiHeader.biSizeImage );
GetDIBits( hDC, hBmp, 0, bmi.bmiHeader.biHeight, &bits, &bmi, DIB_RGB_COLORS );
for( ul = 0; ul < bmi.bmiHeader.biSizeImage; ul += 4 )
if( ( ( char * ) bits )[ ul + 3 ] != 0 )
bAlpha = TRUE;
hb_xfree( bits );
ReleaseDC( GetDesktopWindow(), hDC );
hb_retl( bAlpha );
}
#pragma ENDDUMP
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 95 guests