How do I draw a point using Core Graphics?

前端 未结 7 2072
别那么骄傲
别那么骄傲 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:30

    Quartz is not a pixel-oriented API, and its contexts aren’t necessarily pixel buffers. If you want to draw pixmaps, create a bitmap context with CGBitmapContextCreate(). You provide a buffer, which you can manipulate directly, and can copy to another context by creating a CGImage from the same buffer using CGImageCreate() and drawing that.

提交回复
热议问题