當前位置: 首頁>>代碼示例>>Java>>正文


Java Paint.getStrokeWidth方法代碼示例

本文整理匯總了Java中android.graphics.Paint.getStrokeWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java Paint.getStrokeWidth方法的具體用法?Java Paint.getStrokeWidth怎麽用?Java Paint.getStrokeWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.Paint的用法示例。


在下文中一共展示了Paint.getStrokeWidth方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: draw

import android.graphics.Paint; //導入方法依賴的package包/類
public void draw(Canvas g2, float x, float y) {
	g2.save();
	Paint st = AjLatexMath.getPaint();
	int c = st.getColor();
	Style s = st.getStyle();
	float w = st.getStrokeWidth();

	g2.translate(x + 0.25f * height / 2.15f, y - 1.75f / 2.15f * height);
	st.setColor(gray);
	st.setStrokeWidth(3.79999995f);
	g2.scale(0.05f * height / 2.15f, 0.05f * height / 2.15f);
	g2.rotate((float) Math.toDegrees((-26 * Math.PI / 180)), 20.5f, 17.5f);
	g2.drawArc(new RectF(0f, 0f, 43f, 32f), 0f, 360f, false, st);
	g2.rotate((float) Math.toDegrees((26 * Math.PI / 180)), 20.5f, 17.5f);
	st.setStyle(Style.STROKE);
	drawCircle(st, g2, 16f, -5f);
	drawCircle(st, g2, -1f, 7f);
	drawCircle(st, g2, 5f, 28f);
	drawCircle(st, g2, 27f, 24f);
	drawCircle(st, g2, 36f, 3f);

	st.setColor(c);
	st.setStyle(s);
	st.setStrokeWidth(w);
	g2.restore();
}
 
開發者ID:daquexian,項目名稱:FlexibleRichTextView,代碼行數:27,代碼來源:GeoGebraLogoBox.java

示例5: 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

示例6: drawNeedle

import android.graphics.Paint; //導入方法依賴的package包/類
/**
 * Returns the angle for a specific chart value.
 * 
 * @param canvas the canvas
 * @param angle the needle angle value
 * @param centerX the center x value
 * @param centerY the center y value
 * @param radius the radius
 * @param arrow if a needle or an arrow to be painted
 * @param paint the paint settings
 * @return the angle
 */
