Code: Select all
// Color
defineClass Color r g b a
method red Color { return r }
method green Color { return g }
method blue Color { return b }
method alpha Color { return a }
method getRed Color { return r }
method getGreen Color { return g }
method getBlue Color { return b }
method getAlpha Color { return a }
I can use getRed/green/blue to work with either pixels or colors. Yay, polymorphism!