Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
23
Task/Bitmap/Pluto/bitmap.pluto
Normal file
23
Task/Bitmap/Pluto/bitmap.pluto
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
local canvas = require "canvas"
|
||||
|
||||
-- Create a new canvas object: 400 pixels wide and 400 pixels high.
|
||||
local c = canvas.new(400, 400)
|
||||
|
||||
-- Color the whole canvas blue.
|
||||
c:fill(0xff0000)
|
||||
|
||||
-- Draw a red square in the middle.
|
||||
for i = 1, 51 do
|
||||
for j = 1, 51 do
|
||||
c:set(174 + i, 174 + j, 0x0000ff)
|
||||
end
|
||||
end
|
||||
|
||||
-- Print to the terminal the color (as an integer) of a pixel.
|
||||
print(c:get(200, 200)) -- 255
|
||||
|
||||
-- Convert the canvas to a BMP image.
|
||||
local image = c:tobmp()
|
||||
|
||||
-- Save the image to a file.
|
||||
io.contents("mybmp.bmp", image)
|
||||
Loading…
Add table
Add a link
Reference in a new issue