FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Funcion PrepareInfoHeader
Posts: 485
Joined: Fri Feb 09, 2007 10:34 AM
Funcion PrepareInfoHeader
Posted: Thu May 19, 2011 11:25 AM

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 &lt; bm.bmHeight; ++j )
{
   LPBYTE pbDestRGB = ( LPBYTE )&amp;( ( DWORD * ) lpDesBits )[ j * bm.bmWidth ];
   LPBYTE pbSrcRGB  = ( LPBYTE )&amp;( ( DWORD * ) lpSrcBits  )[ j * bm.bmWidth ];

   for( i = 0; i &lt; 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

Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Funcion PrepareInfoHeader
Posted: Thu May 19, 2011 11:52 AM
Saludos

es una funcion interna de fivewin... te dejo el codigo
Code (fw): Select all Collapse
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;
}
Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Re: Funcion PrepareInfoHeader
Posted: Thu May 19, 2011 02:00 PM

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"
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Funcion PrepareInfoHeader
Posted: Thu May 19, 2011 02:58 PM

Carlos

preparame un ejemplo y gustosamente te ayudare a resolver el problema

Posts: 485
Joined: Fri Feb 09, 2007 10:34 AM
Re: Funcion PrepareInfoHeader
Posted: Thu May 19, 2011 03:41 PM

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.

Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Funcion PrepareInfoHeader
Posted: Thu May 19, 2011 03:43 PM

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

Posts: 485
Joined: Fri Feb 09, 2007 10:34 AM
Re: Funcion PrepareInfoHeader
Posted: Thu May 19, 2011 04:17 PM

Ya te he enviado un email. Gracias desde aquí.

Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Re: Funcion PrepareInfoHeader
Posted: Fri May 20, 2011 09:05 AM
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"

Continue the discussion