Funcion PrepareInfoHeader

Post Reply
softruz
Posts: 485
Joined: Fri Feb 09, 2007 10:34 am

Funcion PrepareInfoHeader

Post by softruz »

Muy buenas, alguien me sabria decir donde puedo encontrar la funcion PrepareInfoHeader al compilar este ejemplo me da error de no encontrar dicha funcion:


#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

BITMAPINFOHEADER PrepareInfoHeader( WORD, WORD );


HBITMAP FWWaterMark( HBITMAP hbm )
{
BITMAPINFOHEADER bmiS, bmiD;
LPBITMAPINFOHEADER lpSrcBits, lpDesBits;
DWORD dwSizeScr;
HANDLE hDibSrc;
HDC dc, dcDes;
BITMAP bm;
HBITMAP hbmDes, hbmOldDes;
INT j,i;

GetObject( hbm, sizeof( BITMAP ), &bm );

// source
bmiS = PrepareInfoHeader( ( WORD ) bm.bmWidth, ( WORD ) bm.bmHeight );

dwSizeScr = ( ( bm.bmWidth * bmiS.biBitCount + 31 ) / 32 ) * 4 * bm.bmHeight;

hDibSrc = GlobalAlloc( GHND, dwSizeScr + sizeof( BITMAPINFOHEADER ) );
lpSrcBits = ( LPBITMAPINFOHEADER )GlobalLock( hDibSrc );
*lpSrcBits = bmiS;


dc = GetDC ((HWND) NULL);

GetDIBits( dc, hbm, 0,
( UINT ) bm.bmHeight,
lpSrcBits,
( LPBITMAPINFO )lpSrcBits, DIB_RGB_COLORS);

dcDes = CreateCompatibleDC( NULL );
bmiD = PrepareInfoHeader( ( WORD ) bm.bmWidth, ( WORD ) bm.bmHeight );

hbmDes = CreateDIBSection ( dc, ( LPBITMAPINFO )&bmiD,
DIB_RGB_COLORS, ( void ** )&lpDesBits, 0, 0 );

hbmOldDes = SelectObject( dcDes, hbmDes );

for( j = 0; j < bm.bmHeight; ++j )
{
LPBYTE pbDestRGB = ( LPBYTE )&( ( DWORD * ) lpDesBits )[ j * bm.bmWidth ];
LPBYTE pbSrcRGB = ( LPBYTE )&( ( DWORD * ) lpSrcBits )[ j * bm.bmWidth ];

for( i = 0; i < bm.bmWidth; ++i )
{
pbDestRGB[ 0 ] = pbSrcRGB[ 0 ];
pbDestRGB[ 1 ] = pbSrcRGB[ 1 ];
pbDestRGB[ 2 ] = pbSrcRGB[ 2 ];
pbDestRGB[ 3 ] = 255;
pbDestRGB += 4;
pbSrcRGB += 4;

}
}

SelectObject( dcDes, hbmOldDes );

GlobalUnlock( hDibSrc );
GlobalFree( hDibSrc );

DeleteDC( dcDes );
DeleteObject( hDibSrc );
ReleaseDC ((HWND) NULL, dc);

return hbmDes;
}

HB_FUNC( FWWATERMARK )
{
hb_retnl( ( LONG ) FWWaterMark( ( HBITMAP ) hb_parnl( 1 ) ) ) ;
}
#pragma ENDDUMP
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Funcion PrepareInfoHeader

Post by Daniel Garcia-Gil »

Saludos

es una funcion interna de fivewin... te dejo el codigo

Code: Select all | Expand


BITMAPINFOHEADER PrepareInfoHeader( WORD wWidth, WORD wHeight )
{
   BITMAPINFOHEADER bmi;
   bmi.biSize          = sizeof( BITMAPINFOHEADER );
   bmi.biWidth         = wWidth;
   bmi.biHeight        = wHeight;
   bmi.biPlanes        = 1;
   bmi.biBitCount      = 32;
   bmi.biCompression   = BI_RGB;  
   bmi.biSizeImage     = 0;
   bmi.biXPelsPerMeter = 0;
   bmi.biYPelsPerMeter = 0;
   bmi.biClrUsed       = 0;          
   bmi.biClrImportant  = 0;
   return bmi;
}
 
 
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Carlos Mora
Posts: 989
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Funcion PrepareInfoHeader

Post by Carlos Mora »

Hola Daniel,

como dice en tu firma 'our best documentation is the source code'...
podrías pasarme algo de la funcion fixsays? Tengo un problema sin resolver desde hace un tiempo, me oculta los statics que no son says, y si tengo el codigo tal vez lo pueda corregir yo mismo.

Un saludo
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Funcion PrepareInfoHeader

Post by Daniel Garcia-Gil »

Carlos

preparame un ejemplo y gustosamente te ayudare a resolver el problema
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
softruz
Posts: 485
Joined: Fri Feb 09, 2007 10:34 am

Re: Funcion PrepareInfoHeader

Post by softruz »

Muchas gracias por todo Daniel, otra cosa sabrías decirme como puedo hacer que una imagen sea más transparente de arriba que de abajo, es decir, con degradados de transparencia en imagenes.

Un Saludo.
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Funcion PrepareInfoHeader

Post by Daniel Garcia-Gil »

Hola

se podria hacer la funcion en C q haga lo que deseas, puedes contactarme via email o msn

inicialmente deberia ser una imagen con AlphaChannel
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
softruz
Posts: 485
Joined: Fri Feb 09, 2007 10:34 am

Re: Funcion PrepareInfoHeader

Post by softruz »

Ya te he enviado un email. Gracias desde aquí.
Carlos Mora
Posts: 989
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Funcion PrepareInfoHeader

Post by Carlos Mora »

Hola Daniel,
Daniel Garcia-Gil wrote:
preparame un ejemplo y gustosamente te ayudare a resolver el problema


viewtopic.php?f=6&t=21486

Tiene la información y el ejemplo, con las imágenes. Hasta donde pude llegar, lo que hace la diferencia es la llamada a la función FixSays, que deduzco que inhibe a todos los STATICS para que no pinten el fondo, y supongo que eso me genera el problema con los STATICS que no son SAYS.

Creo que en el post está todo, pero si falta algo lo pongo en cuanto me digas.

Un saludo
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Post Reply