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_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   -16711935 = green?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: -16711935 = green?  (Read 467 times)
mFredy


-16711935 = green?
« on: Jan 8th, 2005, 10:56pm »

Greetings,  
I got this from calling pixels[]. Why is -16711935 green? Is this a hexadecimal number? If so, what is red, green, blue in it? ... if not, then what is it, and how can I convert it into a hexadecimal number?
« Last Edit: Jan 8th, 2005, 10:59pm by mFredy »  
mFredy


Re: -16711935 = green?
« Reply #1 on: Jan 9th, 2005, 1:07am »

Alright I got some help from a friend, jbum at flashkit.com, and the Windows scientific calculator. The decimal -16711935 = 0xFF00FF01 = green
is there a way to get a hex value instead of a decimal?
 
Here's the code I'm working with:
___________________________
  BImage a;
  size(50, 50);
  framerate(30);
  a = loadImage("images/chuck_small.jpg");
  image(a, 0, 0);  
  String pixel = "";
  for(int i=0; i<width*height; i++) {
    pixel += a.pixels[i];
  }
  String list[] = splitStrings(pixel);
  saveStrings("text/pixels.txt", list);  
___________________________
 
I'v tried using colorMode() also with no luck.
Why are the colors written as negatives?
« Last Edit: Jan 9th, 2005, 2:03am by mFredy »  
fjen

WWW
Re: -16711935 = green?
« Reply #2 on: Jan 9th, 2005, 3:07am »

tom, the color question seems to come up quite often, maybe that's something for your faq as well
 
fredy, here are some links on the nature of argb in processing:
http://processing.org/reference/color.html
 
http://processing.org/discourse/yabb/board_Programs_action_disp_lay_num_1099892081.html
 
and from the java specs:
 
static String Integer.toHexString(int i)  // ... use like this:
 
String myHexColor = Integer.toHexString(someColor);
 
hope this get's you started ...
/F
 
TomC

WWW
Re: -16711935 = green?
« Reply #3 on: Jan 9th, 2005, 3:00pm »

on Jan 9th, 2005, 3:07am, fjen wrote:
tom, the color question seems to come up quite often, maybe that's something for your faq as well

 
Noted, but I'm concentrating on the questions most often asked about Java syntax and libraries - the Processing team can deal with questions about their own syntax and libraries
 
(Could/should the color type be formatted as hex by default)
 
fjen

WWW
Re: -16711935 = green?
« Reply #4 on: Jan 9th, 2005, 3:27pm »

right ... why did i think it's a java question in the first place? hmmm. java isn't even ARGB .. tsss. florian!

 
/F
 
----
 
no .. looking at it from a beginners point of view hex is not really naturally understood. the only reason to use it would be since many people have used it in html or else before. but many didn't.
« Last Edit: Jan 9th, 2005, 3:33pm by fjen »  
mFredy


Re: -16711935 = green?
« Reply #5 on: Jan 9th, 2005, 11:19pm »

Thanks for the help.
 
Pages: 1 

« Previous topic | Next topic »