Extension Modules > DLLC

FreeImage with DLLC

(1/1)

Support:
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)


--- Code: OxygenBasic ---' 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  =  0CONST FIF_JPEG =  2CONST FIF_PNG  = 13CONST FIF_GIF  = 25CONST 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:
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.

Navigation

[0] Message Index

Go to full version