[android-developers] Re: Android renders RGB values wrong.

2011-05-13 Thread cg-dev
Hi,

I face the same issue with OpenGL texture. I use gradient texture and
this one was damaged due to
convertion from 24bit = 565.

To solve this issue I embeded libpng in my application using NDK.

You said that the screen is 565 so we loose precision : Yes but in
OpenGL,
glEnable(GL_DITHER) will dither the colors. So(in that case) why doing
OpenGL job ?
Colors convertion should be done by the final renderer : it is the
only one to know the final screen
config.

I think this image convertion at loading should be optional. Because
it depends in which context
you use it.

Finally, with the dither I don't have color steps due to
downsampling.

Best Regards

On 3 mai, 00:27, Dianne Hackborn hack...@android.com wrote:
 If the issue is losing precision due to a 16bpp screen with 565 colors,
 changing it to 256 colors won't necessarily help since each of those colors
 are still full 888.

 On Mon, May 2, 2011 at 2:52 PM, Andrew Huang proelited...@gmail.com wrote:
  Another way is to make your images have 256 color at most. You can do
  this in Gimp by changing the mode to indexed in the image menu, and
  setting the maximum color.

  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Android renders RGB values wrong.

2011-05-13 Thread Dianne Hackborn
You don't need to use libpng to load a 24 bit image.  Just set the bitmap
option to specify you want higher bit depth when loading it.

On Fri, May 13, 2011 at 8:16 AM, cg-dev charles.gorand@gmail.comwrote:

 Hi,

 I face the same issue with OpenGL texture. I use gradient texture and
 this one was damaged due to
 convertion from 24bit = 565.

 To solve this issue I embeded libpng in my application using NDK.

 You said that the screen is 565 so we loose precision : Yes but in
 OpenGL,
 glEnable(GL_DITHER) will dither the colors. So(in that case) why doing
 OpenGL job ?
 Colors convertion should be done by the final renderer : it is the
 only one to know the final screen
 config.

 I think this image convertion at loading should be optional. Because
 it depends in which context
 you use it.

 Finally, with the dither I don't have color steps due to
 downsampling.

 Best Regards

 On 3 mai, 00:27, Dianne Hackborn hack...@android.com wrote:
  If the issue is losing precision due to a 16bpp screen with 565 colors,
  changing it to 256 colors won't necessarily help since each of those
 colors
  are still full 888.
 
  On Mon, May 2, 2011 at 2:52 PM, Andrew Huang proelited...@gmail.com
 wrote:
   Another way is to make your images have 256 color at most. You can do
   this in Gimp by changing the mode to indexed in the image menu, and
   setting the maximum color.
 
   --
   You received this message because you are subscribed to the Google
   Groups Android Developers group.
   To post to this group, send email to
 android-developers@googlegroups.com
   To unsubscribe from this group, send email to
   android-developers+unsubscr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en
 
  --
  Dianne Hackborn
  Android framework engineer
  hack...@android.com
 
  Note: please don't send private questions to me, as I don't have time to
  provide private support, and so won't reply to such e-mails.  All such
  questions should be posted on public forums, where I and others can see
 and
  answer them.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Android renders RGB values wrong.

2011-05-13 Thread cg-dev
I know, but in Eclair it's not working.  If you put Bitmap option to RGBA. 
You get a RGBA image but the image is altered.

Maybe I'm wrong, but I remember I face this issue on my Eclair phone and 
take this workaround using libpng.

In eclair release, if the bitmap has no alpha it was converted to 565. 

SkImageDecoder_libpng.cpp ~ l.277 

I face this issue severals month ago and I remember I have trace down to 
Skia and found the issue but I don't keep my notes on this subject.

Anyway seems fixed in Gingerbread.

Regards.





-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Android renders RGB values wrong.

2011-05-02 Thread Andrew Huang
Actually that didn't went well.

I downsampled my images to 256 colors in gimp, and they displayed
correctly afterwards. Even 4096 colors was giving me trouble.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Android renders RGB values wrong.

2011-05-02 Thread Andrew Huang
Another way is to make your images have 256 color at most. You can do
this in Gimp by changing the mode to indexed in the image menu, and
setting the maximum color.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Android renders RGB values wrong.

2011-05-02 Thread Dianne Hackborn
If the issue is losing precision due to a 16bpp screen with 565 colors,
changing it to 256 colors won't necessarily help since each of those colors
are still full 888.

On Mon, May 2, 2011 at 2:52 PM, Andrew Huang proelited...@gmail.com wrote:

 Another way is to make your images have 256 color at most. You can do
 this in Gimp by changing the mode to indexed in the image menu, and
 setting the maximum color.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Android renders RGB values wrong.

2011-04-29 Thread Andrew Huang
I gave up trying to solve the problem. My current solution is to use a
small patch of the color that I want to use as the background to make
a tiled background.

