Requesting 3 new lines

Extending or modifying the GP system itself (advanced!)

Moderator: MSandro

Post Reply
mguzdial
Posts: 70
Joined: Sep 15th, '15, 11:21

Requesting 3 new lines

Post by mguzdial » Dec 17th, '15, 21:47

I request the addition of four lines to Colors.gp -- creating getRed, getGreen, getBlue, and getAlpha as synonyms for r, g, and b in color. (I don't really need getAlpha, but it seems like a natural.)

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 }
The reason is so that I can do this:
green-of-color.png
green-of-color.png (3.08 KiB) Viewed 5053 times
I can use getRed/green/blue to work with either pixels or colors. Yay, polymorphism!

JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

Re: Requesting 3 new lines

Post by JohnM » Dec 28th, '15, 19:05

Sure! Will add in next release.

Post Reply