Freehand Draw Issue ?
Hi ...
I am using the below code for free hand draw , but the image is getting squized during drawing and this problem is happening for only rectangular shaped images . But there is no problem with Square shape size image.
This code is used in touchesmoved event.
UIGraphicsBeginImageContext(self.imageview.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[imageview.imagedrawInRect:CGRectMake(0, 0, self.imageview.frame.size.width, self.imageview.frame.size.height)]; //originally
CGContextSetLineCap(context, kCGLineCapRound); //kCGLineCapSquare, kCGLineCapButt, kCGLineCapRound
//line width
CGContextSetLineWidth(context, -1.0); // for size
//line colour
CGContextSetRGBStrokeColor(context, 1.0, 0.0, 0.0, 1.0); //values for R, G, B, and Alpha
//starting point
CGContextBeginPath(context);
//end point
CGContextMoveToPoint(context, previousPoint.x, previousPoint.y);
//add the points to make line
CGContextAddLineToPoint(context, movePoint.x, movePoint.y);
CGContextStrokePath(context);
m_pViewPortImageView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
previousPoint = movePoint;
Is there any way for freehand drawing on CALayer like satraight line or elipse draw ? Please guide me .
Thanks
iPad 2, iOS 5.1