| View previous topic :: View next topic |
| Author |
Message |
fullerlee
Joined: 03 Nov 2005 Posts: 54
|
Posted: Fri Feb 17, 2006 5:20 am Post subject: Screen image copy question |
|
|
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: | 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 |
|
| Back to top |
|
 |
JorDy
Joined: 11 Dec 2005 Posts: 121
|
Posted: Fri Feb 17, 2006 5:22 am Post subject: |
|
|
| why dont use use a function to create your image that way youd just have to keep callign it |
|
| Back to top |
|
 |
mallchin
Joined: 16 Feb 2006 Posts: 36
|
Posted: Fri Feb 17, 2006 5:54 am Post subject: |
|
|
| Could you blit to an image rather then the screen, then copy the image? |
|
| Back to top |
|
 |
fullerlee
Joined: 03 Nov 2005 Posts: 54
|
Posted: Fri Feb 17, 2006 7:20 am Post subject: |
|
|
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: |
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
|
|
|
| Back to top |
|
 |
KawaGeo
Joined: 27 Aug 2005 Posts: 191 Location: Calif Mountains
|
Posted: Fri Feb 17, 2006 1:36 pm Post subject: |
|
|
What about saving the screen and then loading it back to an image? Too slow? _________________ Geo Massar
Retired Engineer |
|
| Back to top |
|
 |
LuMo
Joined: 21 Aug 2005 Posts: 410 Location: Austria
|
Posted: Fri Feb 17, 2006 1:57 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
youresam
Joined: 06 Nov 2005 Posts: 87
|
Posted: Sat Feb 18, 2006 6:34 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
|