我画了 4 条线(canvas.drawLine)来画一个矩形。有没有可能填充矩形的区域?(我知道android有一个rectDraw。我的只是好奇)
提前致谢。
好的..我还创建了一个路径段。按照代码..请你解释一下如何填充内部区域?
`Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStrokeWidth(2);
paint.setColor(android.graphics.Color.RED);
paint.setStyle(Paint.Style.FILL_AND_STROKE);
paint.setAntiAlias(true);
path.reset();
path.setFillType(Path.FillType.INVERSE_EVEN_ODD);
path.moveTo(mPin[0].getX() + 10, mPin[0].getY() + 10);
path.lineTo(mPin[1].getX() + 10, mPin[1].getY() + 10);
path.moveTo(mPin[1].getX() + 10, mPin[1].getY() + 10);
path.lineTo(mPin[3].getX() + 10, mPin[3].getY() + 10);
path.moveTo(mPin[3].getX() + 10, mPin[3].getY() + 10);
path.lineTo(mPin[2].getX() + 10, mPin[2].getY() + 10);
path.moveTo(mPin[2].getX() + 10, mPin[2].getY() + 10);
path.lineTo(mPin[0].getX() + 10, mPin[0].getY() + 10);
paint.setShader(new LinearGradient(0, 0, 0, getHeight(), Color.BLACK, Color.WHITE, Shader.TileMode.MIRROR));
c.drawPath(path, paint);`