Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Loading images
#1
Hi!

Just starting playing with FB.

I read the sticked help, but i haven't found what i need.

How you can use image made with drawing programs (such as the almighty MS Paint Wink) ?

I see something for qb... But i thinked there was a specific command that load an image.


To make it simple:
There is a command that loads an image file (.bmp, gif, png...)?
I must use arrays?


Tanx!
othing to read...
Reply
#2
You can view .BMP files natively with the "bload" command.

Code:
Dim MySprite As Any Ptr
MySprite = ImageCreate(32, 32) ' or however big the image is
Bload "somesprite.bmp", MySprite
Put (0, 0), MySprite
Reply
#3
Jofers:

what if you don't know what the size of the picture is?
quote="whitetiger0990"]whitetiger is.. WHITE POWER!!! [/quote]
Here
Reply
#4
Code:
Dim o As Integer
o = FreeFile

Dim As Integer w, h

Open "test.bmp" For Binary As o

  Get #o, 19, w
  Get #o, , h
  
Close

? w
? h

Sleep
Reply
#5
Quote:You can view .BMP files natively with the "bload" command.

Code:
Dim MySprite As Any Ptr
MySprite = ImageCreate(32, 32) ' or however big the image is
Bload "somesprite.bmp", MySprite
Put (0, 0), MySprite

Great!


Hmm...I'm wrong, or you can use the same comand on QB?


And for other formats? Animated gifs in particular or jpg, but here i'm just curious.
Let's suppose we must program a really cool game, and that we must do it the smallest ever. This game will have, obviously, the most astoundig gfx effects and jaw-dropping images.
BMP is the most largest image format. Sure, nowadays size isn't really a big problem, with these 300+ Gbs HDs. But, i repeat, i'm curious, so, how you can load a jpg to use it in our awesome game? Tongue
othing to read...
Reply
#6
I don't believe either GIF or JPG is supported by the built-in BLOAD function. You'd either have to get something like FreeImage to work (1000101 ported the header for this library) or write your own loader.
\__/)
(='.'=) Copy bunny into your signature to
(")_(") help him gain world domination.
Reply
#7
BLoad was in QB, but it just loaded raw files (though it had a strange 7-byte header that I could never understand). BMP support was added by Lillo to GfxLib due to popular request. I believe it tries to load a bitmap if you specify a file that ends with ".bmp", but I'm not sure.

And yes, you'll have to use a library for compressed formats such as JPG and GIF.
Reply
#8
It is funny to see two of the gurus of the FB community just guessing...Big Grin
Antoni
Reply
#9
Who's guessing? I'm darn sure I don't know Smile

j/k. I just peaked the source and it does check the first couple bytes for a BMP header.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)