I want to draw a circular NSImage which has the initials of a contact's name which is passed in. There are a few examples for iOS (like this one) but I haven't seem an equivalent example for NSImage. The examples I've seen rely on graphics context drawing, which doesn't have easy parallels for AppKit. What's the best way to achieve this?
0
votes
1 Answers
2
votes
You can use a block-based NSImage to wrap arbitrary drawing. In fact, using the block constructor is preferred because it allows the system to re-run your drawing code when the display environment changes (e.g. when the scale factor changes, or when the display's color gamut changes, or when Dark Mode is toggled). You should be able to adapt any Quartz-based drawing code over to this API.