Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,27 +0,0 @@
|
|||
local canvas = require "canvas"
|
||||
|
||||
local function line(c, x0, y0, x1, y1, col)
|
||||
local dx = math.abs(x1 - x0)
|
||||
local dy = math.abs(y1 - y0)
|
||||
local sx = (x0 < x1) ? 1 : -1
|
||||
local sy = (y0 < y1) ? 1 : -1
|
||||
local err = (dx > dy ? dx : - dy) // 2
|
||||
while true do
|
||||
c:set(x0, y0, col)
|
||||
if x0 == x1 and y0 == y1 then break end
|
||||
local e2 = err
|
||||
if e2 > -dx then
|
||||
err -= dy
|
||||
x0 += sx
|
||||
end
|
||||
if e2 < dy then
|
||||
err += dx
|
||||
y0 += sy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local c = canvas.new(400, 400)
|
||||
c:fill(0xffffff) -- white background
|
||||
line(c, 0, 0, 399, 399, 0x0000ff) -- draw a red diagonal
|
||||
io.contents("mybmp.bmp", c:tobmp()) -- save to a bitmap file
|
||||
Loading…
Add table
Add a link
Reference in a new issue