user427754
user427754

Reputation:

Core Graphics: Mask Image, add Overlay and Underlay

How can I mask an image, add an overlay and an underlay to the masked image with Core Graphics? (for instance: a document icon consists out of a mask png, a page curl png and a base with shadow) Can someone give me a best practice?

Upvotes: 3

Views: 2495

Answers (1)

Ben Stiglitz
Ben Stiglitz

Reputation: 4004

  • Draw the underlay with CGContextDrawImage().
  • Push a graphics context state with CGContextSaveGState().
  • Load the mask and add it to the context using CGContextClipToMask().
  • Draw your content.
  • Pop the graphics context with CGContextRestoreGState().
  • Draw your overlay image with CGContextDrawImage().

Upvotes: 3

Related Questions