Re: Best drawing technology for audio waveforms, envelopes, etc.?
Re: Best drawing technology for audio waveforms, envelopes, etc.?
- Subject: Re: Best drawing technology for audio waveforms, envelopes, etc.?
- From: "Hans Kuder" <email@hidden>
- Date: Sun, 24 Jun 2007 13:44:17 -0400
On 6/23/07, Alastair Houghton <email@hidden> wrote:
My personal take on this is that you probably want to make your
display into a *single* NSView, and then make your own objects
representing the layers. Then in your -drawRect: you might do
something like this:
- (void)drawRect:(NSRect)rect
{
[layers makeObjectsPerformSelector:@selector(draw)];
}
Each of your layer objects (in your "layers" NSArray, which should be
a member variable) can then implement a -draw method to render
whatever data it pleases. If a layer is particularly expensive to
render, you could make it draw its content to an image or a CGLayer,
then have the -draw method just render that.
You might also consider making your layer objects subclasses of
NSResponder, so that they can handle events. If you do that, you can
make your layer objects part of the responder chain, which can be
quite useful for handling commands and events.
This seems like a pretty reasonable way to go about it. As for the drawing
operation itself, how well would a NSBezierPath handle the hundreds of
segments required to draw a waveform? At least when zoomed out, it seems a
bit overkill to have a "line" between every next pixel on the screen when
it's pretty much guaranteed that the user will only see the join points
between lines rather than the lines themselves. Is there a more efficient
way to do this?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden