- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有 drawpath 的这段代码,但没有显示任何内容,我不明白为什么。
//i move the path's starting point somewhere up here to a point.
//get center x and y are the centers of a picture. it works when i
//do drawline and store the different starting points
//but i want it to look continuous not like a lot of different
//lines
path.lineTo(a.getCenterX(), a.getCenterY());
path.moveTo(a.getCenterX(), a.getCenterY());
p.setStrokeWidth(50);
p.setColor(Color.BLACK);
canvas.drawPath(path,p);
提前致谢
最佳答案
一个新的 Paint 实例只填充路径。
要描边路径,设置绘画风格:
paint.setStyle(Paint.Style.STROKE);
如果您绘制的背景是黑色,请更改颜色,以便您可以看到油漆:
paint.setColor(Color.RED); // something other than the background color
可选:
paint.setStrokeWidth(10); // makes the line thicker
关于android - 为什么 drawPath 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7029870/
我有 drawpath 的这段代码,但没有显示任何内容,我不明白为什么。 //i move the path's starting point somewhere up here to a point
因此,我使用 CustomPainter 中的 drawPath 和 drawArc 创建了一个形状,PaintingStyle 是描边,但是当我将其更改为填充时,它只填充弧线而不是整个形状。我想用颜
我正在使用 gdiplus 来“描边”文本输出。在某些情况下,我们会在图形的顶部或底部看到一个“尖峰”,我不确定为什么。我们可以通过调整笔画宽度和字体大小来最小化这种情况,但这不是一个好的解决方案。我
下面的代码画了一个十字: using (SolidBrush brush = new SolidBrush(Color.FromArgb(192, 99, 104, 113))) { usin
我发现使用 Canvas.drawPath(path,paint) 比连续使用 Canvas.drawLine() 或使用 Canvas.drawLines() 慢得多。我无法提供确切的性能数据,但我
我在我的应用程序中同时使用 Rectangle 和 graphicspath 绘制线条,当使用 GraphicsPath 而不是使用 Rectangle 时,我面临着绘图中宽度和高度的丢失。 下面是重
关于我几周前问的这个问题 LinearGradientBrush does not render correctly 考虑以下代码: protected override void OnPaint(P
我正在为给定字符绘制字形轮廓,使用: QString myfname="FreeMono.ttf"; QRawFont *myfont=new QRawFont(myfname,324,QFont::
这是我编写的代码: private void touch_start(float x, float y) { mPath.reset(); mPath.moveTo(x, y);
在 Android 中,我使用 Canvas.drawPath( Path, Paint ) 来填充路径。我已将 Paint 变量设置为使用 BitmapShader 和要填充的样式。这种方法工作正常
我输入了一个在 Canvas 上绘制的程序。 它提供了一个弹出菜单,其中提供了 3 个绘图工具作为选项: 边划线边划线 根据屏幕上的起点和终点画线 画一个圆 此外,还有如下选项: 清除 撤消 在行上执
我想在计时器内画线。我应该使用哪一个?这两者有什么性能差异吗?我想要计时器中的情节线哪个更好? 最佳答案 在 Android 中,如果您正在绘制大量连接线(如 MapView 上的路线),请尝试使用“
我是一名优秀的程序员,十分优秀!