當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。