本文整理匯總了Java中android.graphics.Paint.getStyle方法的典型用法代碼示例。如果您正苦於以下問題:Java Paint.getStyle方法的具體用法?Java Paint.getStyle怎麽用?Java Paint.getStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.Paint
的用法示例。
在下文中一共展示了Paint.getStyle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: 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 prevStyle = p.getStyle();
int prevColor = p.getColor();
p.setStyle(Paint.Style.FILL);
p.setColor(lineColor);
c.drawRect(x, top, x + dir * lineWidth, bottom, p);
p.setStyle(prevStyle);
p.setColor(prevColor);
}
示例3: draw
import android.graphics.Paint; //導入方法依賴的package包/類
public void draw(Canvas g2, float x, float y) {
float th = thickness / 2;
box.draw(g2, x + space + thickness, y);
Paint st = AjLatexMath.getPaint();
float w = st.getStrokeWidth();
int c = st.getColor();
Style s = st.getStyle();
st.setStrokeWidth(thickness);
st.setStyle(Style.STROKE);
float penth = 0;// (float) Math.abs(1 / g2.getTransform().getScaleX());
g2.drawRect(x + th, y - height + th, x + th + width - shadowRule
- thickness, y + th + depth - shadowRule - thickness, st);
st.setStyle(Style.FILL);
g2.drawRect(x + shadowRule - penth, y + depth - shadowRule - penth, x
- penth + width, y + depth - penth, st);
g2.drawRect(x + width - shadowRule - penth, y - height + th
+ shadowRule, x + width - penth, y + shadowRule + depth - 2
* shadowRule, st);
st.setColor(c);
st.setStrokeWidth(w);
st.setStyle(s);
st.clearShadowLayer();
}
示例4: draw
import android.graphics.Paint; //導入方法依賴的package包/類
public void draw(Canvas g2, float x, float y) {
Paint st = AjLatexMath.getPaint();
Style s = st.getStyle();
float w = st.getStrokeWidth();
st.setStyle(Style.FILL);
st.setStrokeWidth(0);
int c = st.getColor();
if (color != null)
st.setColor(color);
if (speShift == 0) {
g2.drawRect(x, y - height, x + width, y, st);
} else {
g2.drawRect(x, y - height + speShift, x + width, y + speShift, st);
}
st.setColor(c);
st.setStyle(s);
st.setStrokeWidth(w);
}
示例5: drawErrorPoint
import android.graphics.Paint; //導入方法依賴的package包/類
/**
* 繪製出錯狀態的點
*
* @param point 單位點
* @param canvas 畫布
* @param errorPaint 錯誤狀態畫筆
*/
@Override
public void drawErrorPoint(Point point, Canvas canvas, Paint errorPaint) {
// 1.記錄畫筆的原始屬性(繪製過程中需要修改的屬性),繪製結束時進行還原
Paint.Style style = errorPaint.getStyle();
float originStrokeWidth = errorPaint.getStrokeWidth();
// 2.繪製實心點
errorPaint.setStyle(Paint.Style.FILL);
canvas.drawCircle(point.x, point.y, point.radius / 3, errorPaint);
// 3.繪製空心圓
errorPaint.setStyle(Paint.Style.STROKE);
errorPaint.setStrokeWidth(point.radius / 16);
canvas.drawCircle(point.x, point.y, point.radius, errorPaint);
// 4.結束繪製,還原畫筆屬性
errorPaint.setStyle(style);
errorPaint.setStrokeWidth(originStrokeWidth);
}
示例6: draw
import android.graphics.Paint; //導入方法依賴的package包/類
public void draw(Canvas g2, float x, float y) {
drawDebug(g2, x, y);
// Paint st=AjLatexMath.getPaint();
// st.setTextSize(AjLatexMath.getTextSize());
Paint st =new Paint();
float w = st.getStrokeWidth();
Style s = st.getStyle();
Typeface f = st.getTypeface();
st.setStrokeWidth(0);//
st.setStyle(Style.FILL_AND_STROKE);
st.setTypeface(font);
g2.save();
g2.translate(x, y);
g2.scale(0.5f * size, 0.5f * size);
// g2.drawText(str, x, y, st);
g2.drawText(str, 0, 0, st);
g2.restore();
st.setStyle(s);
st.setStrokeWidth(w);
st.setTypeface(f);
}
示例7: drawBackground
import android.graphics.Paint; //導入方法依賴的package包/類
/**
* Draws the chart background.
*/
public void drawBackground(Canvas canvas, double x, double y, double width, double height,
Paint paint, com.cyzapps.VisualMFP.Color newColor) {
int nPaintOriginalColor = paint.getColor();
Style stylePaintOriginalStyle = paint.getStyle();
if (newColor != null) { // a valid color
paint.setColor(newColor.getARGB());
} else if (mcolorBkGrnd != null) {
paint.setColor(mcolorBkGrnd.getARGB());
}
paint.setStyle(Style.FILL);
float fLeft = (float)x, fTop = (float)y, fRight = (float)(x + width), fBottom = (float)(y + height);
canvas.drawRect(fLeft, fTop, fRight, fBottom, paint);
// restore paint attribute.
paint.setStyle(stylePaintOriginalStyle);
paint.setColor(nPaintOriginalColor);
}
示例8: draw
import android.graphics.Paint; //導入方法依賴的package包/類
public void draw(Canvas g2, float x, float y) {
box.draw(g2, x + space + thickness, y);
Paint st = AjLatexMath.getPaint();
float w = st.getStrokeWidth();
st.setStrokeWidth(thickness);
Style s = st.getStyle();
st.setStyle(Style.STROKE);
float th = thickness / 2;
float r = 0.5f * Math
.min(width - thickness, height + depth - thickness);
g2.drawRoundRect(new RectF(x + th, y - height + th, x + th + width
- thickness, y - height + th + height + depth - thickness), r,
r, st);
st.setStrokeWidth(w);
st.setStyle(s);
// drawDebug(g2, x, y);
}
示例9: 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 l) {
if (((Spanned) text).getSpanStart(this) == start) {
Paint.Style style = p.getStyle();
p.setStyle(Paint.Style.FILL);
if (mNumber != -1) {
c.drawText(mNumber + ".", x + dir, baseline, p);
} else {
c.drawText("\u2022", x + dir, baseline, p);
}
p.setStyle(style);
}
}
示例10: 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);
}
示例11: 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);
}
示例12: draw
import android.graphics.Paint; //導入方法依賴的package包/類
public void draw(Canvas g2, float x, float y) {
Paint st = AjLatexMath.getPaint();
float w = st.getStrokeWidth();
Style s = st.getStyle();
int c = st.getColor();
st.setStrokeWidth(thickness);
st.setStyle(Style.FILL_AND_STROKE);
float th = thickness / 2;
if (bg != null) {
st.setColor(bg);
g2.drawRect(x + th, y - height + th, x + th + width - thickness, y
+ th + depth - thickness, st);
}
st.setStyle(Style.STROKE);
if (line != null) {
st.setColor(line);
g2.drawRect(x + th, y - height + th, x + th + width - thickness, y
+ th + depth - thickness, st);
} else {
g2.drawRect(x + th, y - height + th, x + th + width - thickness, y
+ th + depth - thickness, st);
}
// drawDebug(g2, x, y);
st.setStrokeWidth(w);
st.setStyle(s);
box.draw(g2, x + space + thickness, y);
// st.setStyle(s);
st.setColor(c);
}
示例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) {
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);
}
示例14: 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 color = p.getColor();
p.setStyle(Paint.Style.FILL);
p.setColor(getColor());
c.drawRect(x, top, x + dir * STRIPE_WIDTH, bottom, p);
p.setStyle(style);
p.setColor(color);
}
示例15: drawBackground
import android.graphics.Paint; //導入方法依賴的package包/類
@Override public void drawBackground(Canvas c, Paint p, int left, int right, int top, int baseline, int bottom,
CharSequence text, int start, int end, int lnum) {
Paint.Style style = p.getStyle();
int color = p.getColor();
p.setStyle(Paint.Style.FILL);
p.setColor(this.color);
rect.set(left, top, right, bottom);
c.drawRect(rect, p);
p.setColor(color);
p.setStyle(style);
}