Compiling TTGraphics for Mac OSX (HOWTO)¶
These instructions have been working on a system with:
- Xcode 3.1.2 or higher installed
- Running Mac OSX 10.5.6
- MaxMSP 5.0.7
- Able to compile the ordinary Jamoma externals in the usual way
Howto:
- Do an SVN update of Jamoma DSP
- Open the
/DSP/extensions/TTGraphics/TTGraphics.xcodeprojproject - If you have attempted to build before, first do a "Clean All Targets", and then "Build" (Development)
- Next open
/DSP/examples/MaxMSP/tt.graphics/tt.graphics.xcodeproj - If you have attempted to build before, first do a "Clean All Targets", and then "Build" (Development)
- Next open
/DSP/examples/MaxMSP/tt.graphicsui/tt.graphics.xcodeproj - If you have attempted to build before, first do a "Clean All Targets", and then "Build" (Development)
- Start MaxMSP
- Open the help patches for tt.graphics and tt.graphicsui and test them out. Double-click tt.graphics to see what is going on in the dedicated graphical window.
Understanding Cairo¶
- http://cairographics.org/
- http://www.zetcode.com/tutorials/cairographicstutorial/
- http://cairographics.org/samples/
On the Mac, we use NSWindow for providing our context and mouse interaction:
Manually Compiling the Cairo Lib¶
Compiling Cairo for the Mac outside of X11 is annoying. For version 1.8.6, the following seems to at least compile (though who knows if it works):
./configure --enable-quartz-image --enable-test-surfaces --without-x make sudo make install # find the build in /usr/local/lib, /usr/local/includes, etc.
The Quartz backend seems to be experimental. So if you run
make check
after the make, then you will see lots of fails and crashes. This does not instill confidence. Perhaps we should just use the X11 rendering and then copy the bitmap. That will be slower, and it may not look as good, but it might be more full featured?
API Notes¶
In Max's jgraphics there is a jgraphics_arc() function, as well as a jgraphics_ovalarc() which lets you have the arc inside an ellipse instead of a circle. You can get the same effect from jgraphics_arc() by using a transform that scales the two axes by different amounts. However, cairo doesn't have a cairo_ellipse() call at all. Everything is done with cairo_arc(). To draw a circle you tell it to go from 0 to 2pi. To draw an ellipse you apply a scale transform in different amounts to the x and y axes.
Mouse Interaction¶
Currently this is being handled on an ad-hoc basis. In particular, check the BlueButter AU plug-in. Also note the following references:
- http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/EventHandlingBasics/EventHandlingBasics.html#//apple_ref/doc/uid/10000060i-CH5-SW15
- http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/HandlingMouseEvents/HandlingMouseEvents.html#//apple_ref/doc/uid/10000060i-CH6-SW1
- http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSResponder_Class/Reference/Reference.html#//apple_ref/occ/instm/NSResponder/mouseDragged: