我试图绘制清晰锐利的线条,但它们变得模糊不清。关于如何以更高的分辨率绘制或以比例或2x或4x或其他东西绘制的任何想法?在iOS中,当我绘制时,我可以简单地应用绘制比例,使其更清晰,但我在Android中看不到类似的东西
以下是使用此代码绘制后我的线条看起来像的示例。我想知道我是否需要给视图一个大于#34;匹配父母"但然后给它父母的界限......
-------------- ---------------- EDIT 我的绘图代码当前是什么样的:
Paint paint = new Paint();
paint.SetStyle(Paint.Style.Stroke);
paint.Color = this.StringColor;
paint.AntiAlias = true;
paint.StrokeWidth = 1.0f;
if (this.DoDashLines)
{
paint.SetPathEffect(new DashPathEffect(new float[] { this.DashWidth, this.DashGap }, 0));
}
// Find the distance between points on X axis
var distanceBetweenXAxis = Math.Abs(this.EndPoint.X - this.BeginPoint.X);
var other = Math.Abs(this.BeginPoint.X - this.EndPoint.X);
if (other > distanceBetweenXAxis)
{
distanceBetweenXAxis = other;
}
float controlPoint_offsetX = distanceBetweenXAxis * Studio_Canvas_StringBezierCurve_OffsetPerPixelX;
// Enforce a minimum distance so it looks good
float minDistanceX = 25;
if (controlPoint_offsetX < minDistanceX)
{
controlPoint_offsetX = minDistanceX;
}
float controlPoint1_offsetX = controlPoint_offsetX;
float controlPoint2_offsetX = controlPoint_offsetX;
if (Math.Abs(this.BeginPoint.Y - this.EndPoint.Y) > 0.1f)
{
if (this.BeginPoint.X < this.EndPoint.X)
{
controlPoint1_offsetX *= 1f;
controlPoint2_offsetX *= -1f;
}
else
{
controlPoint1_offsetX *= -1f;
controlPoint2_offsetX *= 1f;
}
}
Path path = new Path();
path.MoveTo(this.BeginPoint.X, this.BeginPoint.Y);
path.CubicTo(this.BeginPoint.X + controlPoint1_offsetX, this.BeginPoint.Y, this.EndPoint.X + controlPoint2_offsetX, this.EndPoint.Y, this.EndPoint.X, this.EndPoint.Y);
canvas.DrawFilter = new PaintFlagsDrawFilter(0, PaintFlags.AntiAlias | PaintFlags.FilterBitmap);
canvas.DrawPath(path, paint);