You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bitmap bm = Bitmap.createBitmap((int) w, (int) h, Bitmap.config.ALPHA_8);
Canvas bmcanvas = new Canvas(bm);
// Render our document scaled to fit inside our canvas dimensions
svg.renderToCanvas(bmcanvas, null, 96f, AspectRatioAlignment.xMidYMid,
AspectRatioScale.MEET);
What is the expected output? What do you see instead?
I expected bm to be a grayscale bitmap, instead it is all black.
What version of the product are you using? On what operating system?
Latest
Please provide any additional information below.
Original issue reported on code.google.com by argonned...@gmail.com on 17 Jun 2013 at 7:32
The text was updated successfully, but these errors were encountered:
ALPHA_8 doesn't create an 8-bit greyscale bitmap. It creates a bitmap that
represents an alpha channel. From the Bitmap javadoc:
"Each pixel is stored as a single translucency (alpha) channel."
If you need a greyscale bitmap, you would need to render to a 565 or 8888. Then
convert it yourself, or paint the bitmap using a ColorMatrixColorFilter.
For an exmple of the latter, see:
http://stackoverflow.com/questions/3373860/convert-a-bitmap-to-grayscale-in-andr
oid
Marking Invalid, as this is not a bug with the library.
If there is demand, I may add ColorMtrix support to the library in a future
version.
Original comment by paul.leb...@gmail.com on 17 Jun 2013 at 11:22
Original issue reported on code.google.com by
argonned...@gmail.com
on 17 Jun 2013 at 7:32The text was updated successfully, but these errors were encountered: