0
votes

I'm looking for some advice on how to proceed.

I'm working on a cocoa program (Objective-C) where I want to be able to draw over top of a bitmap image, defining areas that I can use to get information from the underlying image.

As an example, I'd like to create a box (or oval) and be able to get the average pixel value from the underlying image. Ultimately I want to designate a number of such regions where I am sampling the underlying image to provide various statistics.

Currently I'm using an NSImage class to draw my image but I'm not sure how to go about drawing an NSBezierPath over that image. Would I be better off using something other than NSImage?

Do I simply override the NSImage drawRect method so that it draws a series of NSBezierPath objects?

I would like to be able to save these outlined regions as a layer so that they are available in the future.

1

1 Answers

0
votes

You can use a CGBitmapContext (for the bitmap), CGImageMasks (for the masking), and CGPaths or CGContext* drawing primitives for the lines and curves.

A complete answer would be quite long, but that gives you a starting point.