NSImage/ImageRep/ImageView
NSImage/ImageRep/ImageView
- Subject: NSImage/ImageRep/ImageView
- From: Brian Hook <email@hidden>
- Date: Fri, 28 Sep 2001 17:37:28 -0700
- Organization: Pyrogon, Inc.
For my image editing program I'm trying to figure out the "right" way to
represent my image data. There are two issues here that I can think of:
the actual internal image representation and the image that is actually
displayed. The former consists of a set of layered data that is
composited in various ways, the latter is simply the output of the
composition.
The first approach that I'm thinking of is that I use NSImageView,
NSImage and NSBitmapRep, then simply mess with the representation to get
the proper output while keeping my data in a nice, hidden internal
format. This is similar to the fractal bitmap image code at CocoaDev.
The second approach is to subclass NSView or NSControl with my own view
that knows how to parse my internal data. Is this re-inventing the
wheel too much?
I'll also need to do editing operations within the view, so I'll need to
be able to receive input.
One final thing: I'll need to add overlayed editing hints, e.g.
selection rectangles, etc. I could see subclassing NSImageView so that
I can render those separately (by overriding and supplementing
-drawRect), or I could composite them into the NSBitmapImageRep,
although the latter sounds a lot more expensive because if I have any
animating aspects there will be constant composition.
Any advice/ideas are appreciated.
Thanks,
Brian Hook, President
Pyrogon, Inc.