We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › where is the color object
Page Index Toggle Pages: 1
where is the color object? (Read 417 times)
where is the color object?
Dec 31st, 2007, 1:17am
 
Hi. Since i'm programming in Eclipse IDE i'm curious where is the color object, so i could import it. none of the .jar files from Processing lib folder didn't work for me.

Example of an object i'm talking about:
http://processing.org/reference/PImage_get_.html

thanks in advance

P.S.: i know i once have found the config file for processing which also included the default import list, but i can't find it now. If anyone can help me with it's location, that would be a good start, since color object is included by default in processing IDE.
Re: where is the color object?
Reply #1 - Dec 31st, 2007, 6:22am
 
I'm not an expert on this topic, but in my integrations I use:
Code:

int col = pimg.get(x,y)


, because I believe that processing is just doing a hack where the color "object" becomes int's before becoming compiled *rollseyes*.

but I'm not too sure. but yea, above sample works for me. gl!
Re: where is the color object?
Reply #2 - Dec 31st, 2007, 7:44am
 
are you talking about java.awt.Color ?
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Color.html

indeed, as taifun said, colors in Processing are actually negative integers from -16 777 216 (black) to -1 (white).
Re: where is the color object?
Reply #3 - Dec 31st, 2007, 10:28am
 
Processing's color is just a synonym for int. It's not an object type at all.
So just use an int anywhere you'd use a color.
Page Index Toggle Pages: 1