Question

I wanted to know if there is an example of an application to add text in a photo gallery that is loaded from the phone. After you save the edited photo. Thanks

Was it helpful?

Solution

You might want to try this:

public static Bitmap mark(Bitmap src, String watermark, Point location, Color color, int alpha, int size, boolean underline) {
int w = src.getWidth();
int h = src.getHeight();
Bitmap result = Bitmap.createBitmap(w, h, src.getConfig());

Canvas canvas = new Canvas(result);
canvas.drawBitmap(src, 0, 0, null);

Paint paint = new Paint();
paint.setColor(color);
paint.setAlpha(alpha);
paint.setTextSize(size);
paint.setAntiAlias(true);
paint.setUnderlineText(underline);
canvas.drawText(watermark, location.x, location.y, paint);

return result;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top