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.
fxm
Moderator
Posts: 12351
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: FBImage static Win/Lin 32/64-bit

Post by fxm »

Instead, it would be best if dpitch would be declared as LONG.
D.J.Peters
Posts: 8609
Joined: May 28, 2005 3:28
Contact:

Re: FBImage static Win/Lin 32/64-bit

Post by D.J.Peters »

fxm wrote:Instead, it would be best if dpitch would be declared as LONG.
no don't mix native integer with long :-(

Joshy
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: FBImage static Win/Lin 32/64-bit

Post by MrSwiss »

D.J.Peters wrote:no don't mix native integer with long :-(
Then you'll have to stick with FBC <= 1.07.3.

From version 1.08.0 it's either LONG or LONGINT as per "ScreenInfo/ImageInfo" in the Doc's. ;-)
fxm
Moderator
Posts: 12351
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: FBImage static Win/Lin 32/64-bit

Post by fxm »

and also "ScreeenControl".
ShawnLG
Posts: 142
Joined: Dec 25, 2008 20:21

Re: FBImage static Win/Lin 32/64-bit

Post by ShawnLG »

How come this library is not included with the FB distribution? Or better yet, built into the FB graphics library? It's too useful not to have it available.
paul doe
Moderator
Posts: 1796
Joined: Jul 25, 2017 17:22
Location: Argentina
Contact:

Re: FBImage static Win/Lin 32/64-bit

Post by paul doe »

ShawnLG wrote: Mar 17, 2022 16:40 How come this library is not included with the FB distribution? Or better yet, built into the FB graphics library? It's too useful not to have it available.
We are working on that. This one, FbSound, and a couple others. The next release will probably have them all included as static libraries.
VANYA
Posts: 1841
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBImage static Win/Lin 32/64-bit

Post by VANYA »

paul doe wrote: Mar 17, 2022 17:18 We are working on that. This one, FbSound, and a couple others. The next release will probably have them all included as static libraries.
It's a good news!
D.J.Peters
Posts: 8609
Joined: May 28, 2005 3:28
Contact:

Re: FBImage static Win/Lin 32/64-bit

Post by D.J.Peters »

For a fun project I needed writing retro RGB and RGBA TGA files so I added it to FBImage.
(see first post for download)

Joshy

Code: Select all

function SaveTGAFile(byval img as any ptr, byval filename as const zstring ptr, byval saveAlpha as boolean) as boolean
sorex
Posts: 16
Joined: Jul 11, 2006 12:04

Re: FBImage static Win/Lin 32/64-bit

Post by sorex »

Hello,

I tried to save an 8 bit gfx buffer (indexed pallete) with your library.

But for some reason the palette is geting trashed.

When looking at the png details with Irfanview (press i) I see it's using zip + grayscale compression.

Is there a way to get this working?

Code: Select all

#INCLUDE "vbcompat.bi"
#include "fbgfx.bi"
#include once "FBImage.bi"

sub setpalette
	dim as string rgbval
	dim as integer r,g,b
	dim as string pal(0 to 15)={"000000","FFFFFF","68372B","70A4B2","6F3D86","588D43","352879","B8C76F","6F4F25","433900","9A6759","444444","6C6C6C","9AD284","6C5EB5","959595"} 
	for v as integer=0 to 15
		rgbval=pal(v)
		r=val("&h" & mid(rgbval,1,2))
		g=val("&h" & mid(rgbval,3,2))
		b=val("&h" & mid(rgbval,5,2))
		palette v,r,g,b
	next
end sub

screenres(160,100,8)',,fb.GFX_NULL)
setpalette

Dim bitmap As Any Ptr = ImageCreate(160,10)
for x as integer=0 to 16-1
	Line bitmap,(x*10,0)-(x*10+9, 9), x, bf
	Line (x*10,0)-(x*10+9, 9), x, bf
next

bsave "test.bmp",bitmap
SavePNGFile(bitmap,"test.png") ' <- default save with alpha channel = false
imagedestroy bitmap

sleep
Post Reply