Bug 493 : hex color codes starting 0x fail in fill()
Last modified: 2008-09-29 06:44




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P3
Severity:
normal

 

Reporter:
pingswept
Assigned To:
REAS

Attachment Type Created Size Actions

Description:   Opened: 2007-01-21 11:54
Version: Processing 0123 on Ubuntu Linux, Sun JRE 1.5.0-10-1

This produces a yellow rectangle, as expected:
fill(#FFCC22);
rect(20,30,50,50);

But change # to 0x, and the rectangle is not filled:
fill(0xFFCC22);
rect(20,30,50,50);

Does not appear to be affected by which color is requested, but I haven't
checked all colors.

Documentation says either format should work: "int: color value in
hexadecimal notation (i.e. #FFCC00 or 0xFFCC00)" (from
http://processing.org/reference/fill_.html)

Thanks for the great tool.
Additional Comment #1 From fjen 2007-01-21 12:31
this may be a related bug (marked WONTFIX):
http://dev.processing.org/bugs/show_bug.cgi?id=228
Additional Comment #2 From fry 2007-01-21 19:47
ah, that's actually a documentation error. #ffcc00 is equivalent to
0xFFffcc00, because the alpha bits are set. fill(0xffcc00) is the same as
fill(0x00ffcc00) which is the correct color, but zero for its alpha value.
only use the 0x notation when you want to specify A, R, G, and B components
instead of just R, G, B.
Additional Comment #3 From REAS 2007-05-07 21:36
OK, this is fixed in the file. Please have a look to make sure the
explanation is clear.
Additional Comment #4 From pingswept 2007-05-07 22:45
(In reply to comment #3)

Looks great--very clear.

I did notice one minor typo. In "When using hexadecimal notation to specify
a color, use '#' or 'Ox'," the "Ox" should be "0x," i.e. zero-ex instead of
capital-oh-ex.
Additional Comment #5 From REAS 2007-05-08 08:14
Thank you. The file is updated with the correction.
Additional Comment #6 From Ira 2008-09-29 06:44
color (hex, alpha) should probably be removed (or I guess fixed)

color(#998822, 200) yields black
color(0x998822, 200) defaults to grayscale