v0.20 Bugs

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

v0.20 Bugs

Post by romero126 »

Printing screen to an image

Code: Select all

-- Pre Image
screen:clear(Color.new(0, 0, 0))
screen:print(0, 264, "I have text here", Color.new(255,255,255))
screen.waitVblankStart()
screen.flip()


-- Copy Preimage offset by 8 and place back down.
img = Image.createEmpty(480, 272)		-- Create image
img:clear(Color.new(0, 0, 0))			-- Clean image
img:blit(0, 0, screen, 0, 8, 480, 272, true)	-- Copy screen
screen:clear(Color.new(0, 0, 0))		-- Clear screen
screen:blit(0, 0, img, 0, 0, 480, 272, true)	-- Blit image
screen.waitVblankStart()
screen.flip()					-- Display
The error is the img is being cleared when I clear the screen.
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

sorry to nag... why would someone do this?

o) you can create a copy of your backbuffer (which is what should be on screen...)
o) if you mean png file with ... image then just do a screenshot...
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Re: v0.20 Bugs

Post by Shine »

I didn't tried it, but looks like you are copying the wrong screen. There are 2 screens: the visible screen and the backbuffer. Copying from screen to image uses the backbuffer. Let me know, if you have still the error when copying the backbuffer, then I'll check it on my PSP.
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

Actually i tried the other screen as well by using screen.flip() before the copying even starts and it still doesnt copy.
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

Do you have some non-working example? I've removed your screen.flip and this works with Lua Player 0.20:

Code: Select all

screen:clear(Color.new(0, 0, 0)) 
screen:print(0, 264, "I have text here", Color.new(255,255,255)) 
img = Image.createEmpty(480, 272)
img:clear(Color.new(0, 0, 0))
img:blit(0, 0, screen, 0, 8, 480, 272, true)
screen:clear(Color.new(0, 0, 0))
screen:blit(0, 0, img, 0, 0, 480, 272, true)
screen.waitVblankStart()
screen.flip()

while true do
	screen.waitVblankStart()
	if Controls.read():start() then break end
end
But it may be better to use an offscreen image, because then you don't have to think about what to copy from and to screen and which problems with flip can occur, if you don't manage on-screen and off-screen the right way.
Post Reply