depreciated command [imageinfo] - ?

General FreeBASIC programming questions.
Post Reply
kiyotewolf
Posts: 1009
Joined: Oct 11, 2008 7:42
Location: ABQ, NM
Contact:

depreciated command [imageinfo] - ?

Post by kiyotewolf »

I've got this snippet of code..

And ..

Code: Select all

#include once "fbgfx.bi"
sub ImageScale2X(byref buffer as FB.Image ptr)

'scale2x
'  A    --\ 1 2
'C P B  --/ 3 4
'  D 
'1=P; 2=P; 3=P; 4=P;
'IF C==A AND C!=D AND A!=B => 1=A
'IF A==B AND A!=C AND B!=D => 2=B
'IF B==D AND B!=A AND D!=C => 4=D
'IF D==C AND D!=B AND C!=A => 3=C

   dim as integer x,y
   dim as uinteger A,B,C,D,P
   imageinfo buffer,x,y
    dim buffer2 as FB.Image ptr=imagecreate(x*2,y*2,,32)
I was using the help menu, and can't find "imageinfo".. unless maybe my help file is out of date.

Is this a depreciated command, or is it just something my help file neglects to include?



~Paul
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: depreciated command [imageinfo] - ?

Post by dodicat »

It's in the chm help file for fb23
extract:

Code: Select all

 
Usage

result = ImageInfo( image [, [width] [, [height] [, [bypp] [, [pitch] [, [pixdata] [, size]]]]]] )


Parameters

image

The address of the image.

width

Stores the width of the image, in pixels.

height

Stores the height of the image, in pixels.

bypp

Stores the bytes per pixel of the image - i.e. the size of a single pixel, in bytes.

pitch

Stores the pitch of the image - i.e. the size of each scanline (row), in bytes. Note that this may be more than just width * bypp, because the scanlines may be padded to allow them to be aligned better in memory.

pixdata

Stores the address of the start of the first scanline of the image.

size

Stores the size of the image in memory, in bytes.

 
kiyotewolf
Posts: 1009
Joined: Oct 11, 2008 7:42
Location: ABQ, NM
Contact:

Re: depreciated command [imageinfo] - ?

Post by kiyotewolf »

Where can I get the most recent help file?



~Paul
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Re: depreciated command [imageinfo] - ?

Post by Merick »

It's still in there, but you can get the image info directly from the image ptr like this:

buffer->width
buffer->height
buffer->bpp
buffer->pitch


if you go into fbgfx.bi and un-comment lines 161, 166,167,168 you can get direct access to the image data like this

dim a as ubyte ptr
a = buffer
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: depreciated command [imageinfo] - ?

Post by fxm »

kiyotewolf wrote:I was using the help menu, and can't find "imageinfo".. unless maybe my help file is out of date.
Indeed!
"ImageInfo" appeared in the chm help file in 2008/04/15, corresponding to fbc 0.18.4 revision!
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Re: depreciated command [imageinfo] - ?

Post by Merick »

Eh, posted without testing yesterday. Un-commenting those lines should let you get a pointer to the pixel data, but when I tried it just now, FB gave me an error:

FbTemp.bas(162) error 20: Expected 'END TYPE' or 'END UNION', found 'type' in 'end type'
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: depreciated command [imageinfo] - ?

Post by fxm »

Merick wrote:Eh, posted without testing yesterday. Un-commenting those lines should let you get a pointer to the pixel data, but when I tried it just now, FB gave me an error:

FbTemp.bas(162) error 20: Expected 'END TYPE' or 'END UNION', found 'type' in 'end type'
Because fields cannot be named as keywords in TYPE's that contain member procedures.
This error kind (field 'type' + property in this case) is not always well detected!
Last edited by fxm on Apr 20, 2012 12:09, edited 2 times in total.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: depreciated command [imageinfo] - ?

Post by fxm »

fxm wrote:
Merick wrote:Eh, posted without testing yesterday. Un-commenting those lines should let you get a pointer to the pixel data, but when I tried it just now, FB gave me an error:

FbTemp.bas(162) error 20: Expected 'END TYPE' or 'END UNION', found 'type' in 'end type'
Because fields cannot be named as keywords in TYPE's that contain member procedures.
This error kind (field 'type' + property in this case) is not always well detected!
See this old topic:
bug with "type" as a variable name in a UDT
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: depreciated command [imageinfo] - ?

Post by counting_pine »

I would suggest using ImageInfo regardless, because it's not dependent on the image structure.
For up-to-date FB information, you can always go to www.freebasic.net/wiki
The ImageInfo page is at www.freebasic.net/wiki/keypgImageInfo
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Re: depreciated command [imageinfo] - ?

Post by Merick »

I just removed the union for the old style headers, and it's not a problem anymore.

I do see one reason to use imageinfo though, the header doesn't have a member for the byte size of the image data.
Post Reply