Example usage for android.graphics Paint setColor

List of usage examples for android.graphics Paint setColor

Introduction

In this page you can find the example usage for android.graphics Paint setColor.

Prototype

public void setColor(@ColorInt int color) 

Source Link

Document

Set the paint's color.

Usage

From source file:Main.java

public static Paint getGameOverBackground() {
    Paint paint = new Paint();
    paint.setColor(0xAA000000);
    return paint;
}

From source file:Main.java

public static Paint getPipeColor() {
    Paint paint = new Paint();
    paint.setColor(Color.GREEN);
    return paint;
}

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);
    c.drawLine(x - 4, y, x + 4, y, p);//from   w  w  w .  java2s. com
    c.drawLine(x, y - 4, x, y + 4, p);
}

From source file:Main.java

public static Paint getBirdColor() {
    Paint paint = new Paint();
    paint.setColor(Color.RED);
    //        paint.setColor(0xFFFF0000);
    return paint;
}

From source file:Main.java

private static void drawAndroidBody(Canvas canvas, Paint paint, float w, float h) {
    paint.setColor(Color.parseColor("#43A047"));
    canvas.drawRoundRect(new RectF(-w / 2, 0, w / 2, h), w / 10, w / 10, paint);
}

From source file:Main.java

public static Paint getGameOverRestartMessageColor() {
    Paint paint = new Paint();
    paint.setColor(Color.YELLOW);
    paint.setTextSize(20);//from   w  w w.  ja  v a  2 s.co  m
    paint.setTypeface(Typeface.DEFAULT_BOLD);
    //        paint.setShadowLayer(2, 3, 3, Color.WHITE);
    return paint;
}

From source file:Main.java

public static Paint getScoreColor() {
    Paint paint = new Paint();
    paint.setColor(Color.WHITE);
    paint.setTextSize(80);//from   w ww .  j  ava2  s. c o  m
    paint.setTypeface(Typeface.DEFAULT_BOLD);
    paint.setShadowLayer(3, 5, 5, Color.BLACK);
    return paint;
}

From source file:Main.java

public static Paint getGameOverColor() {
    Paint paint = new Paint();
    paint.setColor(Color.WHITE);
    paint.setTextSize(80);/*from w w w .j  a v a2 s.c  om*/
    paint.setTypeface(Typeface.DEFAULT_BOLD);
    paint.setShadowLayer(2, 3, 3, Color.GRAY);
    return paint;
}

From source file:Main.java

public static Bitmap changeBitmapColor(Bitmap bmp, int color) {
    Bitmap b = Bitmap.createBitmap(bmp.getWidth(), bmp.getHeight(), bmp.getConfig());
    Canvas canvas = new Canvas(b);
    Paint paint = new Paint();
    paint.setColor(color);
    paint.setAntiAlias(true);//from   www .  j av  a  2 s. c o  m
    canvas.drawBitmap(bmp, bmp.getWidth(), bmp.getHeight(), paint);
    return b;
}

From source file:Main.java

public static void erase(Canvas canvas, RectF rectf) {
    Paint paint = new Paint();
    paint.setColor(0);
    paint.setDither(true);/*from  www  .j a  v  a  2  s.c  o  m*/
    paint.setXfermode(new PorterDuffXfermode(android.graphics.PorterDuff.Mode.CLEAR));
    canvas.drawRect(rectf, paint);
}