color = image:pixel(x,y) to array ?

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

Moderators: Shine, Insert_witty_name

Post Reply
Julu Julu
Posts: 9
Joined: Tue Nov 01, 2005 8:57 am
Location: Germany

color = image:pixel(x,y) to array ?

Post by Julu Julu »

Hi,

i have an Array.

Code: Select all

a = {} 
    for i=0,10 do
         color = image:pixel(x,y)
         newColor= color:colors()
	      a[i] = newColor ???
    end
How can i copy getColor to the array?
alexis
Posts: 11
Joined: Mon Nov 14, 2005 10:21 am
Location: between neptune and mars

Post by alexis »

I'm not sure to understand clearely the point but probabely somethink like

Code: Select all

    c=image:pixel(x,y):colors()
    a[i]=Color:new(c.r, c.g, c.b)
could help you to construct a copy of the Color instance you get with pixel method.

Regards.
Alexis.
Ho no ... !! I make the same bug again !!!
alexis
Posts: 11
Joined: Mon Nov 14, 2005 10:21 am
Location: between neptune and mars

Post by alexis »

Or do you mean

Code: Select all

    c=image:pixel(x,y):colors()
    a[1]=c.r
    a[2]=c.g
    a[3]=c.b
????
Ho no ... !! I make the same bug again !!!
Julu Julu
Posts: 9
Joined: Tue Nov 01, 2005 8:57 am
Location: Germany

Post by Julu Julu »

Thanks alexis.
The first Code is exactly which I searched
Post Reply