private void drawNeedle(Canvas canvas, double angle, int centerX, int centerY, double radius,
    boolean arrow, Paint paint) {
  double diff = Math.toRadians(90);
  int needleSinValue = (int) (NEEDLE_RADIUS * Math.sin(angle - diff));
  int needleCosValue = (int) (NEEDLE_RADIUS * Math.cos(angle - diff));
  int needleX = (int) (radius * Math.sin(angle));
  int needleY = (int) (radius * Math.cos(angle));
  int needleCenterX = centerX + needleX;
  int needleCenterY = centerY + needleY;
  float[] points;
  if (arrow) {
    int arrowBaseX = centerX + (int) (radius * 0.85 * Math.sin(angle));
    int arrowBaseY = centerY + (int) (radius * 0.85 * Math.cos(angle));
    points = new float[] { arrowBaseX - needleSinValue, arrowBaseY - needleCosValue,
        needleCenterX, needleCenterY, arrowBaseX + needleSinValue, arrowBaseY + needleCosValue };
    float width = paint.getStrokeWidth();
    paint.setStrokeWidth(5);
    canvas.drawLine(centerX, centerY, needleCenterX, needleCenterY, paint);
    paint.setStrokeWidth(width);
  } else {
    points = new float[] { centerX - needleSinValue, centerY - needleCosValue, needleCenterX,
        needleCenterY, centerX + needleSinValue, centerY + needleCosValue };
  }
  drawPath(canvas, points, paint, true);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:38,代碼來源:DialChart.java

示例7: drawPressPoint

import android.graphics.Paint; //導入方法依賴的package包/類
/**
 * 繪製按下狀態的點
 *
 * @param point      單位點
 * @param canvas     畫布
 * @param pressPaint 按下狀態畫筆
 */
@Override
public void drawPressPoint(Point point, Canvas canvas, Paint pressPaint) {
    // 1.記錄畫筆的原始屬性(繪製過程中需要修改的屬性),繪製結束時進行還原
    Paint.Style style = pressPaint.getStyle();
    float originStrokeWidth = pressPaint.getStrokeWidth();
    // 2.繪製實心點
    pressPaint.setStyle(Paint.Style.FILL);
    canvas.drawCircle(point.x, point.y, point.radius / 3, pressPaint);
    // 3.繪製空心圓邊界
    pressPaint.setStyle(Paint.Style.STROKE);
    pressPaint.setStrokeWidth(point.radius / 16);
    canvas.drawCircle(point.x, point.y, point.radius, pressPaint);
    // 4.結束繪製,還原畫筆屬性
    pressPaint.setStyle(style);
    pressPaint.setStrokeWidth(originStrokeWidth);
}
 
開發者ID:sinawangnan7,項目名稱:GestureLockView,代碼行數:24,代碼來源:GestureLockPainter.java

示例8: 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

示例9: applyDrawnDivider

import android.graphics.Paint; //導入方法依賴的package包/類
/**
 * Procedure meant to handle the drawing stage of a {@link SimpleDividerItemDecoration}'s divider, via
 * {@link Paint} object.
 * @param canvas the {@link Canvas} object where the divider will be drawn.
 * @param parent the parent {@link RecyclerView} for the applied {@link SimpleDividerItemDecoration}.
 * @param state the parent {@link RecyclerView.State} for the applied {@link SimpleDividerItemDecoration}.
 * @param drawnDivider the configured divider's {@link Paint} object.
 * @param position the divider's target position. This value is ranged.
 *                 See {@link GenericDecorationDividerPosition} for more information.
 */
public void applyDrawnDivider(@NonNull final Canvas canvas, @NonNull final RecyclerView parent,
                              @NonNull final RecyclerView.State state, @NonNull final Paint drawnDivider,
                              @IntRange(from = 0, to = 5) final int position) {
    /* The stroke width was set in the spec, but to correctly draw the line we have to offset by width / 2 */
    final int offset = (int) (drawnDivider.getStrokeWidth() / 2);

    /* This will iterate over every visible view */
    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View view = parent.getChildAt(i); // get the view
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams();
        final int pos = params.getViewAdapterPosition(); // get the position

        /* Draw the separator */
        if (pos < state.getItemCount()) {
            if (drawnDivider.getStyle().equals(Paint.Style.STROKE)) {
                mDrawnDividerHelper.drawDottedDivider(canvas, view, offset, drawnDivider, position);
            } else {
                mDrawnDividerHelper.drawLineDivider(canvas, view, offset, drawnDivider, position);
            }

        }
    }
}
 
開發者ID:Simdea,項目名稱:gmlrva,代碼行數:35,代碼來源:DecoratorDrawOverManager.java

示例10: 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

示例11: drawDotLine

import android.graphics.Paint; //導入方法依賴的package包/類
/**
 * 點線を描畫する
 * canvas.drawLineと同様の使い方ができると考えてよい

 * @param canvas
 * @param x1
 * @param y1
 * @param x2
 * @param y2
 * @param paint
 */
private void drawDotLine(Canvas canvas,float x1,float y1,float x2,float y2,Paint paint){
    float x=(x2-x1)/(float)Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    float y=(y2-y1)/(float)Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    float loop = paint.getStrokeWidth() * 2;
    if(x>y) {
        for (int i = 0; i < (x2 - x1) / (loop) / x; i++) {
            canvas.drawPoint(x1 + (loop) * x * i, y1 + (loop) * y * i, paint);
        }
    }
    for (int i = 0; i < (y2 - y1) / (loop) / y; i++) {
        canvas.drawPoint(x1 + (loop) * x * i, y1 + (loop) * y * i, paint);
    }
}
 
開發者ID:KameLong,項目名稱:AOdia,代碼行數:25,代碼來源:DiagramView.java

