当前位置: 首页>>代码示例>>Java>>正文


Java Paint.ANTI_ALIAS_FLAG属性代码示例

本文整理汇总了Java中android.graphics.Paint.ANTI_ALIAS_FLAG属性的典型用法代码示例。如果您正苦于以下问题:Java Paint.ANTI_ALIAS_FLAG属性的具体用法?Java Paint.ANTI_ALIAS_FLAG怎么用?Java Paint.ANTI_ALIAS_FLAG使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.graphics.Paint的用法示例。


在下文中一共展示了Paint.ANTI_ALIAS_FLAG属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: RadarView

public RadarView(Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
    init(context,attrs);


    mBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBgPaint.setColor(mRadarBackGroundColor);
    mBgPaint.setStyle(Paint.Style.FILL);

    mRadarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mRadarPaint.setColor(mRadarCircleColor);
    mRadarPaint.setStyle(Paint.Style.STROKE);
    mRadarPaint.setStrokeWidth(2);

    mRadarGradient = new SweepGradient(0,0,mRadarStartColor,mRadarEndColor);

    mMatrix = new Matrix();
}
 
开发者ID:fanxiaole,项目名称:androidShader_rippleView_radarView,代码行数:18,代码来源:RadarView.java

示例2: initPaintObjects

private void initPaintObjects() {

        int labelTextSize = getResources().getDimensionPixelSize(R.dimen.label_text_size);

        paint = new Paint(Paint.ANTI_ALIAS_FLAG);

        textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        textPaint.setTextSize(labelTextSize);
        if (typeface != null) {
            textPaint.setTypeface(typeface);
        }
        textPaint.setColor(baseColor);
        baseAlpha = textPaint.getAlpha();

        selectorPath = new Path();
        selectorPath.setFillType(Path.FillType.EVEN_ODD);

        selectorPoints = new Point[3];
        for (int i = 0; i < 3; i++) {
            selectorPoints[i] = new Point();
        }
    }
 
开发者ID:mityung,项目名称:XERUNG,代码行数:22,代码来源:MaterialSpinner.java

示例3: addImageWatermark

/**
 * 添加图片水印
 *
 * @param src       源图片
 * @param watermark 图片水印
 * @param x         起始坐标x
 * @param y         起始坐标y
 * @param alpha     透明度
 * @param recycle   是否回收
 * @return 带有图片水印的图片
 */
public static Bitmap addImageWatermark(final Bitmap src, final Bitmap watermark, final int x
		, final int y, final int alpha, final boolean recycle) {
	if (isEmptyBitmap(src)) {
		return null;
	}
	Bitmap ret = src.copy(src.getConfig(), true);
	if (!isEmptyBitmap(watermark)) {
		Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
		Canvas canvas = new Canvas(ret);
		paint.setAlpha(alpha);
		canvas.drawBitmap(watermark, x, y, paint);
	}
	if (recycle && !src.isRecycled()) {
		src.recycle();
	}
	return ret;
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:28,代码来源:ImageUtils.java

示例4: init

private void init(Context context, AttributeSet attrs) {

        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.TickView);
        mStrokeWidth = typedArray.getDimensionPixelSize(R.styleable.TickView_tv_strokeWidth, 0);
        int color = typedArray.getColor(R.styleable.TickView_tv_color, Color.RED);
        mPercent = typedArray.getFloat(R.styleable.TickView_tv_percent, 0f);
        typedArray.recycle();

        mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setStrokeCap(Paint.Cap.ROUND);
        mPaint.setColor(color);

        mTickPath = new Path();
        mArcRect = new RectF();
        mTickPoints = new Point[3];
        mTickPoints[0] = new Point();
        mTickPoints[1] = new Point();
        mTickPoints[2] = new Point();
    }
 
开发者ID:kingwang666,项目名称:BookLoadingView,代码行数:20,代码来源:TickView.java

示例5: init

private void init() {
  mLinePath = new Path();
  mLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
  mLinePaint.setColor(0xFFF90382);
  mLinePaint.setStyle(Paint.Style.STROKE);
  mLinePaint.setStrokeWidth(10.0f);

  mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
  mTextPaint.setColor(Color.WHITE);
  mTextPaint.setTextSize(Util.sp2px(mContext, 13.0f));

  mBubblePaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
  mBubblePaint.setColor(0xFF3B4DEC);

  mBubblePath = new Path();
  mBubbleRect = new RectF();
}
 
开发者ID:littleGnAl,项目名称:ScrollableChart,代码行数:17,代码来源:LineDrawing.java

示例6: drawTextToDrawable

public Bitmap drawTextToDrawable(@DrawableRes int resId, String text, int textSize) {
    Resources resources = _context.getResources();
    float scale = resources.getDisplayMetrics().density;
    Bitmap bitmap = getBitmapFromDrawable(resId);

    bitmap = bitmap.copy(bitmap.getConfig(), true);
    Canvas canvas = new Canvas(bitmap);
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(Color.rgb(61, 61, 61));
    paint.setTextSize((int) (textSize * scale));
    paint.setShadowLayer(1f, 0f, 1f, Color.WHITE);

    Rect bounds = new Rect();
    paint.getTextBounds(text, 0, text.length(), bounds);
    int x = (bitmap.getWidth() - bounds.width()) / 2;
    int y = (bitmap.getHeight() + bounds.height()) / 2;
    canvas.drawText(text, x, y, paint);

    return bitmap;
}
 
开发者ID:gsantner,项目名称:memetastic,代码行数:20,代码来源:ContextUtils.java

示例7: initView

/**
 * 进行一些初始化的操作
 */
private void initView() {
    //初始化画笔,路径
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStrokeWidth(8);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setColor(Color.BLACK);
    mPath = new Path();
    mRandom = new Random();
    //获取资源图片转化Bitmap(不可修改)
    mBitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.icon_star);

    setOnClickListener(this);
}
 
开发者ID:Lichenwei-Dev,项目名称:BezierView,代码行数:16,代码来源:StarViewGroup.java

示例8: init

private void init(Context context, boolean isSelected ,@ColorInt int color){
    //Set circle size
    currentSize = context.getResources().getDimensionPixelSize(R.dimen.schedule_item_size);
    //Set circle color
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    if(!isInEditMode()) {
        mPaint.setColor(isSelected ? color : ContextCompat.getColor(context, R.color.week_picker_inactive));
    }
}
 
开发者ID:Bruno125,项目名称:Unofficial-Ups,代码行数:9,代码来源:RoundCircleView.java

示例9: calculation

