Java Code Examples for android.graphics.Color#TRANSPARENT
The following examples show how to use
android.graphics.Color#TRANSPARENT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Sign.java From android_maplibui with GNU Lesser General Public License v3.0 | 6 votes |
public void save(int width, int height, boolean transparentBackground, File sigFile) throws IOException { if (mNotInitialized) return; float scale = Math.min((float) width / getWidth(), (float) height / getHeight()); Matrix matrix = new Matrix(); matrix.setScale(scale, scale); Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bmp); canvas.setMatrix(matrix); int color = transparentBackground ? Color.TRANSPARENT : 0xFFFFFF - mPaint.getColor(); drawSign(canvas, color, mPaint); if(sigFile.exists() || sigFile.createNewFile()) { FileOutputStream out = new FileOutputStream(sigFile); bmp.compress(Bitmap.CompressFormat.PNG, 90, out); } }
Example 2
Source File: SeeThroughFrameLayout.java From MusicPlayer with GNU General Public License v3.0 | 6 votes |
private void init() { src_inPaint = new Paint(); src_inPaint.setColor(0x70000000); src_inPaint.setAntiAlias(true); src_inPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); standardPaint = new Paint(); standardPaint.setColor(getResources().getColor(R.color.colorAccent)); standardPaint.setAntiAlias(true); mPaint = new Paint(); mPaint.setColor(getResources().getColor(R.color.colorAccent)); mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT)); mPaint.setAntiAlias(true); super.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); }
Example 3
Source File: ExifHolder.java From Mysplash with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void onBindView(PhotoActivity a, PhotoInfoAdapter3.ViewModel viewModel) { ExifModel model = (ExifModel) viewModel; container.setOnClickListener(v -> NotificationHelper.showSnackbar( a, model.title + " : " + model.content)); icon.setImageResource(model.iconId); title.setText(model.title); content.setText(model.content); if (model.color != Color.TRANSPARENT) { color.setVisibility(View.VISIBLE); color.setBackground(new ColorDrawable(model.color)); } else { color.setVisibility(View.GONE); } }
Example 4
Source File: RadiusViewDelegate.java From UIWidget with Apache License 2.0 | 5 votes |
/** * 获取边框线颜色 * * @param color * @return */ private int getStrokeColor(int color) { if (color != Integer.MAX_VALUE) { return color; } if (mView.isSelected()) { color = mStrokeSelectedColor; } else if (mView instanceof CompoundButton) { if (((CompoundButton) mView).isChecked()) { color = mStrokeCheckedColor; } } color = color != Integer.MAX_VALUE ? color : mStrokeColor == Integer.MAX_VALUE ? Color.TRANSPARENT : mStrokeColor; return mView.isPressed() && !mRippleEnable ? calculateColor(color, mStrokePressedAlpha) : color; }
Example 5
Source File: CircleImageView.java From stynico with MIT License | 5 votes |
@Override protected void onDraw(Canvas canvas) { if (mBitmap == null) { return; } if (mFillColor != Color.TRANSPARENT) { canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mDrawableRadius, mFillPaint); } canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mDrawableRadius, mBitmapPaint); if (mBorderWidth != 0) { canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mBorderRadius, mBorderPaint); } }
Example 6
Source File: CircleImageView.java From FakeWeather with Apache License 2.0 | 5 votes |
@Override protected void onDraw(Canvas canvas) { if (mBitmap == null) { return; } if (mFillColor != Color.TRANSPARENT) { canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mDrawableRadius+mPadding, mFillPaint); } canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mDrawableRadius, mBitmapPaint); if (mBorderWidth != 0) { canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mBorderRadius, mBorderPaint); } }
Example 7
Source File: RangeSeekBar.java From Sunshine with Apache License 2.0 | 5 votes |
public void setTextMarkColorNormal(int color) { if (color == Color.TRANSPARENT) { throw new IllegalArgumentException( "Do you want to make text mark invisible?"); } mTextColorNormal = color; invalidate(); }
Example 8
Source File: FloatingGroupExpandableListView.java From FloatingGroupExpandableListView with Apache License 2.0 | 5 votes |
@Override public void setSelector(Drawable sel) { super.setSelector(new ColorDrawable(Color.TRANSPARENT)); if (mSelector != null) { mSelector.setCallback(null); unscheduleDrawable(mSelector); } mSelector = sel; mSelector.setCallback(this); }
Example 9
Source File: MaterialProgressDrawable.java From RvHelper with Apache License 2.0 | 5 votes |
public OvalShadow(int shadowRadius, int circleDiameter) { super(); mShadowPaint = new Paint(); mShadowRadius = shadowRadius; mCircleDiameter = circleDiameter; mRadialGradient = new RadialGradient(mCircleDiameter / 2, mCircleDiameter / 2, mShadowRadius, new int[]{ FILL_SHADOW_COLOR, Color.TRANSPARENT }, null, Shader.TileMode.CLAMP); mShadowPaint.setShader(mRadialGradient); }
Example 10
Source File: MaterialDrawable.java From android-PullRefreshLayout with MIT License | 5 votes |
public OvalShadow(int shadowRadius, int circleDiameter) { super(); mShadowPaint = new Paint(); mShadowRadius = shadowRadius; mCircleDiameter = circleDiameter; mRadialGradient = new RadialGradient(mCircleDiameter / 2, mCircleDiameter / 2, mShadowRadius, new int[] { FILL_SHADOW_COLOR, Color.TRANSPARENT }, null, Shader.TileMode.CLAMP); mShadowPaint.setShader(mRadialGradient); }
Example 11
Source File: SwitchButton.java From SwitchButton with MIT License | 5 votes |
@Override public void onAnimationEnd(Animator animation) { switch (animateState) { case ANIMATE_STATE_DRAGING: { break; } case ANIMATE_STATE_PENDING_DRAG: { animateState = ANIMATE_STATE_DRAGING; viewState.checkedLineColor = Color.TRANSPARENT; viewState.radius = viewRadius; postInvalidate(); break; } case ANIMATE_STATE_PENDING_RESET: { animateState = ANIMATE_STATE_NONE; postInvalidate(); break; } case ANIMATE_STATE_PENDING_SETTLE: { animateState = ANIMATE_STATE_NONE; postInvalidate(); broadcastEvent(); break; } case ANIMATE_STATE_SWITCH: { isChecked = !isChecked; animateState = ANIMATE_STATE_NONE; postInvalidate(); broadcastEvent(); break; } default: case ANIMATE_STATE_NONE: { break; } } }
Example 12
Source File: SampledImageReader.java From PdfBox-Android with Apache License 2.0 | 5 votes |
/** * Returns an ARGB image filled with the given paint and using the given image as a mask. * @param paint the paint to fill the visible portions of the image with * @return a masked image filled with the given paint * @throws IOException if the image cannot be read * @throws IllegalStateException if the image is not a stencil. */ public static Bitmap getStencilImage(PDImage pdImage, Paint paint) throws IOException { // get mask (this image) Bitmap mask = getRGBImage(pdImage, null); // compose to ARGB Bitmap masked = Bitmap.createBitmap(mask.getWidth(), mask.getHeight(), Bitmap.Config.ARGB_8888); Canvas g = new Canvas(masked); // fill with paint using src-in g.drawRect(0, 0, mask.getWidth(), mask.getHeight(), paint); // set the alpha int width = masked.getWidth(); int height = masked.getHeight(); int[] raster = new int[width * height]; masked.getPixels(raster, 0, width, 0, 0, width, height); int[] alpha = new int[width * height]; mask.getPixels(alpha, 0, width, 0, 0, width, height); for (int pixelIdx = 0; pixelIdx < width * height; pixelIdx++) { if (Color.red(alpha[pixelIdx]) == 255) { raster[pixelIdx] = Color.TRANSPARENT; } } masked.setPixels(raster, 0, width, 0, 0, width, height); return masked; }
Example 13
Source File: MainActivityView.java From YImagePicker with Apache License 2.0 | 4 votes |
public int getCropGapBackgroundColor() { return mCbGapBackground.isChecked() ? Color.TRANSPARENT : Color.RED; }
Example 14
Source File: BaseModeRenderer.java From PercentageChartView with Apache License 2.0 | 4 votes |
BaseModeRenderer(IPercentageChartView view) { mView = view; //DRAWING ORIENTATION orientation = ORIENTATION_CLOCKWISE; //START DRAWING ANGLE mStartAngle = DEFAULT_START_ANGLE; //BACKGROUND DRAW STATE mDrawBackground = this instanceof PieModeRenderer; //BACKGROUND COLOR mBackgroundColor = Color.BLACK; //PROGRESS mProgress = mTextProgress = 0; //PROGRESS COLOR mProgressColor = Color.RED; //GRADIENT COLORS mGradientType = -1; mGradientAngle = (int) mStartAngle; //PROGRESS ANIMATION DURATION mAnimDuration = DEFAULT_ANIMATION_DURATION; //PROGRESS ANIMATION INTERPOLATOR mAnimInterpolator = new LinearInterpolator(); //TEXT COLOR mTextColor = Color.WHITE; //TEXT SIZE mTextSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, DEFAULT_TEXT_SP_SIZE, mView.getViewContext().getResources().getDisplayMetrics()); //TEXT STYLE mTextStyle = Typeface.NORMAL; //TEXT SHADOW mTextShadowColor = Color.TRANSPARENT; mTextShadowRadius = 0; mTextShadowDistX = 0; mTextShadowDistY = 0; //BACKGROUND OFFSET mBackgroundOffset = 0; }
Example 15
Source File: ToolbarPhone.java From 365browser with Apache License 2.0 | 4 votes |
@Override protected void dispatchDraw(Canvas canvas) { if (!mTextureCaptureMode && mToolbarBackground.getColor() != Color.TRANSPARENT) { // Update to compensate for orientation changes. mToolbarBackground.setBounds(0, 0, getWidth(), getHeight()); mToolbarBackground.draw(canvas); } if (mLocationBarBackground != null && (mLocationBar.getVisibility() == VISIBLE || mTextureCaptureMode)) { updateLocationBarBackgroundBounds(mLocationBarBackgroundBounds, mVisualState); } if (mTextureCaptureMode) { drawTabSwitcherAnimationOverlay(canvas, 0.f); } else { boolean tabSwitcherAnimationFinished = false; if (mTabSwitcherModeAnimation != null) { tabSwitcherAnimationFinished = !mTabSwitcherModeAnimation.isRunning(); // Perform the fade logic before super.dispatchDraw(canvas) so that we can properly // set the values before the draw happens. if (!mAnimateNormalToolbar || FeatureUtilities.isChromeHomeEnabled()) { drawTabSwitcherFadeAnimation( tabSwitcherAnimationFinished, mTabSwitcherModePercent); } } super.dispatchDraw(canvas); if (mTabSwitcherModeAnimation != null) { // Perform the overlay logic after super.dispatchDraw(canvas) as we need to draw on // top of the current views. if (mAnimateNormalToolbar) { drawTabSwitcherAnimationOverlay(canvas, mTabSwitcherModePercent); } // Clear the animation. if (tabSwitcherAnimationFinished) mTabSwitcherModeAnimation = null; } } }
Example 16
Source File: TagAdapter.java From GeometricWeather with GNU Lesser General Public License v3.0 | 4 votes |
public TagAdapter(Context context, List<Tag> tagList, OnTagCheckedListener listener) { this(context, tagList, Color.TRANSPARENT, listener, UNCHECKABLE_INDEX); }
Example 17
Source File: ImageLoader.java From cannonball-android with Apache License 2.0 | 4 votes |
public BackgroundTaskDrawable(BackgroundTask bitmapDownloaderTask) { super(Color.TRANSPARENT); bitmapDownloaderTaskReference = new WeakReference<BackgroundTask>(bitmapDownloaderTask); }
Example 18
Source File: SwipeRefreshLayoutManager.java From react-native-GPay with MIT License | 4 votes |
@ReactProp(name = "progressBackgroundColor", defaultInt = Color.TRANSPARENT, customType = "Color") public void setProgressBackgroundColor(ReactSwipeRefreshLayout view, int color) { view.setProgressBackgroundColorSchemeColor(color); }
Example 19
Source File: NinePatchChunk.java From NinePatchChunk with Apache License 2.0 | 4 votes |
private static boolean isTransparent(int color) { return Color.alpha(color) == Color.TRANSPARENT; }
Example 20
Source File: CircleImageView.java From QRefreshLayout with MIT License | 4 votes |
private void updateRadialGradient(int diameter) { mRadialGradient = new RadialGradient(diameter / 2, diameter / 2, mShadowRadius, new int[]{FILL_SHADOW_COLOR, Color.TRANSPARENT}, null, Shader.TileMode.CLAMP); mShadowPaint.setShader(mRadialGradient); }