FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Suggestions
   Software Suggestions
(Moderator: fry)
   color.red vs red(color)
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: color.red vs red(color)  (Read 297 times)
rgovostes

rgovostes
color.red vs red(color)
« on: Dec 23rd, 2003, 6:04pm »

Would it be possible to give the 'color' class 6 properties: hue saturation brightness red green blue
 
And take away the 6 functions with the same name? The code is shorter, and neater, since you don't need parenthesis.
 
Code:
color a = color(104, 92, 240);
 
// with functions
color b = color(red(a) * 0.5, green(a) * 0.5, blue(a) * 0.5);
// with properties
color c = color(a.red * 0.5, a.green * 0.5, a.blue * 0.5);
« Last Edit: Dec 23rd, 2003, 6:07pm by rgovostes »  
toxi

WWW
Re: color.red vs red(color)
« Reply #1 on: Dec 24th, 2003, 11:19am »

only thing is, "color" is not a class, but a function packing 3 values into one integer. plus the overall Processing syntax is not really in favour of the "object.property" dot syntax for basic operations as this implies some knowledge of OOP, which should not be required in order to write sketches and would potentially alienate beginners.
« Last Edit: Dec 24th, 2003, 11:22am by toxi »  

http://toxi.co.uk/
Pages: 1 

« Previous topic | Next topic »