android.graphics.Color#TRANSPARENT源码实例Demo

下面列出了android.graphics.Color#TRANSPARENT 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: MusicPlayer   文件: SeeThroughFrameLayout.java
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));
}
 
源代码2 项目: Mysplash   文件: ExifHolder.java
@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);
    }
}
 
源代码3 项目: android_maplibui   文件: Sign.java
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);
    }
}
 
源代码4 项目: UIWidget   文件: RadiusViewDelegate.java
/**
 * 获取边框线颜色
 *
 * @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;
}
 
源代码5 项目: stynico   文件: CircleImageView.java
@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);
    }
}
 
源代码6 项目: FakeWeather   文件: CircleImageView.java
@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);
    }
}
 
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);
}
 
源代码8 项目: PdfBox-Android   文件: SampledImageReader.java
/**
 * 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;
}
 
源代码9 项目: SwitchButton   文件: SwitchButton.java
@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;
        }
    }
}
 
源代码10 项目: RvHelper   文件: MaterialProgressDrawable.java
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);
}
 
@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);
}
 
源代码12 项目: Sunshine   文件: RangeSeekBar.java
public void setTextMarkColorNormal(int color) {
    if (color == Color.TRANSPARENT) {
        throw new IllegalArgumentException(
                "Do you want to make text mark invisible?");
    }

    mTextColorNormal = color;

    invalidate();
}
 
源代码13 项目: GeometricWeather   文件: TagAdapter.java
public TagAdapter(Context context, List<Tag> tagList, OnTagCheckedListener listener) {
    this(context, tagList, Color.TRANSPARENT, listener, UNCHECKABLE_INDEX);
}
 
源代码14 项目: QRefreshLayout   文件: CircleImageView.java
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);
}
 
源代码15 项目: NinePatchChunk   文件: NinePatchChunk.java
private static boolean isTransparent(int color) {
	return Color.alpha(color) == Color.TRANSPARENT;
}
 
@ReactProp(name = "progressBackgroundColor", defaultInt = Color.TRANSPARENT, customType = "Color")
public void setProgressBackgroundColor(ReactSwipeRefreshLayout view, int color) {
  view.setProgressBackgroundColorSchemeColor(color);
}
 
源代码17 项目: cannonball-android   文件: ImageLoader.java
public BackgroundTaskDrawable(BackgroundTask bitmapDownloaderTask) {
    super(Color.TRANSPARENT);
    bitmapDownloaderTaskReference =
            new WeakReference<BackgroundTask>(bitmapDownloaderTask);
}
 
源代码18 项目: YImagePicker   文件: MainActivityView.java
public int getCropGapBackgroundColor() {
    return mCbGapBackground.isChecked() ? Color.TRANSPARENT : Color.RED;
}
 
源代码19 项目: 365browser   文件: ToolbarPhone.java
@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;
        }
    }
}
 
源代码20 项目: PercentageChartView   文件: BaseModeRenderer.java
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;
}