Java Code Examples for android.graphics.Shader.TileMode#REPEAT

The following examples show how to use android.graphics.Shader.TileMode#REPEAT . 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: RoundedImageView.java    From letv with Apache License 2.0 5 votes vote down vote up
private static TileMode parseTileMode(int tileMode) {
    switch (tileMode) {
        case 0:
            return TileMode.CLAMP;
        case 1:
            return TileMode.REPEAT;
        case 2:
            return TileMode.MIRROR;
        default:
            return null;
    }
}
 
Example 2
Source File: ColorPickerView.java    From libcommon with Apache License 2.0 5 votes vote down vote up
public ColorPickerView(final Context context, final AttributeSet attrs, final int defStyleAttr) {
		super(context, attrs, defStyleAttr);
//		if (DEBUG) Log.v(TAG, "ColorPickerView:");
		DENSITY = context.getResources().getDisplayMetrics().density;
		RECTANGLE_TRACKER_OFFSET = RECTANGLE_TRACKER_OFFSET_DP * DENSITY;
		SELECTED_RADIUS = DEFAULT_SELECTED_RADIUS * DENSITY;

		mAlphaShader = new BitmapShader(BitmapHelper.makeCheckBitmap(), TileMode.REPEAT, TileMode.REPEAT);
		mAlphaDrawable = new ShaderDrawable(Paint.FILTER_BITMAP_FLAG | Paint.DITHER_FLAG, 0);
		mAlphaDrawable.setShader(mAlphaShader);

		radius = 0;
		internalSetColor(mColor, false);

		// 色相円用
		setHueColorArray(mAlpha, COLORS);
		mPaint.setShader(new SweepGradient(0, 0, COLORS, null));
		mPaint.setStyle(Paint.Style.FILL);
		mPaint.setStrokeWidth(0);

		// 選択色用
		mSelectionPaint.setColor(mColor);
		mSelectionPaint.setStrokeWidth(5);

		// スライダーのトラッカー表示用
		mTrackerPaint.setColor(TRACKER_COLOR);
		mTrackerPaint.setStyle(Paint.Style.STROKE);
		mTrackerPaint.setStrokeWidth(2f * DENSITY);
		mTrackerPaint.setAntiAlias(true);
	}