Quote:it was on the FB IRC channel, so all the text of conversations is gone....
dammit. i knew it. i even looked around for a chat room. i think i found it. but no one was there or somthin'.
completely unrelated: does anyone know a good tut for uploading BMP into fb? thanks
thanks. but you must keep this in mind:
-------
-------
---o--- <- average
-------
-------
-------
-------
---o--- <- me
---o--- <- mongoloid.
--------
i'm not kidding you guys when i say i suck at programming!
when i learn a new tid-bit of info i scourer away and fiddle around with it like some sort of mad scientist. ok so where do i start?
'Load a graphic to current work page
Screen 18, 32
Cls
Bload "picture.bmp" where do i keep the picture? what file? what if the picture came in a download?
'Load a 48x48 bitmap into an array
Screen 18, 32
Dim garray(4 * (48 * 48 ) + 4) As Byte why *4? and + 4? and why as byte?
Bload "picture.bmp", @garray(0) what's with the @ and the (0)
Put (10,10),garray(0)
see, the thing about these tuts is that the author just assumes that the reader has some prior knowledge and is not a dumbass.
Explanation to 4*(w*h)+4:
"4*" is because in 32 bit, each pixel takes 4 bytes (rgba I guess) and
"+4" is to make room for storing w and h in the array so it get's read correctly. (I guess it's stored as two two byte integers)
Quote:Bload "picture.bmp" where do i keep the picture? what file? what if the picture came in a download?
This is similar to Open in QB, it looks for the file in the current directory, which will normally be the same as the program.
Quote:Dim garray(4 * (48 * 48 ) + 4) As Byte why *4? and + 4? and why as byte?
*4 Is because each pixel takes 4 bytes to store in a 32bit mode, as red, green, blue and alpha bytes.
+4 is because there is a header on GET/PUT arrays of 4 bytes, that stores the images width, height and bytes per pixel.
Quote:Bload "picture.bmp", @garray(0) what's with the @ and the (0)
@garray(0) means the address of garray(0), this is basically telling it to bload to the start of garray.
so the 4* and the +4 are always the same?
i tryed this:
Code:
Cls
Bload "picture.bmp"
'Load a 48x48 bitmap into an array
Screenres 1024,768,32,2,1
Dim garray(4 * (50 * 50) + 4) As Byte
Bload "picture.bmp", @garray(0)
Put (10,10),garray(0)
sleep
i put a picture called "picture.bmp" which is 50 * 50 into C:\FreeBASIC
all i got was a black screen.
n/m it worked. i renamed "picture.bmp" to "picture"
silly me. :roll:
ok it's not working again. and all i did was save the bas of it
Code:
'Load a graphic to current work page
'Screenres 1024,768,32,2,1
Cls
Bload "picture.bmp"
'Load a 48x48 bitmap into an array
Screenres 1024,768,32,2,1
Dim garray(4 * (32 * 32) + 4) As Byte
Bload "picture.bmp", @garray(0)
Put (0,0),garray(0)
sleep
for y = 0 to 767
for x = 0 to 1023
a = point(x,y)
r = int(a/65536)
a = a - r * 65536s
g = int(a/256)
a = a - g * 256
b = a
a = int((r+b+g)/3)
pset (x,y),rgb(0,g,0)
next
next
sleep
i made sure and x & y were correct. and the picture was called "picture" and in C:\FreeBASIC
wtf happened?
On this, can I use the same loading technique to store two or more images in the same array such as follows:
BLOAD image.ext to array$(0)
BLOAD image2.ext to array$(4*(640*480)+4)
? possible?