 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Thu Jun 08, 2006 7:54 am Post subject: v0.20 Bugs |
|
|
Printing screen to an image
| Code: | -- 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. |
|
| Back to top |
|
 |
LuMo
Joined: 21 Aug 2005 Posts: 410 Location: Austria
|
Posted: Thu Jun 08, 2006 7:04 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Thu Jun 08, 2006 11:58 pm Post subject: Re: v0.20 Bugs |
|
|
| 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. |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Fri Jun 09, 2006 4:51 am Post subject: |
|
|
| Actually i tried the other screen as well by using screen.flip() before the copying even starts and it still doesnt copy. |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Fri Jun 09, 2006 5:11 am Post subject: |
|
|
Do you have some non-working example? I've removed your screen.flip and this works with Lua Player 0.20:
| Code: |
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. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|