Gray Scales

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

Moderators: Shine, Insert_witty_name

Post Reply
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Gray Scales

Post by KawaGeo »

Here is a code to display gray scales for reference.

Code: Select all

-- grayscales.lua by Geo Massar, 2005

dofile "LPut01.lua"

green = Color.new(0, 255, 0)

bg = Image.createEmpty(480,272)    -- background
bg:caption(152,28, "Gray Scales", green, 2)
bg:print(2,262, "by Geo Massar, 2005 (aka KawaGeo)", green)

bg:fillRect(111,71, 258,130, green)
for i = 0, 3 do
  mark = 111 + 64*i
  bg:drawLine(mark,200, mark,207, green)
end
bg:drawLine(368,200, 368,207, green) -- last mark
bg:print(109,210, "0",   green)
bg:print(169,210, "64",  green)
bg:print(229,210, "128", green)
bg:print(293,210, "192", green)
bg:print(358,210, "255", green)

for x = 0, 255 do
  gray = Color.new(x,x,x)
  bg:drawLine(112+x,72, 112+x,199, gray)
end
bg:save "grayscales.tga"

screen:blit(0,0, bg)
screen.flip()

while true do
  screen.waitVblankStart()
end
You can get the library file, LPut01.lua, at my webpage.

Screenshot:
Image

NOTE: With the current version of LP, the display shows only 32 scales. There will be full 256 scales in the future version. Right, Shine?
Geo Massar
Retired Engineer
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

NOTE: With the current version of LP, the display shows only 32 scales. There will be full 256 scales in the future version. Right, Shine?
The PSP can only show 32 grey levels in 16bit colour mode. Is LUA 16 or 32bit?

Jim
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

Jim wrote:Is LUA 16 or 32bit?
16 bit: http://forums.ps2dev.org/viewtopic.php?t=3157
Post Reply