forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

v0.20 Bugs

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Thu Jun 08, 2006 7:54 am    Post subject: v0.20 Bugs Reply with quote

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
View user's profile Send private message
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Thu Jun 08, 2006 7:04 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Thu Jun 08, 2006 11:58 pm    Post subject: Re: v0.20 Bugs Reply with quote

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
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Fri Jun 09, 2006 4:51 am    Post subject: Reply with quote

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
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Fri Jun 09, 2006 5:11 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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