DSLua Community
Welcome, Guest. Please login or register.
May 21, 2012, 08:23:01 PM
1371 Posts in 262 Topics by 33109 Members
Latest Member: Limewire Download
DSLua Community  |  DSLua - Best scripting language for Nintendo DS  |  Need Help?  |  DSLua 0.7 Image Display « previous next »
Pages: [1]
Author Topic: DSLua 0.7 Image Display  (Read 1801 times)
sylus101
Waxing Crescent
**
Posts: 68



« on: June 19, 2007, 11:50:40 AM »

I'm having trouble with getting a JPG to display. At the moment, nothing happens...

Here's my code... and this is a 256 x 192 jpg.

Code:
carda = io.open("test.jpg", "rb")
cardb = carda.read("*all")
carda:close()

BGTop = Screen.Load16BitBG()

BGTop:Image.LoadJPG(1,cardb)

Screen.Initialize( 1, BGTop )

while Pads.Start() == false do

end
« Last Edit: June 19, 2007, 02:50:32 PM by sylus101 » Logged
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #1 on: June 19, 2007, 12:10:31 PM »

Everything's in the wrong order... and there's invalid syntax on more than one occasion. :3

Here's the code you want:

Code:
jpghandler = io.open("test.jpg","rb")
card = jpghandler:read("*all")
jpghandler:close()
BGTop = Screen.Load16BitBG()
Screen.Initialize(1,BGTop)
Image.LoadJPG(1,card)
while not Pads.Start() do end

Not quite sure where you got half of that syntax from, but that's how you load a jpeg.

However, a jpeg that's 256*193 will probably cause a memory overflow and turn the screen one color :3
Logged

Code:
-- Bored? Read code line below.
-- Bored? Read code line above.



^^ That works, I SWEAR! ^^
sylus101
Waxing Crescent
**
Posts: 68



« Reply #2 on: June 19, 2007, 02:50:06 PM »

Okay, I posted one of many attempts on the code, so I edited to the attempt that most closely resembles what was right, and edited what was meant to be 192 (of course...)  Wink

All in all, I'd say I was pretty close. With no experience other than tiled backgrounds, I figured initializing the screen was the last thing to do... so that only puts 1 thing out of order in incorrect syntax.
I took a complete stab in the dark with the BGTop:Image deal...

So there...  Wink

Thanks for the correct format dalton!

*EDIT*
Okay, that works, but only for the blink of an eye. The image shows up and becomes a blur almost immediately. I tried a bmp instead, but nothing happens...
Here's the code for bmp, anything wrong?

Code:
cardh = io.open("test.bmp", "rb")
card = cardh:read("*all")
cardh:close()

BGTop = Screen.Load16BitBG()

Screen.Initialize( 1, BGTop )

Image.LoadBMP(1,0,0,card)

while Pads.Start() == false do

end
« Last Edit: June 19, 2007, 03:04:49 PM by sylus101 » Logged
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #3 on: June 19, 2007, 05:29:25 PM »

That's what I meant when I said 'memory overflow'...

The DS only has ~128kb for images per screen.

Any uncompressed bitmap, jpeg, or gif that's 256*192 would uncompress to ~160...

Therefore, we have a problem.

I'm gonna check the source, maybe there's something I can do about this.
Logged

Code:
-- Bored? Read code line below.
-- Bored? Read code line above.



^^ That works, I SWEAR! ^^
Jeremysr
First Quarter
***
Posts: 215



WWW
« Reply #4 on: June 19, 2007, 06:17:05 PM »

That's what I meant when I said 'memory overflow'...

The DS only has ~128kb for images per screen.

Any uncompressed bitmap, jpeg, or gif that's 256*192 would uncompress to ~160...

Therefore, we have a problem.

I'm gonna check the source, maybe there's something I can do about this.

The image isn't stored like other backgrounds, so there's no limit like that. The image is stored in a variable, and then a 16-bit background.
Logged
sylus101
Waxing Crescent
**
Posts: 68



« Reply #5 on: June 19, 2007, 06:29:17 PM »

Ended up trying GIF with pretty much same result as the JPG. The BMP (still not sure why nothing came up at all) is only 256 colors and 50kb. Isn't BMP an uncompressed format?

Anyway, the image looks great.... for a split second.

EDIT... Smaller images appear fine. I haven't got an exact size that starts to mess up, but a 128 by 128 jpg looks fine. A 192 by 192 glitched out. 184 x 184 Glitched out... 160 x 160 appeared fine.
« Last Edit: June 19, 2007, 09:04:49 PM by sylus101 » Logged
suloku
New Moon
*
Posts: 8


« Reply #6 on: June 20, 2007, 05:04:45 AM »

Seems a lot like a memory problem.

I'm glad I dind't change my backgrounds to normal bmp files, I would be having this trouble now :S
Logged
Pages: [1]
« previous next »
    Jump to: