本文整理汇总了Java中android.graphics.Paint.setStrokeCap方法的典型用法代码示例。如果您正苦于以下问题:Java Paint.setStrokeCap方法的具体用法?Java Paint.setStrokeCap怎么用?Java Paint.setStrokeCap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Paint
的用法示例。
在下文中一共展示了Paint.setStrokeCap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: UpdateCanvas
import android.graphics.Paint; //导入方法依赖的package包/类
public void UpdateCanvas() {
canvasMaster.drawColor(0, Mode.CLEAR);
canvasMaster.drawBitmap(lastEditedBitmap, 0.0f, 0.0f, null);
int i = 0;
while (true) {
if (i >= paths.size()) {
break;
}
int brushSize = brushSizes.get(i);
Paint paint = new Paint();
paint.setColor(0);
paint.setStyle(Style.STROKE);
paint.setAntiAlias(true);
paint.setStrokeJoin(Join.ROUND);
paint.setStrokeCap(Cap.ROUND);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC));
paint.setStrokeWidth((float) brushSize);
canvasMaster.drawPath(paths.get(i), paint);
i += 1;
}
touchImageView.invalidate();
}
示例2: initConfig
import android.graphics.Paint; //导入方法依赖的package包/类
@Override
protected void initConfig(int x, int y) {
mPaint = new Paint();
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(mStrokeWidth);
mPaint.setAntiAlias(true);
mPaint.setColor(Config.WHITE);
mPaint.setStrokeCap(Paint.Cap.SQUARE);
mRectF = new RectF(x - MAX_RADIUS_CIRCLE
, y - MAX_RADIUS_CIRCLE
, x + MAX_RADIUS_CIRCLE
, y + MAX_RADIUS_CIRCLE);
mFirstPoint = new Point(x - MAX_RADIUS_CIRCLE, y);
mSecondPoint = new Point(mFirstPoint);
}
示例3: initConfig
import android.graphics.Paint; //导入方法依赖的package包/类
@Override
protected void initConfig(int x, int y) {
mPaint = new Paint();
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(mStrokeWidth);
mPaint.setAntiAlias(true);
mPaint.setColor(Config.WHITE);
mPaint.setStrokeCap(Paint.Cap.SQUARE);
mRectF = new RectF(x - MAX_RADIUS_CIRCLE
, y - MAX_RADIUS_CIRCLE
, x + MAX_RADIUS_CIRCLE
, y + MAX_RADIUS_CIRCLE);
mFirPoint = new Point(x + MAX_RADIUS_CIRCLE, y - 2 * MAX_RADIUS_CIRCLE);
mSecPoint = new Point(mFirPoint);
}
示例4: initPaints
import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaints() {
mSmallScalePaint = new Paint();
mSmallScalePaint.setStrokeWidth(mParent.getSmallScaleWidth());
mSmallScalePaint.setColor(mParent.getScaleColor());
mSmallScalePaint.setStrokeCap(Paint.Cap.ROUND);;
mBigScalePaint = new Paint();
mBigScalePaint.setColor(mParent.getScaleColor());
mBigScalePaint.setStrokeWidth(mParent.getBigScaleWidth());
mBigScalePaint.setStrokeCap(Paint.Cap.ROUND);;
mTextPaint = new Paint();
mTextPaint.setAntiAlias(true);
mTextPaint.setColor(mParent.getTextColor());
mTextPaint.setTextSize(mParent.getTextSize());
mTextPaint.setTextAlign(Paint.Align.CENTER);
// mTextPaint.setStrokeJoin(Paint.Join.ROUND);
mOutLinePaint = new Paint();
mOutLinePaint.setStrokeWidth(0);
mOutLinePaint.setColor(mParent.getScaleColor());
}
示例5: init
import android.graphics.Paint; //导入方法依赖的package包/类
private void init() {
paint = new Paint();
paint.setColor(bgColor);
paint.setStrokeCap(Paint.Cap.ROUND);
paint.setAntiAlias(true);
toBgPainter = new Paint();
toBgPainter.setColor(toBgColor);
toBgPainter.setStrokeCap(Paint.Cap.ROUND);
toBgPainter.setAntiAlias(true);
toBgPainter.setAlpha(0);
initColorAnimator();
ballMoveObservable.addObserver(this);
}
示例6: setStroke
import android.graphics.Paint; //导入方法依赖的package包/类
private void setStroke(Cap cap, Join join, float miter, Style style, PathEffect pathEffect,
Paint paint) {
paint.setStrokeCap(cap);
paint.setStrokeJoin(join);
paint.setStrokeMiter(miter);
paint.setPathEffect(pathEffect);
paint.setStyle(style);
}
示例7: CubeEngine
import android.graphics.Paint; //导入方法依赖的package包/类
CubeEngine() {
// Create a Paint to draw the lines for our cube
final Paint paint = mPaint;
paint.setColor(0xffffffff);
paint.setAntiAlias(true);
paint.setStrokeWidth(2);
paint.setStrokeCap(Paint.Cap.ROUND);
paint.setStyle(Paint.Style.STROKE);
mStartTime = SystemClock.elapsedRealtime();
mPrefs = CubeWallpaper2.this.getSharedPreferences(SHARED_PREFS_NAME, 0);
mPrefs.registerOnSharedPreferenceChangeListener(this);
onSharedPreferenceChanged(mPrefs, null);
}
示例8: getArcPaint
import android.graphics.Paint; //导入方法依赖的package包/类
private Paint getArcPaint() {
Paint paint = new Paint();
paint.setColor(ContextCompat.getColor(this, R.color.temp_color));
paint.setStrokeWidth(20);
paint.setAntiAlias(true);
paint.setStrokeCap(Paint.Cap.SQUARE);
paint.setStyle(Paint.Style.STROKE);
return paint;
}
示例9: initConfig
import android.graphics.Paint; //导入方法依赖的package包/类
@Override
protected void initConfig() {
mEndMovingLength = -130;
mPaint = new Paint();
//mPaint.setStyle(Paint.Style.STROKE);
//设置画一条直线后结尾处的形状
mPaint.setStrokeCap(Paint.Cap.ROUND);
//设置连接处的形状
mPaint.setStrokeJoin(Paint.Join.ROUND);
mPaint.setAntiAlias(true);
}
示例10: initConfig
import android.graphics.Paint; //导入方法依赖的package包/类
@Override
protected void initConfig(int x, int y) {
mPaint = new Paint();
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(mStrokeWidth);
mPaint.setAntiAlias(true);
mPaint.setColor(Config.WHITE);
mPaint.setStrokeCap(Paint.Cap.SQUARE);
mLength1 = 3 * MAX_RADIUS_CIRCLE;
//mLength2 = (int) Math.sqrt(MAX_RADIUS_CIRCLE * MAX_RADIUS_CIRCLE + MAX_RADIUS_CIRCLE * MAX_RADIUS_CIRCLE);
mCircleX = x;
mCircleY = y - MAX_RADIUS_CIRCLE;
mRectF = new RectF(mCircleX - MAX_RADIUS_CIRCLE
, mCircleY - MAX_RADIUS_CIRCLE
, mCircleX + MAX_RADIUS_CIRCLE
, mCircleY + MAX_RADIUS_CIRCLE);
mFirstPoint = new Point(x - MAX_RADIUS_CIRCLE
, y - 2 * MAX_RADIUS_CIRCLE);
mSecondPoint = new Point(mFirstPoint);
mThirdPoint = new Point(x - MAX_RADIUS_CIRCLE, y + MAX_RADIUS_CIRCLE / 4);
mFourthPoint = new Point(mThirdPoint);
mFifthPoint = new Point(mThirdPoint);
}
示例11: initConfig
import android.graphics.Paint; //导入方法依赖的package包/类
@Override
protected void initConfig(int x, int y) {
mPaint = new Paint();
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(mStrokeWidth);
mPaint.setAntiAlias(true);
mPaint.setColor(Config.WHITE);
mPaint.setStrokeCap(Paint.Cap.SQUARE);
mFirPoint = new Point(x, y - 2 * MAX_RADIUS_CIRCLE);
mSecPoint = new Point(mFirPoint);
mThiPoint = new Point(mFirPoint);
mFourPoint = new Point(mFirPoint);
}
示例12: onDraw
import android.graphics.Paint; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// ����ͼ��ı���ɫ
canvas.drawColor(Color.TRANSPARENT);
// ��ӻ���
Paint paint_Line = new Paint();
paint_Line.setAntiAlias(true); // �����
paint_Line.setStrokeWidth(2); // ���û��ʿ��
paint_Line.setStyle(Style.STROKE);
paint_Line.setColor(Color.BLUE); // ���ʵ���ɫ
Paint paint_Point = new Paint();
paint_Point.setAntiAlias(true); // �����
paint_Point.setStrokeWidth(8); // ���û��ʿ��
paint_Point.setStyle(Style.STROKE);
paint_Point.setColor(Color.RED); // ���ʵ���ɫ
paint_Point.setStrokeCap(Cap.ROUND);//Բͷ�Ļ���ͷ
switch (test_flag) {
case 0: //�ӱ������ݿ��õ��ĵ�
drawDpPoint(canvas, testPoints, paint_Point);
break;
case 1: //�ӷ���������õ���
drawDpPoint(canvas, testPoint, paint_Point);
break;
default:
break;
}
}
示例13: draw
import android.graphics.Paint; //导入方法依赖的package包/类
@Override
public void draw(@NonNull Canvas canvas, CharSequence text, @IntRange(from = 0) int start, @IntRange(from = 0) int end, float x, int top, int y, int bottom, @NonNull Paint paint) {
canvas.save();
canvas.translate(mStrokeWidth, 0);
paint.setColor(mStrokeColor);
paint.setStrokeCap(Paint.Cap.ROUND);
paint.setStrokeWidth(mStrokeWidth);
paint.setStyle(Paint.Style.STROKE);
canvas.drawText(text, start, end, x, y, paint);
paint.setColor(mTextColor);
paint.setStyle(Paint.Style.FILL);
canvas.drawText(text, start, end, x, y, paint);
canvas.restore();
}
示例14: init
import android.graphics.Paint; //导入方法依赖的package包/类
private void init() {
drawRoundRectRadius = dpToPx(5);
setScaleType(ImageView.ScaleType.FIT_XY);
clickableStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
clickableStroke.setStrokeWidth(1f);
clickableStroke.setStyle(Paint.Style.STROKE);
clickableStroke.setStrokeCap(Paint.Cap.ROUND);
clickableStroke.setColor(Color.BLUE);
clickFill = new Paint(Paint.ANTI_ALIAS_FLAG);
clickFill.setStyle(Paint.Style.FILL_AND_STROKE);
clickFill.setStrokeCap(Paint.Cap.ROUND);
clickFill.setColor(Color.BLUE);
clickFill.setAlpha(70);
clickStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
clickStroke.setStyle(Paint.Style.STROKE);
clickStroke.setColor(Color.BLUE);
clickStroke.setStrokeWidth(2f);
clickStroke.setStrokeCap(Paint.Cap.ROUND);
warnFill = new Paint(Paint.ANTI_ALIAS_FLAG);
warnFill.setStyle(Paint.Style.FILL_AND_STROKE);
warnFill.setStrokeCap(Paint.Cap.ROUND);
warnFill.setColor(Color.YELLOW);
warnFill.setAlpha(70);
warnStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
warnStroke.setStyle(Paint.Style.STROKE);
warnStroke.setColor(Color.YELLOW);
warnStroke.setStrokeWidth(2f);
warnStroke.setStrokeCap(Paint.Cap.ROUND);
setOnTouchListener(this);
gestureDetector = new GestureDetector(getContext(), new OnGestureListenerAnchor(this));
}
示例15: initView
import android.graphics.Paint; //导入方法依赖的package包/类
private void initView(Context context) {
bgArcColor = Color.parseColor("#33f4f4f4");
//背景
allArcPaint = new Paint();
allArcPaint.setAntiAlias(true);
allArcPaint.setStyle(Paint.Style.FILL);
allArcPaint.setColor(bgArcColor);
allArcPaint.setStrokeCap(Paint.Cap.ROUND);
mCenterCirclePaint = new Paint();
mCenterCirclePaint.setAntiAlias(true);
mCenterCirclePaint.setStyle(Paint.Style.FILL);
mCenterCirclePaint.setColor(Color.WHITE);
mCenterCirclePaint.setStrokeCap(Paint.Cap.ROUND);
centerPaint = new Paint();
centerPaint.setAntiAlias(true);
centerPaint.setStyle(Paint.Style.FILL);
centerPaint.setColor(Color.argb(255, 255, 45, 53));
centerPaint.setStrokeCap(Paint.Cap.ROUND);
//当前进度
progressPaint = new Paint();
progressPaint.setAntiAlias(true);
progressPaint.setStyle(Paint.Style.STROKE);
progressPaint.setStrokeWidth(progressWidth);
progressPaint.setColor(Color.argb(255, 255, 45, 53));
progressPaint.setStrokeCap(Paint.Cap.ROUND);
}