Re: displaying a calculated image
Re: displaying a calculated image
- Subject: Re: displaying a calculated image
- From: Cameron Hayne <email@hidden>
- Date: Fri, 31 May 2002 03:49:20 -0400
I have revised my sample code which displays a calculated image.
It now handles resizing of the window taking account of the size
constraints of the model (e.g. width divisible by 32) - this was fairly
tricky to do in a nice way. ("nice" both for the programmer and the user)
And it uses NSEventTrackingRunLoopMode for the timer so that I no longer
need to subclass NSSlider.
You can get my sample code at:
http://www.hayne.net/MacDev/ImageCalc/
This illustrates several aspects of Cocoa programming:
* calculation in a separate thread
* synchronizing use of shared variables via NSLock
* image drawn via NSBitmapImageRep in a subclass of NSView
* regular display updates via NSTimer
* using NSEventTrackingRunLoopMode to get timer events while mouse is
down
* handling window resizing via inLiveResize
* handling model size constraints when resizing
* auxiliary information displayed in an NSDrawer
I would be very interested in hearing any comments on the above code:
- better (simpler/faster) ways to do it ?
- opinions on my use of MVC ?
... Cameron
--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.