Example usage for android.graphics Paint Paint

List of usage examples for android.graphics Paint Paint

Introduction

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

Prototype

public Paint() 

Source Link

Document

Create a new paint with default settings.

Usage

From source file:Main.java

public static int getFontHeight(float fontSize) {
    Paint paint = new Paint();
    paint.setTextSize(fontSize);//from  w ww  .j a  v a  2s .  c  o m
    Paint.FontMetrics fm = paint.getFontMetrics();
    return (int) Math.ceil(fm.descent - fm.top) + 2;
}

From source file:Main.java

public static Paint getPaint(Paint.Style style, int color) {
    Paint mPaint = new Paint();
    mPaint.setAntiAlias(true);/*from   w  w  w . j av  a2 s.  co  m*/
    mPaint.setStyle(style);
    mPaint.setColor(color);
    mPaint.setTextSize(30);
    return mPaint;
}

From source file:Main.java

public static int getFontHeight(TextView textView) {
    Paint paint = new Paint();
    paint.setTextSize(textView.getTextSize());
    Paint.FontMetrics fm = paint.getFontMetrics();
    return (int) Math.ceil(fm.bottom - fm.top);
}

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 Rect getTextRect(String text, float size) {
    Paint pFont = new Paint();
    pFont.setTextSize(size);/*from  w ww .  java  2  s  .c  o  m*/
    Rect rect = new Rect();
    pFont.getTextBounds(text, 0, text.length(), rect);
    return rect;
}

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 Paint getBirdColor() {
    Paint paint = new Paint();
    paint.setColor(Color.RED);/*from  w ww.j a v a2s . c  o m*/
    //        paint.setColor(0xFFFF0000);
    return paint;
}

From source file:Main.java

private static int getFontHeight(TextView tv) {
    Paint paint = new Paint();
    paint.setTextSize(tv.getTextSize());
    Paint.FontMetrics fm = paint.getFontMetrics();
    return (int) Math.ceil(fm.bottom - fm.top);
}

From source file:Main.java

public static Paint getScoreColor() {
    Paint paint = new Paint();
    paint.setColor(Color.WHITE);// w ww . jav a 2 s . c  o  m
    paint.setTextSize(80);
    paint.setTypeface(Typeface.DEFAULT_BOLD);
    paint.setShadowLayer(3, 5, 5, Color.BLACK);
    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);//from   www .ja  v a2 s .  co m
    c.drawLine(x - 4, y, x + 4, y, p);
    c.drawLine(x, y - 4, x, y + 4, p);
}