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


Java Path.setFillType方法代码示例

本文整理汇总了Java中android.graphics.Path.setFillType方法的典型用法代码示例。如果您正苦于以下问题:Java Path.setFillType方法的具体用法?Java Path.setFillType怎么用?Java Path.setFillType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Path的用法示例。


在下文中一共展示了Path.setFillType方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: overlay

import android.graphics.Path; //导入方法依赖的package包/类
public void overlay(Canvas c, ImageView img) {
    if (arrowPos != ArrowPosition.NONE) {
        
        int x_border = (arrowPos == ArrowPosition.LEFT) ? 0 : img.getWidth();
        int x_inside = x_border + ((arrowPos == ArrowPosition.LEFT) ? 1 : -1 ) * (int)(img.getWidth() * 0.2f);
        int y_top = (int) (img.getHeight() * 0.2f);
        int y_bottom = (int) (img.getHeight() * 0.6f);
        c.save();
        
        Path path = new Path();   
        path.setFillType(Path.FillType.EVEN_ODD);
        path.moveTo(x_border, y_top);
        path.lineTo(x_inside, (y_top + y_bottom)/2);
        path.lineTo(x_border, y_bottom);
        path.lineTo(x_border, y_top);
        path.close();

        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        paint.setStrokeWidth(0);
        paint.setColor(android.graphics.Color.BLACK);     
        paint.setStyle(Paint.Style.FILL_AND_STROKE);
        paint.setAntiAlias(true);

        
        c.drawPath(path, paint);
        c.restore();
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:29,代码来源:QuickContactBadge.java

示例2: initPaintObjects

import android.graphics.Path; //导入方法依赖的package包/类
private void initPaintObjects() {

        int labelTextSize = getResources().getDimensionPixelSize(R.dimen.label_text_size);

        paint = new Paint(Paint.ANTI_ALIAS_FLAG);

        textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        textPaint.setTextSize(labelTextSize);
        if (typeface != null) {
            textPaint.setTypeface(typeface);
        }
        textPaint.setColor(baseColor);
        baseAlpha = textPaint.getAlpha();

        selectorPath = new Path();
        selectorPath.setFillType(Path.FillType.EVEN_ODD);

        selectorPoints = new Point[3];
        for (int i = 0; i < 3; i++) {
            selectorPoints[i] = new Point();
        }
    }
 
开发者ID:hamsaadev,项目名称:RTLMaterialSpinner,代码行数:23,代码来源:RtlMaterialSpinner.java

示例3: onDraw

import android.graphics.Path; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {

    int w = getWidth(), h = getHeight();
    paint.setStrokeWidth(2);
    paint.setColor(getResources().getColor(R.color.white));
    paint.setStyle(Paint.Style.FILL_AND_STROKE);
    paint.setAntiAlias(true);

    path = new Path();
    path.setFillType(Path.FillType.EVEN_ODD);
    path.moveTo(0,0);
    path.lineTo(0,h);
    path.lineTo(w,h);
    path.close();
    canvas.drawPath(path, paint);
}
 
开发者ID:twisstosin,项目名称:Lasgithub-Android,代码行数:18,代码来源:SlantView.java

示例4: setupClip

import android.graphics.Path; //导入方法依赖的package包/类
private void setupClip() {
  if (mClipDataSet && mClipRuleSet) {
    mClipPath = new Path();

    switch (mClipRule) {
      case CLIP_RULE_EVENODD:
        mClipPath.setFillType(Path.FillType.EVEN_ODD);
        break;
      case CLIP_RULE_NONZERO:
        break;
      default:
        Log.v(TAG, "clipRule " + mClipRule + " unrecognized");
    }
    createPath(mClipData, mClipPath);
  }
}
 
开发者ID:weex-plugins,项目名称:weex-svg,代码行数:17,代码来源:WXSvgAbsComponent.java

示例5: addObjectToClip

import android.graphics.Path; //导入方法依赖的package包/类
private void addObjectToClip(SVG.Path obj, Path combinedPath,
		Matrix combinedPathMatrix) {
	updateStyleForElement(state, obj);

	if (!display())
		return;
	if (!visible())
		return;

	if (obj.transform != null)
		combinedPathMatrix.preConcat(obj.transform);

	Path path = (new PathConverter(obj.d)).getPath();

	if (obj.boundingBox == null) {
		obj.boundingBox = calculatePathBounds(path);
	}
	checkForClipPath(obj);

	// path.setFillType(getClipRuleFromState());
	combinedPath.setFillType(getClipRuleFromState());
	combinedPath.addPath(path, combinedPathMatrix);
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:24,代码来源:SVGAndroidRenderer.java

示例6: makePathAndBoundingBox

import android.graphics.Path; //导入方法依赖的package包/类
private Path makePathAndBoundingBox(SVG.PolyLine obj) {
	Path path = new Path();

	path.moveTo(obj.points[0], obj.points[1]);
	for (int i = 2; i < obj.points.length; i += 2) {
		path.lineTo(obj.points[i], obj.points[i + 1]);
	}
	if (obj instanceof SVG.Polygon)
		path.close();

	if (obj.boundingBox == null) {
		obj.boundingBox = calculatePathBounds(path);
	}

	path.setFillType(getClipRuleFromState());
	return path;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:18,代码来源:SVGAndroidRenderer.java

示例7: fillTypeTest

import android.graphics.Path; //导入方法依赖的package包/类
private void fillTypeTest(Canvas canvas) {
        paint.setStyle(Paint.Style.FILL);                   // 设置画布模式为填充kk
        canvas.translate(mWidth / 2, mHeight / 2);          // 移动画布(坐标系)

        Path path = new Path();                                     // 创建Path

        path.setFillType(Path.FillType.INVERSE_WINDING);                   // 设置Path填充模式为 奇偶规则
//        path.setFillType(Path.FillType.INVERSE_EVEN_ODD);            // 反奇偶规则
        path.addRect(-400, -400, 400, 400, Path.Direction.CW);         // 给Path中添加一个矩形

        canvas.drawPath(path, paint);
    }
 
开发者ID:lixiaodaoaaa,项目名称:ColumnAnimViewProject,代码行数:13,代码来源:CanvasTest2View.java

示例8: createTriangle

import android.graphics.Path; //导入方法依赖的package包/类
/**
 * This requires the three points to be in a sequence that traces out a triangle in clockwise
 * fashion. This is required for the triangle to be filled correctly when drawing, otherwise
 * it will end up black.
 */
private static Path createTriangle(Point start, Point middle, Point end) {
    Path path = new Path();
    path.setFillType(Path.FillType.EVEN_ODD);
    path.moveTo(start.x, start.y);
    path.lineTo(middle.x, middle.y);
    path.lineTo(end.x, end.y);
    path.close();

    return path;
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:16,代码来源:FeatureImage.java

示例9: setupPath

import android.graphics.Path; //导入方法依赖的package包/类
protected void setupPath() {
  // init path after both fillRule and path have been set
  if (mFillRuleSet && mD != null) {
    mPath = new Path();
    mPath.setFillType(mFillRule);
    super.createPath(mD, mPath);
  }
}
 
开发者ID:weex-plugins,项目名称:weex-svg,代码行数:9,代码来源:WXSvgPath.java

示例10: XYGraph

import android.graphics.Path; //导入方法依赖的package包/类
public XYGraph(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mPaintLine = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintEdge = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintGraph = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintGraphStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPathGraph = new Path();

    mPaintEdge.setStyle(Paint.Style.STROKE);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.XYGraph, defStyleAttr, 0);

    int accentColor = ViewUtils.getThemeAccentColor(getContext());
    mPaintLine.setColor(a.getColor(R.styleable.XYGraph_linecolor, accentColor));
    mPaintEdge.setColor(a.getColor(R.styleable.XYGraph_edgecolor, accentColor));
    mPaintEdge.setStrokeWidth(a.getDimension(R.styleable.XYGraph_edgestrokewidth,
            getResources().getDimension(R.dimen.xygraph_edge_stroke_width)));

    int graphColor = a.getColor(R.styleable.XYGraph_graphcolor, accentColor);

    mPaintGraphStroke.setColor(graphColor);
    mPaintGraphStroke.setStyle(Paint.Style.STROKE);
    mPaintGraphStroke.setStrokeWidth(a.getDimension(R.styleable.XYGraph_graphstrokewidth,
            getResources().getDimension(R.dimen.xygraph_graph_stroke_width)));

    graphColor = Color.argb(120, Color.red(graphColor), Color.green(graphColor), Color.blue(graphColor));

    mPaintGraph.setColor(graphColor);
    mPaintGraph.setStyle(Paint.Style.FILL);
    mPathGraph.setFillType(Path.FillType.EVEN_ODD);

    mEdgeVisible = a.getBoolean(R.styleable.XYGraph_edgevisibile, true);

    a.recycle();
}
 
开发者ID:morogoku,项目名称:MTweaks-KernelAdiutorMOD,代码行数:37,代码来源:XYGraph.java

示例11: onDraw

import android.graphics.Path; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    //super.onDraw(canvas);
    canvas.save();
    canvas.translate(0,-Ui.cd.getHt(10));

    canvas.save();
    bass.draw(canvas);
    float radius = 10;
    final RectF oval = new RectF();
    oval.set(0, 0, bass.width, bass.height);
    Path ph = new Path();
    ph.setFillType(Path.FillType.WINDING);
    ph.moveTo(bass.width/2, bass.width/2);
    if(angle > 110 - 1){
        ph.addArc(oval,-(200) + 110,angle - 110);
    }else{
        ph.addArc(oval,-(90) - (110 - angle),(110 - angle));
    }
    ph.lineTo(bass.width/2,bass.width/2);

    canvas.clipPath(ph);
    basstop.draw(canvas);
    canvas.restore();

    canvas.save();
    canvas.rotate(-(90+20),XX,YY);
    canvas.rotate(angle,XX,YY);
    bassdot.draw(canvas);
    canvas.restore();

    int val = (angle - 110);
    val = (int) ((100f / 110) * val);
    levelText.setText(val+"",true);
    levelText.draw(canvas);
    canvas.restore();
    super.drawShape(canvas);
    //canvas.drawPath(ph,bass.img.maskPaint);
}
 
开发者ID:KishanV,项目名称:Android-Music-Player,代码行数:40,代码来源:WheelItem.java

示例12: drawBackground

import android.graphics.Path; //导入方法依赖的package包/类
private void drawBackground(Canvas canvas) {
    Rect imageRect = getImageRect();
    PointF topLeftImageRect = sourceToViewCoord(imageRect.left, imageRect.top);
    PointF bottomRightImageRect = sourceToViewCoord(imageRect.left, imageRect.top);

    PointF topLeft = sourceToViewCoord(cropRect.left, cropRect.top);
    PointF bottomRight = sourceToViewCoord(cropRect.right, cropRect.bottom);
    if (topLeftImageRect == null || bottomRightImageRect == null ||
            topLeft == null || bottomRight == null) {
        return;
    }

    Path background = new Path();
    background.setFillType(Path.FillType.INVERSE_EVEN_ODD);
    background.moveTo(topLeft.x, topLeft.y);
    background.lineTo(bottomRight.x, topLeft.y);
    background.lineTo(bottomRight.x, bottomRight.y);
    background.lineTo(topLeft.x, bottomRight.y);
    background.close();

    background.moveTo(topLeftImageRect.x, topLeftImageRect.y);
    background.lineTo(bottomRightImageRect.x, topLeftImageRect.y);
    background.lineTo(bottomRightImageRect.x, bottomRightImageRect.y);
    background.lineTo(topLeftImageRect.x, bottomRightImageRect.y);
    background.close();

    backgroundPaint.setAlpha(touching ? 100 : 200);

    canvas.drawPath(background, backgroundPaint);
}
 
开发者ID:kollerlukas,项目名称:Camera-Roll-Android-App,代码行数:31,代码来源:CropImageView.java

示例13: render

import android.graphics.Path; //导入方法依赖的package包/类
private void render(SVG.Path obj) {
	debug("Path render");

	if (obj.d == null)
		return;

	updateStyleForElement(state, obj);

	if (!display())
		return;
	if (!visible())
		return;
	if (!state.hasStroke && !state.hasFill)
		return;

	if (obj.transform != null)
		canvas.concat(obj.transform);

	Path path = (new PathConverter(obj.d)).getPath();

	if (obj.boundingBox == null) {
		obj.boundingBox = calculatePathBounds(path);
	}
	updateParentBoundingBox(obj);

	checkForGradientsAndPatterns(obj);
	checkForClipPath(obj);

	boolean compositing = pushLayer();

	if (state.hasFill) {
		path.setFillType(getFillTypeFromState());
		doFilledPath(obj, path);
	}
	if (state.hasStroke)
		doStroke(path);

	renderMarkers(obj);

	if (compositing)
		popLayer(obj);
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:43,代码来源:SVGAndroidRenderer.java

示例14: initPaint

import android.graphics.Path; //导入方法依赖的package包/类
private void initPaint() {
    mPathEffect = new DashPathEffect(new float[]{dp2, dp2}, 1);
    mGradeAxisPaint = new Paint();
    mGradeAxisPaint.reset();
    mGradeAxisPaint.setStyle(Paint.Style.STROKE);
    mGradeAxisPaint.setStrokeWidth(1);
    mGradeAxisPaint.setColor(isDebug ? Color.parseColor("#f00000") : Color.parseColor("#16ffffff"));
    mGradeAxisPaint.setAntiAlias(true);
    mGradeAxisPaint.setPathEffect(mPathEffect);

    mChartPaint = new Paint();
    mChartPaint.setStyle(Paint.Style.FILL);
    mChartPaint.setStrokeWidth(4);
    mChartPaint.setAntiAlias(true);

    mChartTestLinePaint = new Paint();
    mChartTestLinePaint.setStyle(Paint.Style.STROKE);
    mChartTestLinePaint.setStrokeWidth(dp2px(1));
    mChartTestLinePaint.setColor(Color.parseColor("#DF6A56"));
    mChartTestLinePaint.setAntiAlias(true);
    mChartTestLinePaint.setAlpha(0);
    if (isDebug) {
        mChartTestLinePaint.setAlpha(255);
    }

    mChartIndicatorPaint = new Paint();
    mChartIndicatorPaint.setStyle(Paint.Style.STROKE);
    mChartIndicatorPaint.setStrokeWidth(dp2px(1));

    mWhitePaint = new Paint();
    mWhitePaint.setStyle(Paint.Style.FILL);
    mWhitePaint.setColor(Color.parseColor("#ffffff"));

    mWhiteTextPaint = new TextPaint();
    mWhiteTextPaint.setColor(Color.parseColor("#ffffff"));
    mWhiteTextPaint.setTextSize(dp2px(11));
    mWhiteTextPaint.setAntiAlias(true);

    mWhiteTextPaintHeight = mWhiteTextPaint.descent() + mWhiteTextPaint.ascent();

    mDarkTextPaint = new TextPaint(mWhiteTextPaint);
    mDarkTextPaint.setAlpha(127);

    mPathIndicatorLine = new Path();
    mPathIndicatorLine.setFillType(Path.FillType.WINDING);

    mPathGradLine = new Path();
    mRectIndicator = new RectF();
}
 
开发者ID:maoruibin,项目名称:TrendChartView,代码行数:50,代码来源:TrendChartView.java


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