Screen image copy question

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

Moderators: Shine, Insert_witty_name

Post Reply
fullerlee
Posts: 54
Joined: Thu Nov 03, 2005 9:46 am

Screen image copy question

Post by fullerlee »

I'd like to cache the screen image so I don't have to generate it for each iteration.
All of my current screen drawing logic eventually draws to the screen image, and I'd rather not have to rewrite it.

I've tried doing this:

Code: Select all

scrCopy = Image.createEmpty(screen:width(), screen:height())
scrCopy:blit(0, 0, screen)
Luaplayer doesn't like the 2nd line - bad argument #2 to `blit' (Image expected, got table).

I take it the error is because screen is a 'special' type of image (according to the docs). Does anyone know if screen has an attribute on it which is a conventional image?

Thanks,

Lee
JorDy
Posts: 121
Joined: Sun Dec 11, 2005 8:45 am

Post by JorDy »

why dont use use a function to create your image that way youd just have to keep callign it
mallchin
Posts: 36
Joined: Thu Feb 16, 2006 2:03 am

Post by mallchin »

Could you blit to an image rather then the screen, then copy the image?
fullerlee
Posts: 54
Joined: Thu Nov 03, 2005 9:46 am

Post by fullerlee »

Yeah, I could do all my blitting to an image, but I was hoping I wouldn't have to change all the stuff I've already written (a lot).

Looking at the error, it seems that screen is a table, probably with an image as an attribute.

Oh hang on, I'll try a table.foreach(screen, print) to see if I can determine the attribute.
...
The out put of table.foreach doesn't really help:

Code: Select all

clear   function: 0x1007a800
waitVblankStart function: 0x1007a7d0
drawLine        function: 0x1007a8e8
flip    function: 0x1007a760
save    function: 0x1007a890
print   function: 0x1007a848
width   function: 0x1007a860
blit    function: 0x1007a7e8
createEmpty     function: 0x1007a778
fillRect        function: 0x1007a818
height  function: 0x1007a878
load    function: 0x1007a790
pixel   function: 0x1007a830
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

What about saving the screen and then loading it back to an image? Too slow?
Geo Massar
Retired Engineer
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

there is a nice feature in note pad,
i think microsoft calls it REPLACE...
so why not replace screen by buffer?
greets
lumo
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
youresam
Posts: 87
Joined: Sun Nov 06, 2005 1:43 am

Post by youresam »

The screen is a special image, it is...the screen. I wish I could call it as an image, but you cant.

Now, from what I remember from a while ago, when I did a foreach on screen, it came up with 'flip' and 'waitVblankStart', which were the screen. functions.

When I tried foreach(Image,print), I remember getting what you got for 'screen'.


Just so you know, there is no way (besides screenshot) to call the screen image. Check the source code.
Post Reply