Hi, I want to implement mid-point/Bresenham circle drawing algorithm using objective for Iphone.please give me any tutorial or source code to drawing mid point/Bresenham circle algorithm.It is possible to draw the circle using CGPoint method?
+4
A:
That algorithm appears to be well documented on Wikipedia, however, since it is about where to put the dots to create the circle, I have to point out the answers to this Stack Overflow question. Short summary: Core Graphics isn't pixel oriented.
So if you want to draw the circle point-by-point yourself, look at the answers for the linked question, and apply that to the algorithm from Wikipedia. If you just want to draw a circle, refer to the documentation, esp. CGContextAddEllipseInRect
.
Johan Kool
2010-03-25 07:16:04
Johan Kool, I want to implement the following function for to draw the circle,void CGContextStrokeLineSegments ( CGContextRef c, const CGPoint points[], size_t count);GContextBeginPath (context);for (k = 0; k < count; k += 2) { CGContextMoveToPoint(context, s[k].x, s[k].y); CGContextAddLineToPoint(context, s[k+1].x, s[k+1].y);}CGContextStrokePath(context);How can i implement that code. I was spending a lot of days for searching and implementation of those functions but i can't able to do that please help anyone................
RRB
2010-03-25 07:50:06