How to display TIF picture ?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: How to display TIF picture ?

Post by Ricci »

gfilatov wrote: I have a working demo application compiled by HMG Extended Edition which is included in archive.
Is it works for you :?:
Yes, your EXE is working
User avatar
gfilatov
Posts: 1067
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: How to display TIF picture ?

Post by gfilatov »

Ricci wrote:
gfilatov wrote:[
and also you'll need freeimage.lib was taken from freeimage.dll contribution.

I have a working demo application compiled by HMG Extended Edition which is included in archive.
Is it works for you :?:
Where do i have to put the Lib to? Because i get this error log (only the beginning and end

Harbour 2.0.0beta3 (Rev. 12765)
Copyright (c) 1999-2009, http://www.harbour-project.org/
D:/hmg/harbour/lib/libhbfimage.a(fi_wrp.o):fi_wrp.c:(.text+0x17f): undefined reference to `_imp__FreeImage_Paste@20'
D:/hmg/harbour/lib/libhbfimage.a(fi_wrp.o):fi_wrp.c:(.text+0x31f): undefined reference to `_imp__FreeImage_Copy@20'
...
D:/hmg/harbour/lib/libhbfimage.a(fi_winfu.o):fi_winfu.c:(.text+0x4c2): undefined reference to `_imp__FreeImage_GetBits@4'
D:/hmg/harbour/lib/libhbfimage.a(fi_winfu.o):fi_winfu.c:(.text+0x4d0): undefined reference to `_imp__FreeImage_GetInfoHeader@4'
collect2: ld returned 1 exit status
hbmk2: Error: Running linker. 1
gcc.exe test.o hbmk_j37rn7.o D:/hmg//resources/minigui.o -mwindows -Wl,--start-group -lminigui -lhbmysql -lmysql -lcrypt -ledit -leditex -lgraph -lini -lreport -lhbwin -lhbziparc -lhbmzip -lmsvfw32 -lvfw32 -lsddodbc -lrddsql -lsddmy -lhbodbc -lodbc32 -lhbhpdf -lhbvpdf -lhbmemio -lhbsqlit3 -lsqlite3 -lhbfimage -lhbpgsql -lpq -lhbtip -lhbct -lhbmisc -lhbnetio -lxhb -lhbextern -lhbdebug -lhbvm -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib -Wl,--end-group -otest.exe -LD:/hmg/harbour/lib -LD:/hmg//lib
Ricci,

I've adapted this sample for HMG 3.0 already.
Take a look for attached working demo with project files and needed library ;)
Attachments
FREEVIEWDEMO.ZIP
Demo for HMG 3.0 test XII
(1.77 MiB) Downloaded 442 times
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: How to display TIF picture ?

Post by Ricci »

gfilatov wrote: Ricci,
I've adapted this sample for HMG 3.0 already.
Take a look for attached working demo with project files and needed library ;)
Grigory, thank you so much ... now it´s my time to implement it in my program. You will get it message, when it´s ready for viewing.

Ricci
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: How to display TIF picture ?

Post by Ricci »

gfilatov wrote: I've adapted this sample for HMG 3.0 already.
Take a look for attached working demo with project files and needed library ;)
Hi, Grigory !

Well it works in my program, a lot of work to do ....

One question: you use the function FI_WinDraw( ) to draw the loaded grafic.

Is there any documentation about this function or others i may need ?

For example: how will i clear the screen area of the picture before i display the next ?


Thanks for your help ... Ricci
User avatar
gfilatov
Posts: 1067
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: How to display TIF picture ?

Post by gfilatov »

Ricci wrote: One question: you use the function FI_WinDraw( ) to draw the loaded grafic.

Is there any documentation about this function or others i may need ?

Thanks for your help ...
Ricci,

I guess that the documentation is absent. :?
There is a self-documented source code only (look at below) ;)

Code: Select all

* -------------------------------------------------------------------------- */
/* Draw an image in a window Box -------------------------------------------- */
/* -------------------------------------------------------------------------- */

/* implementation: int scanlines = FI_WinDraw( FIBITMAP *dib, HDC hDC, nTop, nLeft, nBottom, nRight ); */
HB_FUNC( FI_WINDRAW )
{
   if( hb_pcount() == 6 &&
       hb_parinfo( 1 ) & HB_IT_POINTER &&
       hb_parinfo( 2 ) & HB_IT_NUMERIC &&
       hb_parinfo( 3 ) & HB_IT_NUMERIC &&
       hb_parinfo( 4 ) & HB_IT_NUMERIC &&
       hb_parinfo( 5 ) & HB_IT_NUMERIC &&
       hb_parinfo( 6 ) & HB_IT_NUMERIC
     )
   {
      FIBITMAP * dib;
      HDC hDC;
      RECT rcDest;
      int scanlines;

      /* Retrieve parameters */
      dib  = ( FIBITMAP * ) hb_parptr( 1 );
      hDC  = HB_ISNUM( 2 ) ? ( HDC ) ( HB_PTRUINT ) hb_parnint( 2 ) : ( HDC ) hb_parptr( 2 );
      rcDest.top    = hb_parni( 3 );
      rcDest.left   = hb_parni( 4 );
      rcDest.bottom = hb_parni( 5 );
      rcDest.right  = hb_parni( 6 );

      /* run function */
      SetStretchBltMode( hDC, COLORONCOLOR );

      scanlines = StretchDIBits(hDC, rcDest.left,
                                     rcDest.top,
                                     rcDest.right-rcDest.left,
                                     rcDest.bottom-rcDest.top,
                                     0, 0, FreeImage_GetWidth(dib), FreeImage_GetHeight(dib),
                                     FreeImage_GetBits(dib), FreeImage_GetInfo(dib),
                                     DIB_RGB_COLORS, SRCCOPY);

      /* return value */
      hb_retni( scanlines );
   }
   else
   {
      /* Parameter error */
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
         HB_ERR_FUNCNAME, 6,
         hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ),
         hb_paramError( 4 ), hb_paramError( 5 ), hb_paramError( 6 ) );
   }
}

Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: How to display TIF picture ?

Post by Ricci »

gfilatov wrote:
Ricci wrote: One question: you use the function FI_WinDraw( ) to draw the loaded grafic.

Is there any documentation about this function or others i may need ?

Thanks for your help ...
Ricci,

I guess that the documentation is absent. :?
Does that mean we have a nice "libhbfimage.a" but no one knows how to use it anymore :?:
I cannot believe it.
User avatar
gfilatov
Posts: 1067
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: How to display TIF picture ?

Post by gfilatov »

Ricci wrote:
gfilatov wrote:
Ricci wrote: One question: you use the function FI_WinDraw( ) to draw the loaded grafic.

Is there any documentation about this function or others i may need ?

Thanks for your help ...
Ricci,

I guess that the documentation is absent. :?
Does that mean we have a nice "libhbfimage.a" but no one knows how to use it anymore :?:
I cannot believe it.
One clarification: you have a FreeImage Documentation at
http://downloads.sourceforge.net/freeim ... ge3130.pdf
:idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: How to display TIF picture ?

Post by Ricci »

gfilatov wrote:One clarification: you have a FreeImage Documentation at
http://downloads.sourceforge.net/freeim ... ge3130.pdf
:idea:
Grigory,

I found out that only some functions a accessible through the libhbfimage.a .

:?: I wanted to clear the part of the window where the picture is displayed while browsing before the next one. Because when they don´t have the same size, they overlap.

I tried some of the functions in the documentation but most of them are not accessible, some need special data structures that are not implemented in HMG:
- FI_AllocateExT would be great, creating a bitmap, filling it with a color and then show it to overwrite the last picture. After that load the next picture and display it. But .. no way.
- I can use FI_Allocate and getting a bitmap filled black, but FI_FillBackground after that does not exist.

But the rest works very well ... only a little thing to finish :)

Enough for today
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: How to display TIF picture ?

Post by Roberto Lopez »

gfilatov wrote: I've adapted this sample for HMG 3.0 already.
Take a look for attached working demo with project files and needed library ;)
Nice sample. Thanks Grigory!
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: How to display TIF picture ?

Post by Roberto Lopez »

gfilatov wrote: I've adapted this sample for HMG 3.0 already.
Take a look for attached working demo with project files and needed library ;)
I'm asking your permission to include this sample in the next HMG test build.

TIA.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply