24 lines
473 B
Plaintext
24 lines
473 B
Plaintext
allocateImg := proc(width, height)
|
|
return Array(1..width, 1..height, 1..3);
|
|
end proc:
|
|
fillColor := proc(img, rgb::list)
|
|
local i;
|
|
for i from 1 to 3 do
|
|
img[..,..,i] := map(x->rgb[i], img[..,..,i]):
|
|
end do:
|
|
end proc:
|
|
setColor := proc(x, y, img, rgb::list)
|
|
local i:
|
|
for i from 1 to 3 do
|
|
img[x,y,i] := rgb[i]:
|
|
end do:
|
|
end proc:
|
|
getColor := proc(x,y,img)
|
|
local rgb,i:
|
|
rgb := Array(1..3):
|
|
for i from 1 to 3 do
|
|
rgb(i) := img[x,y,i]:
|
|
end do:
|
|
return rgb:
|
|
end proc:
|