On Apr 26, 5:38 pm, Mark Wyszomierski mar...@gmail.com wrote:
  Not all devices use 24-bit color buffers. Some are 16-bit

 Good point. I saw this on the N1, nexus S for sure, can't remember
 where else I saw it.

 On Apr 26, 5:08špm, Kostya Vasilyev kmans...@gmail.com wrote:







  PNG is lossless, it's basically LZW or something similar applied on a
  per-block basis, IIRC. JPG is the lossy one.

  The build tools do perform some image optimizations, but, as far as I know,
  they don't change color values.
  27.04.2011 1:04 ÐÏÌØÚÏ×ÁÔÅÌØ lbendlin l...@bendlin.us ÎÁÐÉÓÁÌ:

   png is lossy, right? What if you use a lossless format?

   --
   You received this message because you are subscribed to the Google
   Groups Android Developers group.
   To post to this group, send email to android-developers@googlegroups.com
   To unsubscribe from this group, send email to
   android-developers+unsubscr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Android renders RGB values wrong.

2011-04-26 Thread Mark Wyszomierski
I've seen render issues like this. I think one example was putting a
png with a flat color next to a view with its background color
specified with the same hex value. They won't match. It makes it
really difficult to make portions of your layout blend together.
Example:

  ImageView
android:src=@drawable/flat_grey_ffebebeb_png /

  LinearLayout
android:background=ffebebeb /

I'm sure the png I created has the same hex value as the manually
specified background value. Not sure why they don't match when you
run, but, that's what it is.

Mark

On Apr 18, 11:48 am, Andrew Huang proelited...@gmail.com wrote:
 Specify a RGB, i.e,     color name=test_color#ff292728/color.
 Use the a Color Meter tool on Windows or Mac to sample the color in
 the Layout Preview screen. You'll see that it renders the correct
 value of 292728.

 Sampling the same color in the emulator would return a different
 value, #282329.

 This is causing us some serious problems with our graphics (i.e.
 images are not correctly blending with the background), so we would
 like to understand what's going on. My searches have turned up nothing
 so far. If anyone has a deeper understanding of how colors are render,
 we would greatly appreciate the help.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Android renders RGB values wrong.

2011-04-26 Thread Kostya Vasilyev
Not all devices use 24-bit color buffers. Some are 16-bit, and you might
want to adjust the colors accordingly.
27.04.2011 0:48 пользователь Mark Wyszomierski mar...@gmail.com написал:
 I've seen render issues like this. I think one example was putting a
 png with a flat color next to a view with its background color
 specified with the same hex value. They won't match. It makes it
 really difficult to make portions of your layout blend together.
 Example:

 ImageView
 android:src=@drawable/flat_grey_ffebebeb_png /

 LinearLayout
 android:background=ffebebeb /

 I'm sure the png I created has the same hex value as the manually
 specified background value. Not sure why they don't match when you
 run, but, that's what it is.

 Mark

 On Apr 18, 11:48 am, Andrew Huang proelited...@gmail.com wrote:
 Specify a RGB, i.e, color name=test_color#ff292728/color.
 Use the a Color Meter tool on Windows or Mac to sample the color in
 the Layout Preview screen. You'll see that it renders the correct
 value of 292728.

 Sampling the same color in the emulator would return a different
 value, #282329.

 This is causing us some serious problems with our graphics (i.e.
 images are not correctly blending with the background), so we would
 like to understand what's going on. My searches have turned up nothing
 so far. If anyone has a deeper understanding of how colors are render,
 we would greatly appreciate the help.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Android renders RGB values wrong.

2011-04-26 Thread lbendlin
png is lossy, right?  What if you use a lossless format?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Android renders RGB values wrong.

2011-04-26 Thread Kostya Vasilyev
PNG is lossless, it's basically LZW or something similar applied on a
per-block basis, IIRC. JPG is the lossy one.

The build tools do perform some image optimizations, but, as far as I know,
they don't change color values.
27.04.2011 1:04 пользователь lbendlin l...@bendlin.us написал:
 png is lossy, right? What if you use a lossless format?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Android renders RGB values wrong.

2011-04-26 Thread Mark Wyszomierski
 Not all devices use 24-bit color buffers. Some are 16-bit
Good point. I saw this on the N1, nexus S for sure, can't remember
where else I saw it.

On Apr 26, 5:08 pm, Kostya Vasilyev kmans...@gmail.com wrote:
 PNG is lossless, it's basically LZW or something similar applied on a
 per-block basis, IIRC. JPG is the lossy one.

 The build tools do perform some image optimizations, but, as far as I know,
 they don't change color values.
 27.04.2011 1:04 пользователь lbendlin l...@bendlin.us написал:







  png is lossy, right? What if you use a lossless format?

  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en