透明度改变时绘图不正确
UITouch *touch = [touches anyObject];
previousPoint2 = previousPoint1;
previousPoint1 = [touch previousLocationInView:m_img];
currentPoint = [touch locationInView:m_img];
// calculate mid point
CGPoint mid1 = [self midPoint:previousPoint1 :previousPoint2];
CGPoint mid2 =[self midPoint:currentPoint :previousPoint1];
UIGraphicsBeginImageContext(m_img.frame.size);
[m_img.image drawInRect:CGRectMake(0, 0, m_img.frame.size.width, m_img.frame.size.height)];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextMoveToPoint(context, mid1.x, mid1.y);
// Use QuadCurve is the key
CGContextAddQuadCurveToPoint(context, previousPoint1.x, previousPoint1.y, mid2.x, mid2.y);
NSLog(@"%@",color);
CGBitmapContextGetColorSpace(context);
//
CGContextSetStrokeColorWithColor(context, color.CGColor);
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineWidth(context,m_width);
CGContextStrokePath(context);
m_img.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
我正在使用此代码进行绘图,但绘图路径中出现了一些圆圈。 我尝试了不同的颜色风格 任何人都可以帮助 plz......
UITouch *touch = [touches anyObject];
previousPoint2 = previousPoint1;
previousPoint1 = [touch previousLocationInView:m_img];
currentPoint = [touch locationInView:m_img];
// calculate mid point
CGPoint mid1 = [self midPoint:previousPoint1 :previousPoint2];
CGPoint mid2 =[self midPoint:currentPoint :previousPoint1];
UIGraphicsBeginImageContext(m_img.frame.size);
[m_img.image drawInRect:CGRectMake(0, 0, m_img.frame.size.width, m_img.frame.size.height)];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextMoveToPoint(context, mid1.x, mid1.y);
// Use QuadCurve is the key
CGContextAddQuadCurveToPoint(context, previousPoint1.x, previousPoint1.y, mid2.x, mid2.y);
NSLog(@"%@",color);
CGBitmapContextGetColorSpace(context);
//
CGContextSetStrokeColorWithColor(context, color.CGColor);
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineWidth(context,m_width);
CGContextStrokePath(context);
m_img.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
i am using this code for drawing but some circle come in drawing path.
i tried the diffrent color styles
any one can help plz......
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
唯独缺少这个
only this is missing