本文整理匯總了Java中android.graphics.Paint.Cap類的典型用法代碼示例。如果您正苦於以下問題:Java Cap類的具體用法?Java Cap怎麽用?Java Cap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Cap類屬於android.graphics.Paint包,在下文中一共展示了Cap類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: LineChartRenderer
import android.graphics.Paint.Cap; //導入依賴的package包/類
public LineChartRenderer(Context context, Chart chart, LineChartDataProvider dataProvider) {
super(context, chart);
this.dataProvider = dataProvider;
touchToleranceMargin = ChartUtils.dp2px(density, DEFAULT_TOUCH_TOLERANCE_MARGIN_DP);
linePaint.setAntiAlias(true);
linePaint.setStyle(Paint.Style.STROKE);
linePaint.setStrokeCap(Cap.ROUND);
linePaint.setStrokeWidth(ChartUtils.dp2px(density, DEFAULT_LINE_STROKE_WIDTH_DP));
pointPaint.setAntiAlias(true);
pointPaint.setStyle(Paint.Style.FILL);
checkPrecision = ChartUtils.dp2px(density, 2);
}
示例2: MultiBoxTracker
import android.graphics.Paint.Cap; //導入依賴的package包/類
public MultiBoxTracker(final Context context) {
this.context = context;
for (final int color : COLORS) {
availableColors.add(color);
}
boxPaint.setColor(Color.RED);
boxPaint.setStyle(Style.STROKE);
boxPaint.setStrokeWidth(12.0f);
boxPaint.setStrokeCap(Cap.ROUND);
boxPaint.setStrokeJoin(Join.ROUND);
boxPaint.setStrokeMiter(100);
textSizePx =
TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, TEXT_SIZE_DIP, context.getResources().getDisplayMetrics());
borderedText = new BorderedText(textSizePx);
}
示例3: SimpleGraph
import android.graphics.Paint.Cap; //導入依賴的package包/類
private SimpleGraph(final int color, final long maxNsecs, final float width, final float height, final float strokeWidth)
{
this.maxNsecs = maxNsecs;
// this.width = width;
this.height = height;
nsecWidth = width / maxNsecs;
paintStroke = new Paint();
paintStroke.setColor(color);
paintStroke.setAlpha(204); // 80%
paintStroke.setStyle(Style.STROKE);
paintStroke.setStrokeWidth(strokeWidth);
paintStroke.setStrokeCap(Cap.ROUND);
paintStroke.setStrokeJoin(Join.ROUND);
paintStroke.setAntiAlias(true);
paintFill = new Paint();
paintFill.setColor(color);
paintFill.setAlpha(51); // 20%
paintFill.setStyle(Style.FILL);
paintFill.setAntiAlias(true);
pathStroke = new Path();
pathFill = new Path();
}
示例4: StaticGraph
import android.graphics.Paint.Cap; //導入依賴的package包/類
private StaticGraph(final int color, final float width, final float height, final float strokeWidth)
{
this.height = height;
this.width = width;
pathStroke = new Path();
pathFill = new Path();
paintStroke = new Paint();
paintFill = new Paint();
paintStroke.setColor(color);
paintStroke.setAlpha(204); // 80%
paintStroke.setStyle(Style.STROKE);
paintStroke.setStrokeWidth(strokeWidth);
paintStroke.setStrokeCap(Cap.ROUND);
paintStroke.setStrokeJoin(Join.ROUND);
paintStroke.setAntiAlias(true);
paintFill.setColor(color);
paintFill.setAlpha(51); // 20%
paintFill.setStyle(Style.FILL);
paintFill.setAntiAlias(true);
}
示例5: SmoothGraph
import android.graphics.Paint.Cap; //導入依賴的package包/類
private SmoothGraph(final int color, final float width, final float height, final float strokeWidth)
{
this.height = height;
this.width = width;
paintStroke = new Paint();
paintStroke.setColor(color);
paintStroke.setAlpha(204); // 80%
paintStroke.setStyle(Style.STROKE);
paintStroke.setStrokeWidth(strokeWidth);
paintStroke.setStrokeCap(Cap.ROUND);
paintStroke.setStrokeJoin(Join.ROUND);
paintStroke.setAntiAlias(true);
paintFill = new Paint();
paintFill.setColor(color);
paintFill.setAlpha(51); // 20%
paintFill.setStyle(Style.FILL);
paintFill.setAntiAlias(true);
pathStroke = new Path();
pathFill = new Path();
}
示例6: setup
import android.graphics.Paint.Cap; //導入依賴的package包/類
public void setup(AttributeSet attrs) {
paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
paint.setStyle(Style.FILL);
paint.setStrokeCap(Cap.ROUND);
this.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
toggle();
}
});
TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.ToggleButton);
offBorderColor = typedArray.getColor(R.styleable.ToggleButton_offBorderColor, offBorderColor);
onColor = typedArray.getColor(R.styleable.ToggleButton_onColor, onColor);
spotColor = typedArray.getColor(R.styleable.ToggleButton_spotColor, spotColor);
offColor = typedArray.getColor(R.styleable.ToggleButton_offColor, offColor);
borderWidth = typedArray.getDimensionPixelSize(R.styleable.ToggleButton_toggle_border_width, borderWidth);
typedArray.recycle();
}
示例7: UpdateCanvas
import android.graphics.Paint.Cap; //導入依賴的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();
}
示例8: RoundProgressBarWidthNumber
import android.graphics.Paint.Cap; //導入依賴的package包/類
public RoundProgressBarWidthNumber(Context context, AttributeSet attrs) {
super(context, attrs);
mReachedProgressBarHeight = (int) (mUnReachedProgressBarHeight * 2.5f);
TypedArray ta = context.obtainStyledAttributes(attrs,
R.styleable.RoundProgressBarWidthNumber);
mRadius = (int) ta.getDimension(
R.styleable.RoundProgressBarWidthNumber_radius, mRadius);
ta.recycle();
mPaint.setStyle(Style.STROKE);
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mPaint.setStrokeCap(Cap.ROUND);
}
示例9: Graphics
import android.graphics.Paint.Cap; //導入依賴的package包/類
/**
* Construct
*
* @param canvas0 canvas
*/
public Graphics(final Canvas canvas0)
{
super();
this.canvas = canvas0;
// if (theScale != 1F)
// this.canvas.scale(theScale, theScale, this.canvas.getWidth() / 2F, this.canvas.getHeight() / 2F);
// if (Graphics.scale != 1F)
// this.theCanvas.scale(Graphics.scale, Graphics.scale, this.theCanvas.getWidth() / 2F, this.theCanvas.getHeight() / 2F);
this.paint = new Paint();
this.paint.setAntiAlias(true);
this.paint.setHinting(Paint.HINTING_ON); // font
this.paint.setStrokeWidth(2);
this.paint.setStrokeCap(Cap.BUTT);
this.paint.setStrokeJoin(Join.BEVEL);
this.paint.setStrokeMiter(1);
this.paint.setColor(android.graphics.Color.WHITE);
}
示例10: LineChartRenderer
import android.graphics.Paint.Cap; //導入依賴的package包/類
public LineChartRenderer(Context context, Chart chart, LineChartDataProvider dataProvider) {
super(context, chart);
this.dataProvider = dataProvider;
this.touchToleranceMargin = ChartUtils.dp2px(this.density, 4);
this.linePaint.setAntiAlias(true);
this.linePaint.setStyle(Style.STROKE);
this.linePaint.setStrokeCap(Cap.ROUND);
this.linePaint.setStrokeWidth((float) ChartUtils.dp2px(this.density, 3));
this.pointPaint.setAntiAlias(true);
this.pointPaint.setStyle(Style.FILL);
this.weightStrPaint.setAntiAlias(true);
this.weightStrPaint.setColor(-1);
this.weightStrPaint.setTextSize((float) ChartUtils.dp2px(this.density, 12));
this.weightLinePaint.setAntiAlias(true);
this.weightLinePaint.setStyle(Style.STROKE);
this.weightLinePaint.setStrokeWidth((float) ChartUtils.dp2px(this.density, 1));
this.weightLinePaint.setColor(ChartUtils.DEFAULT_TARGET_COLOR);
this.checkPrecision = ChartUtils.dp2px(this.density, 2);
}
示例11: PieChartRenderer
import android.graphics.Paint.Cap; //導入依賴的package包/類
public PieChartRenderer(Context context, Chart chart, PieChartDataProvider dataProvider) {
super(context, chart);
this.dataProvider = dataProvider;
this.touchAdditional = ChartUtils.dp2px(this.density, 8);
this.slicePaint.setAntiAlias(true);
this.slicePaint.setStyle(Style.FILL);
this.centerCirclePaint.setAntiAlias(true);
this.centerCirclePaint.setStyle(Style.FILL);
this.centerCirclePaint.setXfermode(new PorterDuffXfermode(Mode.SRC));
this.centerCircleText1Paint.setAntiAlias(true);
this.centerCircleText1Paint.setTextAlign(Align.CENTER);
this.centerCircleText2Paint.setAntiAlias(true);
this.centerCircleText2Paint.setTextAlign(Align.CENTER);
this.separationLinesPaint.setAntiAlias(true);
this.separationLinesPaint.setStyle(Style.STROKE);
this.separationLinesPaint.setStrokeCap(Cap.ROUND);
this.separationLinesPaint.setXfermode(new PorterDuffXfermode(Mode.CLEAR));
this.separationLinesPaint.setColor(0);
}
示例12: ColumnChartRenderer
import android.graphics.Paint.Cap; //導入依賴的package包/類
public ColumnChartRenderer(Context context, Chart chart, ColumnChartDataProvider dataProvider) {
super(context, chart);
this.dataProvider = dataProvider;
this.subcolumnSpacing = ChartUtils.dp2px(this.density, 1);
this.touchAdditionalWidth = ChartUtils.dp2px(this.density, 4);
this.columnPaint.setAntiAlias(true);
this.columnPaint.setStyle(Style.FILL);
this.columnPaint.setStrokeCap(Cap.SQUARE);
this.caloryLinePaint.setAntiAlias(true);
this.caloryLinePaint.setStyle(Style.STROKE);
this.caloryLinePaint.setStrokeWidth((float) ChartUtils.dp2px(this.density, 1));
this.caloryLinePaint.setColor(ChartUtils.DEFAULT_TARGET_COLOR);
this.caloryTextPaint.setAntiAlias(true);
this.caloryTextPaint.setStyle(Style.FILL);
this.caloryTextPaint.setTextSize((float) ChartUtils.dp2px(this.density, 12));
this.caloryTextPaint.setColor(ChartUtils.COLOR_BACKGROUND);
}
示例13: init
import android.graphics.Paint.Cap; //導入依賴的package包/類
private void init(Context context) {
setLayerType(1, null);
this.LINE_WIDTH = DensityUtil.dip2px(context, (float) this.LINE_WIDTH);
this.POINT_WIDTH = DensityUtil.dip2px(context, (float) this.POINT_WIDTH);
this.linePaint = new Paint();
this.linePaint.setAntiAlias(true);
this.linePaint.setColor(-2826241);
this.linePaint.setStyle(Style.STROKE);
this.linePaint.setStrokeWidth((float) this.LINE_WIDTH);
this.pointPaint = new Paint();
this.pointPaint.setAntiAlias(true);
this.pointPaint.setColor(-8874003);
this.pointPaint.setStrokeCap(Cap.ROUND);
this.pointPaint.setStyle(Style.STROKE);
this.pointPaint.setStrokeWidth((float) this.POINT_WIDTH);
}
示例14: init
import android.graphics.Paint.Cap; //導入依賴的package包/類
private void init(Context context) {
setLayerType(1, null);
this.mContext = context;
this.lineHeight = DensityUtil.dip2px(context, (float) this.lineHeight);
this.textSize = DensityUtil.dip2px(context, (float) this.textSize);
this.textPaint = new Paint();
this.textPaint.setAntiAlias(true);
this.textPaint.setTextSize((float) this.textSize);
this.textPaint.setTextAlign(Align.LEFT);
this.textPaint.setColor(AbstractWheelTextAdapter.DEFAULT_TEXT_COLOR);
this.dividerPaint = new Paint();
this.dividerPaint.setAntiAlias(true);
this.dividerPaint.setTextSize((float) this.textSize);
this.dividerPaint.setTextAlign(Align.LEFT);
this.dividerPaint.setColor(-1);
this.dividerPaint.setStrokeWidth(2.0f);
this.backgroundPaint = new Paint();
this.backgroundPaint.setAntiAlias(true);
this.backgroundPaint.setStyle(Style.FILL_AND_STROKE);
this.backgroundPaint.setStrokeCap(Cap.ROUND);
}
示例15: init
import android.graphics.Paint.Cap; //導入依賴的package包/類
private void init(Context context) {
setLayerType(1, null);
this.ARC_WIDTH = DensityUtil.dip2px(context, (float) this.ARC_WIDTH);
this.SMALL_CIRCLE_WIDTH = DensityUtil.dip2px(context, (float) this.SMALL_CIRCLE_WIDTH);
this.mBackgroundPaint = new Paint();
this.mBackgroundPaint.setAntiAlias(true);
this.mBackgroundPaint.setStrokeWidth((float) this.ARC_WIDTH);
this.mBackgroundPaint.setStyle(Style.STROKE);
this.mBackgroundPaint.setStrokeCap(Cap.ROUND);
this.mCirclePaint = new Paint();
this.mCirclePaint.setAntiAlias(true);
this.mCirclePaint.setColor(-1);
this.mCirclePaint.setStrokeWidth((float) this.SMALL_CIRCLE_WIDTH);
this.mCirclePaint.setStyle(Style.STROKE);
this.mCirclePaint.setStrokeCap(Cap.ROUND);
}