List of usage examples for android.graphics Paint setColor
public void setColor(@ColorInt int color)
From source file:Main.java
public static Bitmap changeImageColor(Bitmap sourceBitmap, int color) { Bitmap resultBitmap = Bitmap.createBitmap(sourceBitmap, 0, 0, sourceBitmap.getWidth() - 1, sourceBitmap.getHeight() - 1); Paint p = new Paint(); p.setColor(color); ColorFilter filter = new LightingColorFilter(color, 1); Canvas canvas = new Canvas(resultBitmap); canvas.drawBitmap(resultBitmap, 0, 0, p); return resultBitmap; }
From source file:Main.java
public static Bitmap drawEmptyBackground(int size) { Bitmap bitmap = Bitmap.createBitmap(size, size, Config.RGB_565); Canvas cv = new Canvas(bitmap); Paint background = new Paint(); background.setColor(BACKGROUND_COLOR); cv.drawRect(0, 0, size, size, background); return bitmap; }
From source file:Main.java
public static Bitmap getRoundBitmap(Bitmap bitmap) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); Bitmap out = Bitmap.createBitmap(width, height, Config.ARGB_8888); Canvas canvas = new Canvas(out); Paint paint = new Paint(); paint.setColor(Color.WHITE); paint.setAntiAlias(true);/*from w w w .ja va 2 s . c o m*/ canvas.drawCircle(width / 2, height / 2, width / 2, paint); paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); Rect rect = new Rect(0, 0, width, height); canvas.drawBitmap(bitmap, rect, rect, paint); return out; }
From source file:Main.java
public static Bitmap getUnreadMarker(int width, int radius, int color) { if (width <= 0) { return null; }/*from w w w .j a va2 s .co m*/ Bitmap dest = Bitmap.createBitmap(width, width, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(dest); Paint p = new Paint(); p.setColor(color); p.setAntiAlias(true); canvas.drawCircle(width / 2, width / 2, radius, p); return dest; }
From source file:Main.java
public static Paint getUIPainter() { Paint uiPaint = new Paint(Paint.ANTI_ALIAS_FLAG); uiPaint.setColor(Color.argb(128, 255, 255, 255)); uiPaint.setStyle(Style.STROKE); uiPaint.setStrokeWidth((float) 3.0); return uiPaint; }
From source file:Main.java
/** * Creates the Paint object for drawing the crop window guidelines. * /*from w ww.jav a 2 s. c o m*/ * @return the new Paint object */ public static Paint newRotateBottomImagePaint() { final Paint paint = new Paint(); paint.setColor(Color.WHITE); paint.setStrokeWidth(3); return paint; }
From source file:Main.java
public static Bitmap setupFrame(Bitmap bitmap, int width, int color) { if (bitmap.getWidth() <= width * 2 || bitmap.getHeight() <= width * 2) { return bitmap; }/* w w w . j a v a 2 s. c om*/ Bitmap bp = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888); Canvas canvas = new Canvas(bp); canvas.drawBitmap(bitmap, 0, 0, new Paint()); Paint paint = new Paint(); paint.setColor(color); paint.setStrokeWidth(width); paint.setStyle(Style.STROKE); canvas.drawRect(0, 0, canvas.getWidth() - width, canvas.getHeight() - width, paint); bitmap.recycle(); return bp; }
From source file:Main.java
/** * Creates the Paint object for drawing the translucent overlay outside the * crop window.//from ww w. j av a 2 s.co m * * @param context the Context * @return the new Paint object */ public static Paint newBackgroundPaint(Context context) { final Paint paint = new Paint(); paint.setColor(Color.parseColor(DEFAULT_BACKGROUND_COLOR_ID)); return paint; }
From source file:Main.java
/** * Creates the Paint object for drawing the crop window guidelines. * //ww w .j av a 2s . c o m * @return the new Paint object */ public static Paint newGuidelinePaint() { final Paint paint = new Paint(); paint.setColor(Color.parseColor(SEMI_TRANSPARENT)); paint.setStrokeWidth(DEFAULT_GUIDELINE_THICKNESS_PX); return paint; }
From source file:Main.java
public static Bitmap int2Icon(Context context, int i) { Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), 0x7f020047); Bitmap bitmap1 = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), android.graphics.Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap1); Paint paint = new Paint(); paint.setDither(true);/*from w w w. j a v a 2s . c o m*/ paint.setFilterBitmap(true); canvas.drawBitmap(bitmap, 0.0F, 0.0F, paint); bitmap.recycle(); Paint paint1 = new Paint(257); paint1.setColor(-1); paint1.setTypeface(Typeface.DEFAULT_BOLD); paint1.setTextAlign(android.graphics.Paint.Align.CENTER); canvas.drawText(String.valueOf(i), bitmap.getWidth() / 2, 3 + bitmap.getHeight() / 2, paint1); return bitmap1; }