android - Cannot drop shadow on bitmap with SetShadowLayer -


i trying add shadow bitmap image, cannot figure out why not happening:

    public static bitmap pimpmybitmap(bitmap bitmap) { // scales down, adds rounded edges , shadow      bitmap output = bitmap.createbitmap(360, 240, config.argb_8888);     canvas canvas = new canvas(output);      final int color = 0xff424242;     final paint paint = new paint();     final rect rect = new rect(0, 0, bitmap.getwidth(), bitmap.getheight());     final rectf rectf = new rectf(0, 0, 360, 240);     final float roundpx = 12;      paint.setshadowlayer(5.5f, 6.0f, 6.0f, 0xff000000);       paint.setantialias(true);     canvas.drawargb(0, 0, 0, 0);     paint.setcolor(color);     canvas.drawroundrect(rectf, roundpx, roundpx, paint);      paint.setxfermode(new porterduffxfermode(mode.src_in));     canvas.drawbitmap(bitmap, rect, rectf, paint);      return output; } 

if using honeycomb , above, make sure use software layers because of version 4.2 setshadowlayer not supported accelerated canvas pipeline other text.

so right before canvas.drawbitmap this:

setlayertype(layer_type_software, null); 

for more info read this: http://developer.android.com/guide/topics/graphics/hardware-accel.html (scroll down "unsupported drawing operations" section)


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -