Data update

This commit is contained in:
Ingy döt Net 2025-08-11 18:05:26 -07:00
parent 4d5544505c
commit 4924dd0264
3073 changed files with 55820 additions and 4408 deletions

View file

@ -0,0 +1,27 @@
proc pix x y .
grect x / 5 y / 5 0.25 0.25
.
proc circ x0 y0 r .
t1 = r div 16
x = r
while x >= y
pix x0 - x, y0 + y
pix x0 - x, y0 - y
pix x0 - y, y0 + x
pix x0 - y, y0 - x
pix x0 + x, y0 + y
pix x0 + x, y0 - y
pix x0 + y, y0 + x
pix x0 + y, y0 - x
y += 1
t1 += y
t2 = t1 - x
if t2 >= 0
t1 = t2
x -= 1
.
.
.
for r = 20 step 20 to 240
circ 250 250 r
.

View file

@ -1,3 +1,5 @@
using Images, ImageView
function drawcircle!(img::Matrix{T}, col::T, x0::Int, y0::Int, radius::Int) where T
x = radius - 1
y = 0
@ -24,8 +26,6 @@ function drawcircle!(img::Matrix{T}, col::T, x0::Int, y0::Int, radius::Int) wher
return img
end
# Test
using Images
img = fill(Gray(255.0), 25, 25);
drawcircle!(img, Gray(0.0), 12, 12, 12)
imshow(img)

View file

@ -0,0 +1,33 @@
local canvas = require "canvas"
local function trunc(x) return x >= 0 ? math.floor(x) : math.ceil(x) end
local function circle(c, cx, cy, r, col)
local d = trunc((5 - r * 4) / 4)
local x = 0
local y = r
repeat
c:set(cx + x, cy + y, col)
c:set(cx + x, cy - y, col)
c:set(cx - x, cy + y, col)
c:set(cx - x, cy - y, col)
c:set(cx + y, cy + x, col)
c:set(cx + y, cy - x, col)
c:set(cx - y, cy + x, col)
c:set(cx - y, cy - x, col)
if d < 0 then
d += 2 * x + 1
else
d += 2 * (x - y) + 1
y -= 1
end
++x
until x > y
end
local c = canvas.new(400, 400)
c:fill(0xffffff) -- white background
-- Draw a blue circle with centre at (200, 200) and radius 100.
circle(c, 200, 200, 100, 0xff0000)
io.contents("mybmp.bmp", c:tobmp()) -- save to a bitmap file