public AuxiliaryLine(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
previewwidth = getWidth();
previewheight = getHeight();
Log.e("AuxiliaryLine", " 长宽为" + previewwidth + "*" + previewheight);
type = 0;
myPaint = new Paint();
myPaint.setColor(Color.rgb(230, 230, 230));
myPaint.setStyle(Paint.Style.STROKE);
myPaint.setStrokeWidth(1);
myPaint.setAntiAlias(true);
PathEffect effects = new DashPathEffect(new float[]{8,8,8,8},0.5f);
myPaint.setPathEffect(effects);
}
java类android.graphics.PathEffect的实例源码
AuxiliaryLine.java 文件源码
项目:WiCamera3D
阅读 23
收藏 0
点赞 0
评论 0
PanoramaProgressIndicator.java 文件源码
项目:WiCamera3D
阅读 24
收藏 0
点赞 0
评论 0
@Override
protected void onDraw(Canvas canvas) {
//画背景图片
if(mType==0)
{
if(isToFast||isWrongPose)
{
canvas.drawBitmap(backgroundWrongImage, src, des, null);
}
else
{
canvas.drawBitmap(backgroundImage, src, des, null);
}
}
else
{
canvas.drawBitmap(backgroundImage, src, des, null);
}
float rate_src= getRate();
//画进度条
canvas.drawBitmap(progressImage, getSrcRect(src,rate_src), getDesRect(des,rate_src), null);
if(mType==0)
{
canvas.drawLine(0, 0.5f*viewheight, viewwidth, 0.5f*viewheight, mLinePaint_);
Path path = new Path();
path.moveTo(0, linestart);
path.lineTo(viewwidth,viewheight-linestart);
PathEffect effects = new DashPathEffect(new float[]{6,6,6,6},1);
mLinePaint.setPathEffect(effects);
canvas.drawPath(path, mLinePaint);
// canvas.drawLine(0, linestart, viewwidth, viewheight-linestart, mLinePaint);
}
}
XYChart.java 文件源码
项目:ioiometer
阅读 29
收藏 0
点赞 0
评论 0
private void setStroke(Cap cap, Join join, float miter, Style style, PathEffect pathEffect,
Paint paint) {
paint.setStrokeCap(cap);
paint.setStrokeJoin(join);
paint.setStrokeMiter(miter);
paint.setPathEffect(pathEffect);
paint.setStyle(style);
}
SymbolLine.java 文件源码
项目:topodroid
阅读 24
收藏 0
点赞 0
评论 0
SymbolLine( String name, String th_name, String fname, String group, int color, float width, PathEffect effect_dir, PathEffect effect_rev )
{
super( th_name, fname );
init( name, group, color, width );
mPaint.setPathEffect( effect_dir );
mRevPaint.setPathEffect( effect_rev );
mHasEffect = true;
makePath();
}
XYChart.java 文件源码
项目:achartengine
阅读 22
收藏 0
点赞 0
评论 0
/**
* Draws the series.
*
* @param series the series
* @param canvas the canvas
* @param paint the paint object
* @param pointsList the points to be rendered
* @param seriesRenderer the series renderer
* @param yAxisValue the y axis value in pixels
* @param seriesIndex the series index
* @param or the orientation
* @param startIndex the start index of the rendering points
*/
protected void drawSeries(XYSeries series, Canvas canvas, Paint paint, List<Float> pointsList,
XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, Orientation or,
int startIndex) {
BasicStroke stroke = seriesRenderer.getStroke();
Cap cap = paint.getStrokeCap();
Join join = paint.getStrokeJoin();
float miter = paint.getStrokeMiter();
PathEffect pathEffect = paint.getPathEffect();
Style style = paint.getStyle();
if (stroke != null) {
PathEffect effect = null;
if (stroke.getIntervals() != null) {
effect = new DashPathEffect(stroke.getIntervals(), stroke.getPhase());
}
setStroke(stroke.getCap(), stroke.getJoin(), stroke.getMiter(), Style.FILL_AND_STROKE,
effect, paint);
}
// float[] points = MathHelper.getFloats(pointsList);
drawSeries(canvas, paint, pointsList, seriesRenderer, yAxisValue, seriesIndex, startIndex);
drawPoints(canvas, paint, pointsList, seriesRenderer, yAxisValue, seriesIndex, startIndex);
paint.setTextSize(seriesRenderer.getChartValuesTextSize());
if (or == Orientation.HORIZONTAL) {
paint.setTextAlign(Align.CENTER);
} else {
paint.setTextAlign(Align.LEFT);
}
if (seriesRenderer.isDisplayChartValues()) {
paint.setTextAlign(seriesRenderer.getChartValuesTextAlign());
drawChartValuesText(canvas, series, seriesRenderer, paint, pointsList, seriesIndex,
startIndex);
}
if (stroke != null) {
setStroke(cap, join, miter, style, pathEffect, paint);
}
}
XYChart.java 文件源码
项目:achartengine
阅读 25
收藏 0
点赞 0
评论 0
private void setStroke(Cap cap, Join join, float miter, Style style, PathEffect pathEffect,
Paint paint) {
paint.setStrokeCap(cap);
paint.setStrokeJoin(join);
paint.setStrokeMiter(miter);
paint.setPathEffect(pathEffect);
paint.setStyle(style);
}
CodeEditText.java 文件源码
项目:FxExplorer
阅读 23
收藏 0
点赞 0
评论 0
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
if (attrs != null && !isInEditMode()) {
TypedArray ta;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ta = context.obtainStyledAttributes(attrs, R.styleable.CodeEditText, defStyleAttr, defStyleRes);
} else {
ta = context.obtainStyledAttributes(attrs, R.styleable.CodeEditText);
}
fontFamily = ta.getString(R.styleable.CodeEditText_fontFamily);
if (!TextUtils.isEmpty(fontFamily)) {
setTypeface(Typeface.createFromAsset(context.getAssets(), fontFamily));
} else {
setTypeface(Typeface.MONOSPACE);
}
showLineNumber = ta.getBoolean(R.styleable.CodeEditText_showLineNumber, true);
lineNumberColor = ta.getColor(R.styleable.CodeEditText_numberColor, Color.BLACK);
ta.recycle();
}
numberMargin = (int) (context.getResources().getDisplayMetrics().density * 3 + 0.5);
mRect = new Rect();
lineNumberPaint = new Paint();
lineNumberPaint.setStyle(Paint.Style.STROKE);
lineNumberPaint.setTypeface(getTypeface());
lineNumberPaint.setAntiAlias(true);
lineNumberPaint.setFakeBoldText(false);
lineNumberPaint.setSubpixelText(true);
PathEffect effect = new DashPathEffect(new float[]{4, 4, 4, 4}, 1);
lineNumberPaint.setPathEffect(effect);
lineNumberPaint.setColor(lineNumberColor);
}
CodeEditText.java 文件源码
项目:FxExplorer
阅读 22
收藏 0
点赞 0
评论 0
@Override
protected void onDraw(Canvas canvas) {
long st = System.currentTimeMillis();
if (showLineNumber) {
int height = getHeight();
int line_height = getLineHeight();
int count = height / line_height;
if (getLineCount() > count) {
count = getLineCount();//for long text with scrolling
}
Rect r = mRect;
Paint paint = lineNumberPaint;
String maxNumber = String.format("%0" + String.valueOf(count).length() + "d", 8);
paint.getTextBounds(maxNumber, 0, maxNumber.length(), mRect);
int baseLeft = getScrollX();
int lineNumberWidth = r.width() + 2 * numberMargin;
int baseline = getLineBounds(0, r);//first line
//draw split line
canvas.drawLine(baseLeft + lineNumberWidth, 0, baseLeft + lineNumberWidth, count * line_height, paint);
getLocalVisibleRect(r);
int startLine = r.top / line_height;
baseline += startLine * line_height;
int endLine = (r.bottom + line_height - 1) / line_height;
Rect tRect = new Rect();
PathEffect pathEffect = paint.getPathEffect();
paint.setPathEffect(null);
for (int i = startLine; i < endLine; i++) {
String number = String.valueOf(i + 1);
paint.getTextBounds(number, 0, number.length(), tRect);
canvas.drawText(number, baseLeft + lineNumberWidth - tRect.width() - numberMargin, baseline + 1, paint);
baseline += line_height;
}
paint.setPathEffect(pathEffect);
}
Log.d(null, "C Cost:" + (System.currentTimeMillis() - st));
st = System.currentTimeMillis();
super.onDraw(canvas);
Log.d(null, "S Cost:" + (System.currentTimeMillis() - st));
}
XYChart.java 文件源码
项目:MiBandDecompiled
阅读 26
收藏 0
点赞 0
评论 0
private void a(android.graphics.Paint.Cap cap, android.graphics.Paint.Join join, float f1, android.graphics.Paint.Style style, PathEffect patheffect, Paint paint)
{
paint.setStrokeCap(cap);
paint.setStrokeJoin(join);
paint.setStrokeMiter(f1);
paint.setPathEffect(patheffect);
paint.setStyle(style);
}
PathEffectView.java 文件源码
项目:binea_project_for_android
阅读 28
收藏 0
点赞 0
评论 0
private void initPaint() {
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(5);
mPaint.setColor(Color.RED);
mPath = new Path();
mPath.moveTo(0, 0);
for(int i = 0;i<=30;i++){
mPath.lineTo(i*35, (float)Math.random()*100);
}
mEffects = new PathEffect[7];
mEffects[0] = null;
mEffects[1] = new CornerPathEffect(10);
mEffects[2] = new DiscretePathEffect(3.0F, 5.0F);
mEffects[3] = new DashPathEffect(new float[] { 20, 10, 5, 10 }, mPhase);
Path path = new Path();
path.addRect(0, 0, 8, 8, Path.Direction.CCW);
mEffects[4] = new PathDashPathEffect(path, 12, mPhase, PathDashPathEffect.Style.ROTATE);
mEffects[5] = new ComposePathEffect(mEffects[2], mEffects[4]);
mEffects[6] = new SumPathEffect(mEffects[4], mEffects[3]);
}