Author Topic: FreeImage with DLLC  (Read 14130 times)

Support

  • Administrator
  • *****
  • Posts: 1
    • View Profile
FreeImage with DLLC
« on: March 14, 2013, 04:52:29 am »
I converted one of my old FreeImage SB examples using GTK-Server to DLLC. I have attached a new DLLC that handles the weird FreeImage function names. (direct access without going through a wrapper)

' FreeImage Example

DECLARE SUB DLLC_File ALIAS "dllfile" LIB "DLLC"
DECLARE SUB DLLC_Proc ALIAS "dllproc" LIB "DLLC"
DECLARE SUB DLLC_Call ALIAS "dllcall" LIB "DLLC"

fih = DLLC_File("FreeImage.dll")

Version = DLLC_Proc(fih,"_FreeImage_GetVersion@0 z = ( )")
Copyright = DLLC_Proc(fih,"_FreeImage_GetCopyrightMessage@0 z = ( )")
LoadImage  = DLLC_Proc(fih,"_FreeImage_Load@12 i = (i fif, z filename, i flag)")
Width = DLLC_Proc(fih,"_FreeImage_GetWidth@4 i = (i dib)")
Height = DLLC_Proc(fih,"_FreeImage_GetHeight@4 i = (i dib)")
Rescale = DLLC_Proc(fih,"_FreeImage_Rescale@16 i = (i dib, i dst_width, i dst_height, i filter)")
Rotate = DLLC_Proc(fih,"_FreeImage_Rotate@16 i = (i dib, d angle, p bkcolor)")
Save = DLLC_Proc(fih,"_FreeImage_Save@16 b = (i fif, i dib, z fname, i flage)")

CONST FIF_BMP  =  0
CONST FIF_JPEG =  2
CONST FIF_PNG  = 13
CONST FIF_GIF  = 25
CONST FILTER_BICUBIC = 1

PRINT DLLC_Call(Version),"\n"
PRINT DLLC_Call(Copyright),"\n"
fbmp = DLLC_Call(LoadImage, FIF_JPEG, "world.jpg", 0)
PRINT "Width: ",DLLC_Call(Width, fbmp),"\n"
PRINT "Height: ",DLLC_Call(Height, fbmp),"\n"
fbmps = DLLC_Call(Rescale, fbmp, 100, 100, FILTER_BICUBIC)
DLLC_Call(Save, FIF_PNG, fbmps, "world_small.png", 0)
fbmpr = DLLC_Call(Rotate, fbmp, 180, 0)
DLLC_Call(Save, FIF_PNG, fbmpr, "world_flip.png", 0)
 
C:\SB22\test>scriba testfi.sb
3.15.4
This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
Width: 225
Height: 225
C:\SB22\test>

Original .jpg image


Rescaled and converted to .png


Flipped 180 degrees


Support

  • Administrator
  • *****
  • Posts: 1
    • View Profile
Re: FreeImage with DLLC
« Reply #1 on: March 19, 2013, 05:17:45 pm »
DLLC like the old DYC extension module is a Windows only solution. You can use GTK-Server for Linux as was done with the original version of this demo of FreeImage.