kodaligopi547 / droiddraw

Automatically exported from code.google.com/p/droiddraw
0 stars 0 forks source link

xml output for colors broken? #192

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. exporting colors as .xml file
2. checking values
3.

What is the expected output? What do you see instead?
expected output would be 
<color="yellow">#ffffff00</color>

instead, you find this 
<drawable name="yellow">#ffff0ff</drawable>

What version of the product are you using? On what operating system?
offline r1.17, windows 7

Please provide any additional information below.
for dark colors, it would be nice, if the hex value of the colors in color tab 
would be written in somewhat lighter color (ie. value for black is invisible 
against background)

I looked around, it appears issue was fixed before...

Original issue reported on code.google.com by ales.vol...@gmail.com on 14 Jan 2011 at 11:16

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi,

in ColorHanlder.java, method dump() the following should be changed

//  String clr = "#"+Integer.toString(value.getRed(), 16)+
//  Integer.toString(value.getGreen(), 16)+
//  Integer.toString(value.getBlue(), 16)+
//  Integer.toString(value.getAlpha(), 16);
  int col = 0x1000000 * value.getRed();
  col += 0x10000 * value.getGreen();
  col += 0x100 * value.getBlue();
  col += value.getAlpha();
  String clr = "#" + Integer.toHexString(col);          

cheers
Frank

Original comment by Dietrich.Frank@gmail.com on 17 Jan 2011 at 12:22

GoogleCodeExporter commented 9 years ago
Actually, it's a bit different for android. As stated here at 
http://developer.android.com/reference/android/graphics/Color.html, 
"The components are stored as follows (alpha << 24) | (red << 16) | (green << 
8) | blue."

So the method should be changed to 
        String clr = String.format("#%02x%02x%02x%02x", value.getAlpha(), value.getRed(), value.getGreen(), value.getBlue());

br
  Ales

Original comment by ales.vol...@gmail.com on 17 Jan 2011 at 2:18

GoogleCodeExporter commented 9 years ago
Thanks this has been now fixed in SVN and will roll out with the next release.  
Next time, feel free to send a patch if you want.

Thanks
--brendan

Original comment by brendan....@gmail.com on 28 Dec 2011 at 6:17