Oh boy .. this is getting deeper and deeper.<br><br>Macport&#39;s Cairomm port does not contain quartz_surface.h since it is not included in the official 1.2.4 version (<a href="http://cairographics.org/releases/cairomm-1.2.4.tar.gz">
http://cairographics.org/releases/cairomm-1.2.4.tar.gz</a>). I&#39;ve checked out cairomm from CVS and I&#39;ve managed to install it with quartz support (freshly checked out version is 1.0). Apart from the versioning mistery so far so good.
<br>Now the stupid-beginner question: how can I use the installed cairomm from Xcode? It is installed under /usr/... that is unfortunatelly unusable from Xcode + I have no experience using 3rd party libraries within Xcode.
<br><br>Could you adwise something?:)<br><br>Cheers,<br>P<br><br><br><div><span class="gmail_quote">On 6/21/07, <b class="gmail_sendername">Hugo Vincent</b> &lt;<a href="mailto:hugo.vincent@gmail.com">hugo.vincent@gmail.com
</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Here is a simple example I put together when I went through this<br>exact painful process a couple of months back. I haven&#39;t tested it
<br>for a while, but it seems to still run and might be of use still.<br>Also, this uses Cairomm, but you should be able to figure it out the<br>minor changes in API to change it from Cairomm to plain Cairo.<br><br>Cheers,
<br>Hugo Vincent.<br><br>-----------------------------------------------------------<br>testview.h:<br>-----------------------------------------------------------<br><br>#import &lt;Cocoa/Cocoa.h&gt;<br><br>// Put one of these views into your layout in Interface Builder.
<br>@interface TestView : NSView<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// nothing needed here<br>}<br>@end<br><br>-----------------------------------------------------------<br>testview.m<br>-----------------------------------------------------------
<br><br>#include &lt;cairomm/cairomm.h&gt;<br>#include &lt;cairomm/quartz_surface.h&gt;<br><br>#ifndef CAIRO_HAS_QUARTZ_SURFACE<br>#error Need to build Cairo with Quartz support (version 1.4.0 or higher)<br>#endif<br><br>
@implementation TestView<br><br>- (id)initWithFrame:(NSRect)frameRect<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ((self = [super initWithFrame:frameRect]) != nil)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// nothing needed here<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return self;
<br>}<br><br>- (BOOL)isOpaque<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return NO;<br>}<br><br>- (void)drawRect:(NSRect)rect<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get the size of this NSView<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NSRect bounds = [self bounds];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int width = bounds.size.width
;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int height = bounds.size.height;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get CoreGraphcis context reference<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CGContextRef ctx = (CGContextRef)[[NSGraphicsContext currentContext]<br>graphicsPort];<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Make the CGContext coordinate system sane, as expected by Cairo
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CGContextTranslateCTM (ctx, 0.0, height);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CGContextScaleCTM (ctx, 1.0, -1.0);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Create the Cairo surface and context<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cairo::RefPtr&lt;Cairo::QuartzSurface&gt; surface =<br>
Cairo::QuartzSurface::create(ctx, width, height);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cairo::RefPtr&lt;Cairo::Context&gt; cr = Cairo::Context::create(surface);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Cairo-Quartz fallback surfaces don&#39;t work properly, so we need to
<br>create a temp. surface like this:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cr-&gt;push_group();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//---------- Drawing stuff (put your code in here)<br>-------------------------------<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Draw a radial gradient (copied and pasted, more or less, from
<br><a href="http://cairographics.org/samples/gradient.html">http://cairographics.org/samples/gradient.html</a>)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cr-&gt;scale(width,height);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cairo::RefPtr&lt;Cairo::RadialGradient&gt; grad2 =<br>Cairo::RadialGradient::create(
0.45, 0.4, 0.1, 0.4, 0.4, 0.5);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;grad2-&gt;add_color_stop_rgba(0, 1,0,0, 1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;grad2-&gt;add_color_stop_rgba(1, 0,1,0, 1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cr-&gt;set_source(grad2);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cairo_arc (cr, 0.5, 0.5, 0.3, 0, 2 * M_PI);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cr-&gt;fill();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//---------------------------------------------------------------------<br>-----------<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Finally, paint the temporary surface we made<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cr-&gt;pop_group_to_source();
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cr-&gt;paint();<br>}<br><br>@end<br><br><br>On 21/06/2007, at 7:00 AM, <a href="mailto:cairo-request@cairographics.org">cairo-request@cairographics.org</a> wrote:<br>&gt; Message: 1<br>&gt; Date: Wed, 20 Jun 2007 15:52:51 +0200
<br>&gt; From: &quot; Ipacs P?ter &quot; &lt;<a href="mailto:peter@ipacs.hu">peter@ipacs.hu</a>&gt;<br>&gt; Subject: [cairo] [cairo osx] OS X example<br>&gt; To: <a href="mailto:cairo@cairographics.org">cairo@cairographics.org
</a><br>&gt; Message-ID:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<a href="mailto:6a86db250706200652m24dd6b9di17a881912402da62@mail.gmail.com">6a86db250706200652m24dd6b9di17a881912402da62@mail.gmail.com</a>&gt;<br>&gt; Content-Type: text/plain; charset=&quot;utf-8&quot;
<br>&gt;<br>&gt; Hi there,<br>&gt;<br>&gt; I&#39;m quite new to cairo so please excuse me if I ask obvious<br>&gt; questions:)<br>&gt;<br>&gt; I&#39;m trying to build the quartz example from the CVS (<br>&gt; <a href="http://webcvs.cairographics.org/cairo-demo/quartz/">
http://webcvs.cairographics.org/cairo-demo/quartz/</a>) but it fails.<br>&gt; This is what I get:<br>&gt; cc -g -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-<br>&gt; declarations<br>&gt; -Wredundant-decls `pkg-config --cflags cairo`&nbsp;&nbsp; -c -o 
main.o main.c<br>&gt; main.c: In function &#39;TestWindowEventHandler&#39;:<br>&gt; main.c:65: error: incompatible type for argument 1 of<br>&gt; &#39;cairo_quartz_surface_create&#39;<br>&gt; main.c: In function &#39;RedrawTimerCallback&#39;:
<br>&gt; main.c:188: warning: &#39;SetRect&#39; is deprecated (declared at<br>&gt; /System/Library/Frameworks/ApplicationServices.framework/Frameworks/<br>&gt; QD.framework/Headers/Quickdraw.h:2401)<br>&gt; main.c: In function &#39;CreateTestWindow&#39;:
<br>&gt; main.c:205: warning: &#39;SetRect&#39; is deprecated (declared at<br>&gt; /System/Library/Frameworks/ApplicationServices.framework/Frameworks/<br>&gt; QD.framework/Headers/Quickdraw.h:2401)<br>&gt; make: *** [main.o
] Error 1<br>&gt;<br>&gt; What do you think about it?<br>&gt;<br>&gt; Another question:<br>&gt; Are there any OS X examples around that can be used out-of-the-box?<br>&gt; I mean<br>&gt; examples that does not require hundreds of dependencies and can be
<br>&gt; compiled<br>&gt; by a simple &#39;make&#39; or something.<br>&gt;<br>&gt; Cheers,<br>&gt; Peter<br><br>_______________________________________________<br>cairo mailing list<br><a href="mailto:cairo@cairographics.org">
cairo@cairographics.org</a><br><a href="http://cairographics.org/cgi-bin/mailman/listinfo/cairo">http://cairographics.org/cgi-bin/mailman/listinfo/cairo</a><br></blockquote></div>