Core Graphics: mask image, add Overlay and Underlay

How to mask an image, add overlay and lining to a masked image using Core Graphics? (for example: a document icon consists of a png mask, a curl png page and a base with a shadow). Can anyone give me a best practice?

+3
source share
1 answer
  • Draw a lining with CGContextDrawImage().
  • Click the state of the graphics context with CGContextSaveGState().
  • Download the mask and add it to the context with CGContextClipToMask().
  • Draw your content.
  • Put the graphics context on CGContextRestoreGState().
  • Draw your overlay image with CGContextDrawImage().
+4
source

Source: https://habr.com/ru/post/1792852/


All Articles