Canvas Paint text size android -
i have mutable bitmap , i'm drawing on canvas. after want draw pre-defined text on bitmap. problem have different bitmap sizes, though i'm setting text size 20sp, depending on bitmap size text bigger of smaller, want text size same images. should do? thought of maybe scaling text size depending on image width , weight i'm not sure how that.
final bitmap mutablebitmap = bitmap.copy(bitmap.config.argb_8888, true); final canvas canvas = new canvas(mutablebitmap); final paint paint = new paint(); paint.settextsize(getresources().getdimensionpixelsize(r.dimen.myfontsize); canvas.drawtext(text, x, y, paint);
first of if ondraw method doing wrong work here. shouldn't allocate inside ondraw method. on other hand , shouldn't change text size bitmaps. resize bitmaps on same values(width , height) , setting text same value.
Comments
Post a Comment