Possible to use Graphic-Functions defined in FREEIMAGE.dll ?

Possible to use Graphic-Functions defined in FREEIMAGE.dll ?

Postby ukoenig » Fri Nov 14, 2008 7:47 pm

Hello,

I want to add some special functions to the ImageViewer
like saving a resized image and convert to a different graphic-format.
Is it possible, to use functions defined in FREEIMAGE.dll ?

Maybe anybody knows a working 3.party-graphic-library to use with FWH ?

A freeimage-sample from the doc-file :

FreeImage_Clone
----------------------
DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib);

Makes an exact reproduction of an existing bitmap, including metadata and attached profile if any.

// this code assumes there is a bitmap loaded and
// present in a variable called ‘dib’

FIBITMAP *clone = FreeImage_Clone(dib);
if (clone) {// clone succeeded! FreeImage_Unload(clone)}

FreeImage_Unload
-----------------------
DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib);

Deletes a previously loaded FIBITMAP from memory.

The VB-functions :
---------------------

Public Declare Function FreeImage_Clone Lib "FreeImage.dll" Alias "_FreeImage_Clone@4" ( _ByVal dib As Long) As Long

Public Declare Sub FreeImage_Unload Lib "FreeImage.dll" Alias "_FreeImage_Unload@4" ( _ByVal dib As Long)

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby Adolfo » Fri Nov 14, 2008 11:44 pm

UWE.

Have you seen image.prg in FWH/Source/Classes folder

There you have some calls to FreeImage.dll

hope they help you.

From Chile
Adolfo
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
User avatar
Adolfo
 
Posts: 860
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Freeimage

Postby ukoenig » Fri Nov 14, 2008 11:50 pm

Adolfo,

Thank you very much for the information,
I had a look at the file Image.prg.
I think, it will help a lot as sample, to add more functions.
I tested the new version of FREEIMAGE.dll => 3110
it works without problems.

My first translation from VB ( i hope it works ) :
--------------------------------------------------------
DLL32 FUNCTION RESCALE( dib AS LONG, dst_width AS LONG, dst_height AS LONG, ;
Filter AS FREE_IMAGE_FILTER) AS LONG ;
PASCAL FROM "_FreeImage_Rescale@16" LIB hLib

Table 15: IMAGE_FILTER constants.
-----------------------------------------
Filter flag Description :
FILTER_BOX Box, pulse, Fourier window, 1st order (constant) B-Spline
FILTER_BILINEAR Bilinear filter
FILTER_BSPLINE 4th order (cubic) B-Spline
FILTER_BICUBIC Mitchell and Netravali's two-param cubic filter
FILTER_CATMULLROM Catmull-Rom spline, Overhauser spline
FILTER_LANCZOS3 Lanczos-windowed sinc filter

Visual-Basic :
---------------
Public Declare Function FreeImage_Rescale Lib "FreeImage.dll" Alias "_FreeImage_Rescale@16" ( _
ByVal dib As Long, _
ByVal dst_width As Long, _
ByVal dst_height As Long, _
ByVal Filter As FREE_IMAGE_FILTER) As Long


Greetings from Germany
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 87 guests