示例12: doLimits

import android.graphics.Paint; //導入方法依賴的package包/類
private void doLimits(RectF box, Paint paint) {
	Matrix m = matrixStack.getLast();
	m.mapRect(tmpLimitRect, box);
	float width2 = (paint == null) ? 0 : paint.getStrokeWidth() / 2;
	doLimits2(tmpLimitRect.left - width2, tmpLimitRect.top - width2);
	doLimits2(tmpLimitRect.right + width2, tmpLimitRect.bottom + width2);
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:8,代碼來源:SVGParser.java

示例13: tableBorderWidth

import android.graphics.Paint; //導入方法依賴的package包/類
public int tableBorderWidth(@NonNull Paint paint) {
    final int out;
    if (tableBorderWidth == -1) {
        out = (int) (paint.getStrokeWidth() + .5F);
    } else {
        out = tableBorderWidth;
    }
    return out;
}
 
開發者ID:noties,項目名稱:Markwon,代碼行數:10,代碼來源:SpannableTheme.java

示例14: drawNormalPoint

import android.graphics.Paint; //導入方法依賴的package包/類
/**
 * 繪製正常狀態的點
 *
 * @param point       單位點
 * @param canvas      畫布
 * @param normalPaint 正常狀態畫筆
 */
@Override
public void drawNormalPoint(Point point, Canvas canvas, Paint normalPaint) {
    // 1.記錄畫筆的原始屬性(繪製過程中需要修改的屬性),繪製結束時進行還原
    Paint.Style style = normalPaint.getStyle();
    float originStrokeWidth = normalPaint.getStrokeWidth();
    // 2.繪製空心圓邊界
    normalPaint.setStyle(Paint.Style.STROKE);
    normalPaint.setStrokeWidth(point.radius / 32);
    canvas.drawCircle(point.x, point.y, point.radius, normalPaint);
    // 3.結束繪製,還原畫筆屬性
    normalPaint.setStyle(style);
    normalPaint.setStrokeWidth(originStrokeWidth);
}
 
開發者ID:sinawangnan7,項目名稱:GestureLockView,代碼行數:21,代碼來源:GestureLockPainter.java

示例15: draw

import android.graphics.Paint; //導入方法依賴的package包/類
public void draw(Canvas g2, float x, float y) {
	Paint st = AjLatexMath.getPaint();
	/*
	 * AffineTransform transf = g2.getTransform(); Stroke oldStroke =
	 * g2.getStroke();
	 * 
	 * final double sx = transf.getScaleX(); final double sy =
	 * transf.getScaleY();
	 */
	float s = 1;
	/*
	 * if (sx == sy) { // There are rounding problems due to scale factor:
	 * lines could have different // spacing... // So the increment
	 * (space+thickness) is done in using integer. s = sx; AffineTransform t
	 * = (AffineTransform) transf.clone(); t.scale(1 / sx, 1 / sy);
	 * g2.setTransform(t); }
	 */
	float w = st.getStrokeWidth();
	Style ss = st.getStyle();
	st.setStrokeWidth((float) (s * thickness));
	st.setStyle(Style.STROKE);
	float th = thickness / 2.f;
	float xx = x + space;
	xx = (float) (xx * s + (space / 2.f) * s);
	final int inc = (int) Math.round((space + thickness) * s);

	for (int i = 0; i < N; i++) {
		g2.drawLine(xx + th * s, (y - height) * s, xx + th * s, y * s, st);
		xx += inc;
	}

	if (strike) {
		g2.drawLine((x + space) * s, (y - height / 2.f) * s, xx - s * space
				/ 2, (y - height / 2.f) * s, st);
	}

	// g2.setTransform(transf);
	// g2.setStroke(oldStroke);
	st.setStrokeWidth(w);
	st.setStyle(ss);
}
 
開發者ID:daquexian,項目名稱:FlexibleRichTextView,代碼行數:42,代碼來源:FcscoreBox.java


注:本文中的android.graphics.Paint.getStrokeWidth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。