List of usage examples for android.graphics Color WHITE
int WHITE
To view the source code for android.graphics Color WHITE.
Click Source Link
From source file:Main.java
public static CharSequence convertStringToShowErrorInEditText(String string) { ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(Color.WHITE); SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string); spannableStringBuilder.setSpan(foregroundColorSpan, 0, string.length(), 0); return spannableStringBuilder; }
From source file:Main.java
public static int getScrimColor(int background) { double a = getLuminance(background); if ((int) (a * 100) <= 50) // it was so close... return Color.BLACK; else// w w w. j av a 2 s .c o m return Color.WHITE; }
From source file:Main.java
public static int parseBackgroundColor2(int color) { int counter = 0; counter += Color.red(color) >= 128 ? 1 : 0; counter += Color.green(color) >= 128 ? 1 : 0; counter += Color.blue(color) >= 128 ? 1 : 0; return counter >= 2 ? Color.BLACK : Color.WHITE; }
From source file:Main.java
public static int getSecurityStatusColor(final float security) { if (security > 0) { return Color.LTGRAY; }/*w ww. j a v a 2 s . c o m*/ if (security > -2.0) { return Color.WHITE; } return getSecurityLevelColor((security + 10) / 20); }
From source file:Main.java
public static int getContrastColor(String colorString) { int color = Color.parseColor(colorString); double y = (299 * Color.red(color) + 587 * Color.green(color) + 114 * Color.blue(color)) / 1000; if (y >= 128) { return Color.BLACK; } else {/* ww w.j ava 2 s . co m*/ return Color.WHITE; } }
From source file:Main.java
public static void drawCircleBorder(Canvas canvas, int radius, int w, int y) { Paint paint = new Paint(); paint.setAntiAlias(true);/*from w w w . j a v a2 s. co m*/ paint.setFilterBitmap(true); paint.setDither(true); paint.setColor(Color.WHITE); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(mBorderThickness); canvas.drawCircle(w / 2, y / 2, radius, paint); }
From source file:Main.java
public static byte[][] bitmap2grayByteArry(Bitmap bm) { byte[][] grayImage = new byte[bm.getHeight()][bm.getWidth()]; for (int i = 0; i < bm.getWidth(); i++) { for (int j = 0; j < bm.getHeight(); j++) { if (bm.getPixel(i, j) == Color.WHITE) { grayImage[j][i] = 0;//from w ww .j a v a 2s . c o m } else { grayImage[j][i] = 1; } } } return grayImage; }
From source file:Main.java
public static int getAttributedColor(Context context, int attr) { int[] set = { attr }; TypedValue typedValue = new TypedValue(); TypedArray a = context.obtainStyledAttributes(typedValue.data, set); int color = a.getColor(0, Color.WHITE); a.recycle();/*from w ww . j a va2 s.co m*/ return color; }
From source file:Main.java
public static Bitmap addWhiteBorder(Bitmap bmp, int borderSize) { Bitmap bmpWithBorder = Bitmap.createBitmap(bmp.getWidth() + borderSize * 2, bmp.getHeight() + borderSize * 2, bmp.getConfig()); Canvas canvas = new Canvas(bmpWithBorder); canvas.drawColor(Color.WHITE); canvas.drawBitmap(bmp, borderSize, borderSize, null); return bmpWithBorder; }
From source file:Main.java
public static int ContrastColor(int color) { int d = 0;// ww w .j av a2 s .com // Counting the perceptive luminance - human eye favors green color... double a = 1 - (0.299 * Color.red(color) + 0.587 * Color.green(color) + 0.114 * Color.blue(color)) / 255; if (a < 0.5) return Color.BLACK; // bright colors - black font return Color.WHITE;// dark colors - white font }