private void calculation() {
    if (mShowDebug) {
        fpsPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        fpsPaint.setColor(Color.YELLOW);
        fpsPaint.setTextSize(20);
        times = new LinkedList<>();
        lines = new LinkedList<>();
    }
    initChannelMap();
    initChannelY();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:DanmakuView.java

示例10: updateProgressColor

/**
 * updates the paint of the progress and the thumb to give them a new visual style
 */
private void updateProgressColor() {
    mProgressColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mProgressColorPaint.setColor(mProgressColor);
    mProgressColorPaint.setStyle(Paint.Style.STROKE);
    mProgressColorPaint.setStrokeWidth(mCircleStrokeWidth);

    mThumbColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mThumbColorPaint.setColor(mProgressColor);
    mThumbColorPaint.setStyle(Paint.Style.FILL_AND_STROKE);
    mThumbColorPaint.setStrokeWidth(mCircleStrokeWidth);

    invalidate();
}
 
开发者ID:swapyx,项目名称:Channelize,代码行数:16,代码来源:HoloCircularProgressBar.java

示例11: createPaintFromColor

/**
 * Returns a paint instance created as per the required specs.
 *
 * @param color         <tt>int</tt> : Color of the paint.
 * @param style         <tt>Paint.Style></tt> : Style of the paint. Eg - Fill, Stroke, etc.
 * @param shadowEnabled <tt>boolean</tt> : Enables shadow for the objects using this paint if
 *                      true.
 * @param shadowColor   <tt>int</tt> : Color of the shadow if the shadow is enabled.
 * @param shadowLength  <tt>int</tt> : Length of the shadow in pixels.
 * @return paint        Paint instance created.
 * @see <a href="https://developer.android.com/reference/android/graphics/Paint.Style.html">Paint.Style</a>
 */
static Paint createPaintFromColor(int color, Paint.Style style, boolean shadowEnabled,
                                  int shadowColor, int shadowLength) {

    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(color);
    paint.setStyle(style);
    paint.setAntiAlias(true);
    if (shadowEnabled) {
        paint.setShadowLayer(shadowLength, 0, 0, shadowColor);
    }
    return paint;
}
 
开发者ID:adk96r,项目名称:Selector-Switch-UI-Component,代码行数:24,代码来源:SelectorUtil.java

示例12: PageIndicatorDots

public PageIndicatorDots(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mCirclePaint.setStyle(Style.FILL);
    mDotRadius = getResources().getDimension(R.dimen.page_indicator_dot_size) / 2;
    setOutlineProvider(new MyOutlineProver());

    mActiveColor = Utilities.getColorAccent(context);
    mInActiveColor = getResources().getColor(R.color.page_indicator_dot_color);

    mIsRtl = Utilities.isRtl(getResources());
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:13,代码来源:PageIndicatorDots.java

示例13: WaveBezier

public WaveBezier(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mDarkerPath = new Path();
    mLightPath = new Path();
    mDarkerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mDarkerPaint.setColor(Color.parseColor("#77512DA8"));
    mDarkerPaint.setStyle(Paint.Style.FILL_AND_STROKE);
    mLightPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mLightPaint.setColor(Color.parseColor("#55512DA8"));
    mLightPaint.setStyle(Paint.Style.FILL_AND_STROKE);
}
 
开发者ID:HanyeeWang,项目名称:GeekZone,代码行数:11,代码来源:WaveBezier.java

示例14: createSpotBitmap

private Bitmap createSpotBitmap(String data) {
    Bitmap bitmap = Bitmap.createBitmap(
            (int) mSpotRadius * 2,
            (int) mSpotRadius * 2, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    canvas.drawColor(Color.rgb(235, 160, 160));
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStrokeWidth(5);
    paint.setTextSize(80);
    paint.setColor(Color.BLACK);
    canvas.drawText(data, 0, 80, paint);
    return bitmap;
}
 
开发者ID:halohoop,项目名称:AndroidDigIn,代码行数:13,代码来源:SweepGradientRadarView.java

示例15: init

private void init(Context context, AttributeSet attrs) {
    //关闭硬件加速,不然setXfermode()可能会不生效
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    if (attrs != null) {
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RectProgress);
        bgColor = typedArray.getColor(R.styleable.RectProgress_bgColor, defaultBgColor);
        progressColor = typedArray.getColor(R.styleable.RectProgress_progressColor, defaultProgressColor);
        progress = typedArray.getInteger(R.styleable.RectProgress_progressValue, progress);
        max = typedArray.getInteger(R.styleable.RectProgress_progressMax, max);
        if (max <= 0)
            throw new RuntimeException("Max 必须大于 0");
        orientation = typedArray.getInteger(R.styleable.RectProgress_progressOrientation, VERTICAL);
        int imgSrc = typedArray.getResourceId(R.styleable.RectProgress_iconSrc, 0);
        iconPadding = typedArray.getDimensionPixelSize(R.styleable.RectProgress_iconPadding, 10);
        rectRadius = typedArray.getDimensionPixelSize(R.styleable.RectProgress_rectRadius, 20);
        if (max < progress) {
            progress = max;
        }
        typedArray.recycle();

        if (imgSrc != 0) {
            bitmap = ((BitmapDrawable) getResources().getDrawable(imgSrc)).getBitmap();
        }
    }

    bgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    bgPaint.setColor(bgColor);

    progressPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    progressPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP));
    progressPaint.setColor(progressColor);


}
 
开发者ID:CuiZhaoHui,项目名称:IOS11RectProgress,代码行数:34,代码来源:RectProgress.java


注:本文中的android.graphics.Paint.ANTI_ALIAS_FLAG属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。