class _Color
export ~.*Color, var r, var g, var b, use
type Color : ^_Color
var r, g, b : real := 0
proc use
RGB.SetColor (255, r, g, b)
end use
end _Color
fcn newColor (r, g, b : real) : Color
var n : Color
new n
n -> r := r
n -> g := g
n -> b := b
result n
end newColor
fcn tonyswhatdotcolor (x, y : int) : Color
var bleh : array 1 .. sizepic (1, 1, 2, 2) of int
for i : 1 .. upper (bleh)
bleh (i) := 9999
end for
takepic (x, y, x + 1, y + 1, bleh)
var p, q: int
var w, r, g, b : real
if (bleh (19) ~= 9999) then
p := bleh (19)
else
p := bleh (21)
assert false
end if
b := bits (p, 24 .. 31) / 256
r := bits (p, 16 .. 23) / 256
g := bits (p, 8 .. 15) / 256
w := bits (p, 0 .. 7) / 256
result newColor (r, g, b)
end tonyswhatdotcolor
|