FBImage static Win/Lin 32/64-bit

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by D.J.Peters »

Why you put it in the FreeBASIC folder ?

Put the include file and *.dll or *.so in ther folder of your application thats all.

Joshy
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by leopardpm »

D.J.Peters wrote:Why you put it in the FreeBASIC folder ?

Put the include file and *.dll or *.so in ther folder of your application thats all.

Joshy
so, if I have a folder - lets call it a project folder, that I keep all my associated images in along with my .BAS file, it is in this folder I should put these additional files into?

FBImage.bi
FBImage-64.dll
libFBImage-64.so


(I am using windows 10 / 64 bit...so I choose the 64 bit versions, right?)

which means that if I have ANOTHER project, in a different folder, I have to copy these 3 files into that folder as well, and to EVERY folder that I want to use this library? I will end up with FBimage files all over my puter! or am I missing something here?
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by MrSwiss »

@leopardpm,

there is a big difference, between DLL's and static LIB:
DLL's always have to be accessible to the Program, that uses them.
That means usually, in the Folder the executable is located.
Alternative: set a Path, to the DLL's, #LibPath Statement ... before DyLibLoad.

Static Lib:
Is compiled *into* the executable. So, after compilation no *external* files are
needed at all. (My reason, to prefer Static, over Dynamic, aka: DLL Hell.)
Static Lib's are usually in FBC SubFolder /lib/[OS]. The needed BI's are in /inc.
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by leopardpm »

thank you, Mr. Swiss - and I am with you... go the static lib way if possible

so, I only need two files and need to put them into the following places:

put into the FB /lib/[OS] folder:
libFBImage-64.so

put into the FB /inc folder:
FBImage.bi

disregard the file:
FBImage-64.dll

and any program I create anywhere on my HD needs to have these statements:
#include once "FBImage.bi"

right?
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by caseih »

Are you on Linux or Windows? The .so file can be installed to /usr/local/lib on linux. The dll on windows should just be bundled with your compiled EXE. If you want to ship the .so file with your compiled binary on linux, you can do that but you will likely need a wrapper script to set LD_LIBRARY_PATH (firefox does this, for example).

Static libraries make distribution easy, but dynamic libraries are easier to update without a recompile sometimes.
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by leopardpm »

I am in windows, and I what to do static libs, not DLLs... sometimes I send my EXEs to friends and its easier than having to include DLLs each time...
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by caseih »

Okay you'll need to ignore the .so file then. That's for Linux.
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by leopardpm »

thank you
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by D.J.Peters »

removed: all dynamic libs
added: SavePNGFile()

Joshy

file: test_save_rgb_png.bas

Code: Select all

#include once "FBImage.bi"
chdir exepath()
screenres 640,480,24
var img = LoadRGBAFile("tire.jpg")
put (0,0),img,pset

var ok = SavePNGFile(img,"test_rgb.png")  ' ignore Alpha channel (if any)
windowtitle "SavePNGile() = " & ok
sleep
file: test_save_rgba_png.bas

Code: Select all

#include once "FBImage.bi"
chdir exepath()
screenres 640,480,32
var img = LoadRGBAFile("lights_alpha.png")
put (0,0),img,ALPHA

var ok = SavePNGFile(img,"test_rgba.png",true) ' true = RGB + Alpha channel
windowtitle "SavePNGFile() = " & ok
sleep
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by D.J.Peters »

I have no time to test it on all platforms would be cool if i can get a report of your experiments with the new FBImage lib.

Thank you

Joshy
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by D.J.Peters »

No one can give me a report ?

Shame on you. :-)

Joshy
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by leopardpm »

haven't had time to download and try.... will do it this evening, Mr Peters!
dkr
Posts: 40
Joined: Nov 20, 2015 15:17
Location: Alabama, USA

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by dkr »

Mr. Peters,
I downloaded your FBImage library and it worked perfectly. I am using Windows 7 64bit and Freebasic 32bit.

I also use your FLTK libraries. Your hard work is appreciated.

Thanks,
Darren
jdebord
Posts: 547
Joined: May 27, 2005 6:20
Location: Limoges, France
Contact:

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by jdebord »

Here is a little function to save the graphic screen (I hope it is correct...)

Code: Select all

#include once "FBImage.bi"

function savescreen(filename as string) as boolean
  dim as integer w, h
  dim as boolean ok
  screeninfo w, h
  var img = imagecreate(w, h)
  get (0,0)-(w-1, h-1), img 
  ok = SavePNGFile(img, filename, true)
  imagedestroy img
  return ok
end function  
    

dim as integer w, h

chdir exepath()

screenres 640,480,32

' Transparent background
line (0, 0)-(639, 479), &h00FF0000, bf

' Opaque disk
circle (320, 240), 150, &hFF0000FF, , , , f

windowtitle "SaveScreen = " & cbool(savescreen("save_screen_rgba.png"))

sleep
Imortis
Moderator
Posts: 1923
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Library FBImage for Windows/Linux 32/64-bit.

Post by Imortis »

D.J.Peters wrote:I have no time to test it on all platforms would be cool if i can get a report of your experiments with the new FBImage lib.

Thank you

Joshy

I have tested on Windows 7 64bit. with both the 32 and 64 bit compilers. It works fine here. I can try on Windows 10 before too long and will get back to you.
Post Reply