Fill color on specific portion of image?

前端 未结 4 1534
北海茫月
北海茫月 2021-01-30 18:32

I want to fill specific color on specific area of an image.

EX:

\"enter

4条回答
  •  别跟我提以往
    2021-01-30 18:59

    Rather than attempting to flood fill an area of a raster-based image, a better approach (and much smaller amount of data) would be to create vector images. Once you have a vector image, you can stroke the outline to draw it uncolored, or you can fill the outline to draw it colored.

    I recommend using CoreGraphics calls like CGContextStrokePath() and CGContextFillPath() to do the drawing. This will likely look better than using the flood fill because you will get nicely anti-aliased edges.

    Apple has some good documentation on how to draw with Quartz 2D. Particularly the section on Paths is useful to what you're trying to do.

提交回复
热议问题