当前位置: 首页>>代码示例>>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;未经允许,请勿转载。