本文整理汇总了Java中android.graphics.Paint.Style方法的典型用法代码示例。如果您正苦于以下问题:Java Paint.Style方法的具体用法?Java Paint.Style怎么用?Java Paint.Style使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Paint
的用法示例。
在下文中一共展示了Paint.Style方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: withDrawnDivider
import android.graphics.Paint; //导入方法依赖的package包/类
/**
* Procedure meant to set the value for {@link #mDrawnDivider} optional parameter.
* @param color the divider's target {@link Color} value.
* See {@link Paint#setColor(int)} for more information.
* @param thickness the divider's target line thickness value. This value must be greater or equal than 0.
* See {@link Paint#setStrokeWidth(float)} for more information.
* @param style the divider's target {@link Paint.Style}.
* See {@link Paint#setStyle(Paint.Style)} for more information.
* @param pathEffect the divider's target {@link PathEffect}.
* See {@link Paint#setPathEffect(PathEffect)} for more information.
* @return the same object builder object after setting the optional attribute.
*/
@NonNull
public DecorationSpecBuilder withDrawnDivider(@ColorInt int color,
@FloatRange(from = 0, fromInclusive = false) float thickness,
@Nullable final Paint.Style style,
@Nullable final PathEffect pathEffect) {
mDrawnDivider = new Paint();
mDrawnDivider.setColor(color);
mDrawnDivider.setStrokeWidth(thickness);
if (style != null) {
mDrawnDivider.setStyle(style);
}
if (pathEffect != null) {
mDrawnDivider.setPathEffect(pathEffect);
}
return this;
}
示例2: draw
import android.graphics.Paint; //导入方法依赖的package包/类
@Override
public void draw(@NonNull final Canvas canvas, final CharSequence text,
@IntRange(from = 0) final int start,
@IntRange(from = 0) final int end,
final float x, final int top, final int y, final int bottom,
@NonNull final Paint paint) {
Paint.Style style = paint.getStyle();
int color = paint.getColor();
paint.setStyle(Paint.Style.FILL);
paint.setColor(this.color);
canvas.drawRect(x, top, x + width, bottom, paint);
paint.setStyle(style);
paint.setColor(color);
}
示例3: drawLeadingMargin
import android.graphics.Paint; //导入方法依赖的package包/类
public void drawLeadingMargin(Canvas c, Paint p, int x, int dir,
int top, int baseline, int bottom,
CharSequence text, int start, int end,
boolean first, Layout layout) {
Paint.Style style = p.getStyle();
int color = p.getColor();
p.setStyle(Paint.Style.FILL);
p.setColor(this.color);
c.drawRect(x, top, x + dir * stripeWidth, bottom, p);
p.setStyle(style);
p.setColor(color);
}
示例4: drawFilledPath
import android.graphics.Paint; //导入方法依赖的package包/类
/**
* Draws the provided path in filled mode with the provided color and alpha.
* Special thanks to Angelo Suzuki (https://github.com/tinsukE) for this.
*
* @param c
* @param filledPath
* @param fillColor
* @param fillAlpha
*/
protected void drawFilledPath(Canvas c, Path filledPath, int fillColor, int fillAlpha) {
int color = (fillAlpha << 24) | (fillColor & 0xffffff);
if (clipPathSupported()) {
int save = c.save();
c.clipPath(filledPath);
c.drawColor(color);
c.restoreToCount(save);
} else {
// save
Paint.Style previous = mRenderPaint.getStyle();
int previousColor = mRenderPaint.getColor();
// set
mRenderPaint.setStyle(Paint.Style.FILL);
mRenderPaint.setColor(color);
c.drawPath(filledPath, mRenderPaint);
// restore
mRenderPaint.setColor(previousColor);
mRenderPaint.setStyle(previous);
}
}
示例5: draw
import android.graphics.Paint; //导入方法依赖的package包/类
@Override
public void draw(@NonNull Canvas canvas) {
final Paint.Style style;
final int color;
if (isChecked) {
style = Paint.Style.FILL_AND_STROKE;
color = checkedFillColor;
} else {
style = Paint.Style.STROKE;
color = normalOutlineColor;
}
paint.setStyle(style);
paint.setColor(color);
final Rect bounds = getBounds();
final float left = (bounds.width() - rectF.width()) / 2;
final float top = (bounds.height() - rectF.height()) / 2;
final float radius = rectF.width() / 8;
final int save = canvas.save();
try {
canvas.translate(left, top);
canvas.drawRoundRect(rectF, radius, radius, paint);
if (isChecked) {
canvas.drawPath(checkMarkPath, checkMarkPaint);
}
} finally {
canvas.restoreToCount(save);
}
}
示例6: CandlestickValue
import android.graphics.Paint; //导入方法依赖的package包/类
public CandlestickValue(float high, float low, float open, float close, Paint.Style mPaintStyle,
int color) {
this.high = high;
this.low = low;
this.open = open;
this.close = close;
this.mPaintStyle = mPaintStyle;
this.color = color;
}
示例7: getPaint
import android.graphics.Paint; //导入方法依赖的package包/类
public static Paint getPaint(Paint.Style style, int color) {
Paint mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setStyle(style);
mPaint.setColor(color);
mPaint.setTextSize(30);
return mPaint;
}
示例8: drawLeadingMargin
import android.graphics.Paint; //导入方法依赖的package包/类
public void drawLeadingMargin(final Canvas c, final Paint p, final int x, final int dir,
final int top, final int baseline, final int bottom,
final CharSequence text, final int start, final int end,
final boolean first, final Layout layout) {
Paint.Style style = p.getStyle();
int color = p.getColor();
p.setStyle(Paint.Style.FILL);
p.setColor(this.color);
c.drawRect(x, top, x + dir * stripeWidth, bottom, p);
p.setStyle(style);
p.setColor(color);
}
示例9: drawLeadingMargin
import android.graphics.Paint; //导入方法依赖的package包/类
@Override
public void drawLeadingMargin(Canvas c, Paint p, int x, int dir, int top, int baseline, int bottom,
CharSequence text, int start, int end, boolean first, Layout layout) {
Paint.Style style = p.getStyle();
int paintColor = p.getColor();
p.setStyle(Paint.Style.FILL);
p.setColor(stripeColor);
c.drawRect(x, top, x + dir * stripeWidth, bottom, p);
p.setStyle(style);
p.setColor(paintColor);
}
示例10: getHourHandStyle
import android.graphics.Paint; //导入方法依赖的package包/类
public Paint.Style getHourHandStyle() {
return hourHandStyle;
}
示例11: getDecreasingPaintStyle
import android.graphics.Paint; //导入方法依赖的package包/类
@Override
public Paint.Style getDecreasingPaintStyle() {
return mDecreasingPaintStyle;
}
示例12: setStyle
import android.graphics.Paint; //导入方法依赖的package包/类
public void setStyle(Paint.Style style) {
paint.setStyle(style);
}
示例13: setIncreasingPaintStyle
import android.graphics.Paint; //导入方法依赖的package包/类
public void setIncreasingPaintStyle(Paint.Style increasingPaintStyle) {
this.mIncreasingPaintStyle = increasingPaintStyle;
}
示例14: BarValue
import android.graphics.Paint; //导入方法依赖的package包/类
public BarValue(float value1, float value2, int color, Paint.Style paintStyle) {
this.yValues = new float[] {value1, value2};
this.mColor = color;
this.mPaintStyle = paintStyle;
}
示例15: getSecondHandStyle
import android.graphics.Paint; //导入方法依赖的package包/类
public Paint.Style getSecondHandStyle() {
return secondHandStyle;
}