カラーについて

 カラーは、光の3原色の各5ビットで表現される。
 (赤、緑、青)にそれぞれに5ビットずつで、(2^5)^3=32、768色の表現が可能です。

カラーのサンプル
Blue = Color.new( 0, 0, 31) -- 青(ブルー)
Red = Color.new(31, 0, 0) -- 赤(レッド)
Green = Color.new( 0, 31, 0) -- 緑(グリーン)
Purple = Color.new(31, 17, 0) -- 橙(オレンジ)
Black = Color.new( 0, 0, 0) -- 黒(ブラック)
White = Color.new(31, 31, 31) -- 白(ホワイト)
Yellow = Color.new(31, 31, 0) -- 黄(イエロー)

-- color1 color1.lua
 
Blue   = Color.new( 0,  0, 31) -- 青(ブルー)
Red    = Color.new(31,  0,  0) -- 赤(レッド)
Green  = Color.new( 0, 31,  0) -- 緑(グリーン)
Purple = Color.new(31, 17,  0) -- 橙(オレンジ)
Black  = Color.new( 0,  0,  0) -- 黒(ブラック)
White  = Color.new(31, 31, 31) -- 白(ホワイト)
Yellow = Color.new(31, 31,  0) -- 黄(イエロー)
 
while not Keys.newPress.Start do  -- 何かキーが押されるまで繰り返す
 	Controls.read()
 	startDrawing()
 	screen.print(SCREEN_DOWN, 75, 8 * 2, "Blue!!! Blue!!!", Blue)
 	screen.print(SCREEN_DOWN, 75, 8 * 4, "Red!!!! Red!!!!", Red)
 	screen.print(SCREEN_DOWN, 75, 8 * 6, "Green!! Green!!", Green)
 	screen.print(SCREEN_DOWN, 75, 8 * 8, "Purple! Purple!", Purple)
 	screen.print(SCREEN_DOWN, 75, 8 * 10, "Black!! Black!!", Black)
 	screen.print(SCREEN_DOWN, 75, 8 * 12, "White!! White!!", White )
 	screen.print(SCREEN_DOWN, 75, 8 * 14, "Yellow! Yellow!", Yellow)
	stopDrawing()
end
 
Blue   = nil
Red    = nil
Green  = nil
Purple = nil
Black  = nil
White  = nil
Yellow = nil
 
 





タグ:

+ タグ編集
  • タグ:
最終更新:2010年07月21日 10:08
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。