List of usage examples for android.graphics Canvas Canvas
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) public Canvas(long nativeCanvas)
From source file:com.kabootar.GlassMemeGenerator.ImageOverlay.java
public static void main(String[] args) throws InterruptedException { try {/*from ww w . j a va2 s . c o m*/ if (new File(CAPTION_FILE).exists()) { new File(CAPTION_FILE).delete(); } Bitmap image = BitmapFactory.decodeFile(INPUT_IMAGE); Canvas graphics = new Canvas(image); String captionTop = TOP_TEXT; String captionBottom = BOTTOM_TEXT; drawStringCentered(graphics, captionTop, image, true, null); drawStringCentered(graphics, captionBottom, image, false, null); //ImageIO.write(image, "png", new File(CAPTION_FILE)); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void drawCross(Bitmap bm, int x, int y) { Canvas c = new Canvas(bm); Paint p = new Paint(); p.setColor(0xffff0000);/*w w w.jav a 2s . co m*/ c.drawLine(x - 4, y, x + 4, y, p); c.drawLine(x, y - 4, x, y + 4, p); }
From source file:Main.java
public static Bitmap overlay(Bitmap b, int x, int y) { Bitmap empty = Bitmap.createBitmap(x, y, Bitmap.Config.ARGB_4444); Canvas cv = new Canvas(empty); cv.drawBitmap(b, 0, 0, null);/* w ww. j a v a 2s . c om*/ cv.save(); return empty; }
From source file:Main.java
public static Bitmap convertToAlphaMask(Bitmap b) { Bitmap a = Bitmap.createBitmap(b.getWidth(), b.getHeight(), Bitmap.Config.ALPHA_8); Canvas c = new Canvas(a); c.drawBitmap(b, 0.0f, 0.0f, null);/* ww w. ja v a2 s. c om*/ return a; }
From source file:Main.java
public static Canvas createFilterCanvas(Bitmap bitmap) { Canvas canvas = new Canvas(bitmap); canvas.setDrawFilter(new PaintFlagsDrawFilter(0, 7)); return canvas; }
From source file:Main.java
private static Bitmap getScreenshot(View v) { Bitmap b = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); v.draw(c);//from w w w . j a v a2 s. co m return b; }
From source file:Main.java
public static Bitmap createBitmap(View v) { Bitmap bitmap = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); v.draw(canvas);/*from w w w. j av a 2 s . c o m*/ return bitmap; }
From source file:Main.java
public static Bitmap captureView(View view, int j, int k) { Bitmap bitmap = Bitmap.createBitmap(j, k, android.graphics.Bitmap.Config.ARGB_8888); view.draw(new Canvas(bitmap)); return bitmap; }
From source file:Main.java
public static Bitmap createViewBitmap(View v) { Bitmap bitmap = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); v.draw(canvas);/*from w w w. j av a 2 s . co m*/ return bitmap; }
From source file:Main.java
public static Bitmap viewToBitmap(View view) { Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); view.draw(canvas);/* w w w. j av a2s. co m*/ return bitmap; }