How do I draw a point using Core Graphics?

前端 未结 7 2075
别那么骄傲
别那么骄傲 2020-12-03 07:57

I see APIs in Quartz for drawing lines and circles. But all I want to do is to specify the (x,y) cartesian coordinate to color a pixel a particular value. How do I do that

7条回答
  •  星月不相逢
    2020-12-03 08:18

    Draw a very small ellipse/circle and fill it!

    CGContextAddEllipseInRect(Context,(CGRectMake (x_dot, y_dot, 3.0, 3.0));
    CGContextDrawPath(Context, kCGPathFill);
    CGContextStrokePath(Context);
    

    I am using this code to create a small dot (3x3 pixels) in a dotted music note.

提交回复
热议问题