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


Java Paint.getStyle方法代码示例

本文整理汇总了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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:SpanUtils.java

示例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);
}
 
开发者ID:PaulKlinger,项目名称:Sprog-App,代码行数:21,代码来源:FancyQuoteSpan.java

示例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();

}
 
开发者ID:daquexian,项目名称:FlexibleRichTextView,代码行数:26,代码来源:ShadowBox.java

示例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);
   }
 
开发者ID:daquexian,项目名称:FlexibleRichTextView,代码行数:19,代码来源:HorizontalRule.java

示例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);
}
 
开发者ID:sinawangnan7,项目名称:GestureLockView,代码行数:24,代码来源:GestureLockPainter.java

示例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);
	}
 
开发者ID:daquexian,项目名称:FlexibleRichTextView,代码行数:22,代码来源:JavaFontRenderingBox.java

示例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);
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:20,代码来源:FlatChart.java

示例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);
}
 
开发者ID:daquexian,项目名称:FlexibleRichTextView,代码行数:18,代码来源:OvalBox.java

示例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);
    }
}
 
开发者ID:SysdataSpA,项目名称:SDHtmlTextView,代码行数:18,代码来源:ListItemSpan.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:SpanUtils.java

示例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);
}
 
开发者ID:hoangkien0705,项目名称:Android-UtilCode,代码行数:16,代码来源:SpannableStringUtils.java

示例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);
}
 
开发者ID:daquexian,项目名称:FlexibleRichTextView,代码行数:30,代码来源:FramedBox.java

示例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);
}
 
开发者ID:pan2yong22,项目名称:AndroidUtilCode-master,代码行数:14,代码来源:SpanUtils.java

示例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);
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:12,代码来源:MarkDownQuoteSpan.java

示例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);
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:12,代码来源:CodeBackgroundRoundedSpan.java


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