List of usage examples for android.graphics Color TRANSPARENT
int TRANSPARENT
To view the source code for android.graphics Color TRANSPARENT.
Click Source Link
From source file:Main.java
private static boolean isFilled(int pixel) { return pixel != Color.TRANSPARENT; }
From source file:Main.java
public static void clearCanvas(Canvas canvas) { canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); }
From source file:Main.java
public static int getDominantColor(Bitmap bitmap) { if (null == bitmap) return Color.TRANSPARENT; int redBucket = 0; int greenBucket = 0; int blueBucket = 0; int alphaBucket = 0; boolean hasAlpha = bitmap.hasAlpha(); int pixelCount = bitmap.getWidth() * bitmap.getHeight(); int[] pixels = new int[pixelCount]; bitmap.getPixels(pixels, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight()); for (int y = 0, h = bitmap.getHeight(); y < h; y++) { for (int x = 0, w = bitmap.getWidth(); x < w; x++) { int color = pixels[x + y * w]; // x + y * barHeight redBucket += (color >> 16) & 0xFF; // Color.red greenBucket += (color >> 8) & 0xFF; // Color.greed blueBucket += (color & 0xFF); // Color.blue if (hasAlpha) alphaBucket += (color >>> 24); // Color.alpha }// w ww .ja v a 2s .c o m } return Color.argb((hasAlpha) ? (alphaBucket / pixelCount) : 255, redBucket / pixelCount, greenBucket / pixelCount, blueBucket / pixelCount); }
From source file:Main.java
static int getColorViewColor(View colorView) { int color = Color.TRANSPARENT; Drawable background = colorView.getBackground(); if (background instanceof ColorDrawable) color = ((ColorDrawable) background).getColor(); return color; }
From source file:Main.java
public static Bitmap getTransparentPlaceholder(int width, int height) { Bitmap.Config conf = Bitmap.Config.ALPHA_8; Bitmap bmp = Bitmap.createBitmap(width, height, conf); bmp.eraseColor(Color.TRANSPARENT); return bmp;//from w w w . j ava2 s .c o m }
From source file:Main.java
public static void setTransparent(Activity r, final View v) { r.runOnUiThread(new Runnable() { @Override/* w w w. ja v a 2s . c o m*/ public void run() { v.setBackgroundColor(Color.TRANSPARENT); } }); }
From source file:Main.java
public static void disableEditText(EditText editText) { editText.setFocusable(false);/* w w w. j ava 2 s .c o m*/ editText.setEnabled(false); editText.setCursorVisible(false); editText.setKeyListener(null); editText.setBackgroundColor(Color.TRANSPARENT); }
From source file:Main.java
/** * Fill the hole in the image (version 2) *//* ww w . j ava 2 s . c o m*/ public static void fillHole2(Bitmap bmp) { for (int j = 1; j < bmp.getWidth(); j++) { for (int i = 1; i < bmp.getHeight() - 1; i++) { if ((bmp.getPixel(i, j) == Color.TRANSPARENT) && (bmp.getPixel(i + 1, j) != Color.TRANSPARENT)) { bmp.setPixel(i, j, bmp.getPixel(i + 1, j)); // set to the next-below pixel } } } }
From source file:Main.java
/** * Fill the hole in the image (version 1) */// w w w . j ava 2 s.c o m public static void fillHole1(Bitmap bmp) { for (int j = 1; j < bmp.getWidth() - 1; j++) { for (int i = 1; i < bmp.getHeight(); i++) { if ((bmp.getPixel(i, j) == Color.TRANSPARENT) && (bmp.getPixel(i, j + 1) != Color.TRANSPARENT)) { bmp.setPixel(i, j, bmp.getPixel(i, j + 1)); // set to the right-next pixel } } } }
From source file:Main.java
/** * * @param radius//from ww w . j a v a2s. co m * @return * @deprecated Change to use ViewUtils. */ @Deprecated public static GradientDrawable getShapeDrawable(float radius) { GradientDrawable shape = new GradientDrawable(); shape.setColor(Color.TRANSPARENT); shape.setCornerRadius(radius); return shape; }