Anonymous user
Bitmap: Difference between revisions
m
Replace "col" by "x" and "row" by "y".
(Changed "x" and "y" by "col" and "row"; modified "print"; added "print" in example.) |
m (Replace "col" by "x" and "row" by "y".) |
||
Line 2,750:
=={{header|Nim}}==
<lang nim>type
Luminance* = uint8
Index* = int
Line 2,764 ⟶ 2,763:
Point* = tuple
x, y: Index
proc px*(r, g, b: SomeInteger): Pixel =
Line 2,814 ⟶ 2,782:
iterator indices*(img: Image): Point =
## Return a tuple
for
for
yield (
proc `[]`*(img: Image,
img.pixels[
proc `[]=`*(img: var Image,
img.pixels[row * img.w +
proc fill*(img: var Image, color: Pixel) =
for
img[
proc print*(img: Image) =
for
if
stdout.write '\n'
stdout.write if img[
stdout.write '\n'
Line 2,840 ⟶ 2,808:
img[1, 2] = px(255, 0, 0)
img[3, 4] = img[1, 2]
img.print</lang>
=={{header|OCaml}}==
|