<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Is your struct named Cairo or Surface?</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">If Cairo is the module name, you're trying to instantiate the module.<br><br></div><div id="AppleMailSignature">- Harlan</div><div><br>On Dec 11, 2015, at 7:55 PM, Gage Morgan &lt;<a href="mailto:gagemorgan@outlook.com">gagemorgan@outlook.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div>

<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<div dir="ltr"><span style="font-size: 15px; line-height: 21.3px; background-color: rgb(255, 255, 255);">How would you use things like cairo.moveTo() outside of the wrapping file? I've gone as far as writing a module named "Cairo," taking the methods as mentioned above out, and moving them to their own directory "tests." I have added "Cairo" as a dependency for "tests," but there appears to be something wrong when I try to call:</span><div style="line-height: 21.3px; font-size: 15px; background-color: rgb(255, 255, 255);"><br style="line-height: 21.3px;"></div><div style="line-height: 21.3px; font-size: 15px; background-color: rgb(255, 255, 255);">let cairo = Cairo(format: CAIRO_FORMAT_ARGB32, width: 421, height: 410)</div><div style="line-height: 21.3px; font-size: 15px; background-color: rgb(255, 255, 255);"><br style="line-height: 21.3px;"></div><div style="line-height: 21.3px; font-size: 15px; background-color: rgb(255, 255, 255);">Why can I not call Cairo()? The error:</div><div style="line-height: 21.3px; font-size: 15px; background-color: rgb(255, 255, 255);"><br style="line-height: 21.3px;"></div><div style="line-height: 21.3px; font-size: 15px; background-color: rgb(255, 255, 255);"><div style="line-height: 21.3px;">Compiling Swift Module 'test' (1 sources)</div><div style="line-height: 21.3px;">/home/mgage/swift-cairo-bindings/test/main.swift:4:18: error: cannot call value of non-function type 'module&lt;Cairo&gt;'</div><div style="line-height: 21.3px;">let cairo = Cairo(format: CAIRO_FORMAT_ARGB32, width: 421, height: 410)</div><div style="line-height: 21.3px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ~~~~~^</div><div style="line-height: 21.3px;">&lt;unknown&gt;:0: error: build had 1 command failures</div><div style="line-height: 21.3px;">swift-build: exit(1): ["/home/mgage/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/bin/swift-build-tool", "-f", "/home/mgage/swift-cairo-bindings/test/.build/debug/test.o/llbuild.yaml"]</div><div style="line-height: 21.3px;"><br></div><div style="line-height: 21.3px;">I don't know whether or not I want to translate methods into straight-up properties yet.</div><div style="line-height: 21.3px;"><br style="line-height: 21.3px;"></div><div style="line-height: 21.3px;">Thanks, support here has been great so far. Cheers!</div><div style="line-height: 21.3px;">--MGage--</div><div><br></div></div><br><div><hr id="stopSpelling">Subject: Re: [swift-users] Need Help with C-to-Swift (finally)<br>From: <a href="mailto:harlan@harlanhaskins.com">harlan@harlanhaskins.com</a><br>Date: Fri, 11 Dec 2015 19:35:46 -0500<br>CC: <a href="mailto:gagemorgan@outlook.com">gagemorgan@outlook.com</a>; <a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>To: <a href="mailto:jackl@apple.com">jackl@apple.com</a><br><br><div>I considered that but couldn't find a cairo_get_font_scale function quickly to complement the setter <img src="https://a.gfx.ms/emoji_1F605.png" class="Emoji$1F605$AD4 RenderedEmoji" title="Smiling face with open mouth and cold sweat" alt="Smiling face with open mouth and cold sweat"></div><div id="ecxAppleMailSignature"><br></div><div id="ecxAppleMailSignature">But yes, a full wrapper would transparently handle getting and setting.<br><br></div><div id="ecxAppleMailSignature">- Harlan</div><div><br>On Dec 11, 2015, at 7:28 PM, Jack Lawrence &lt;<a href="mailto:jackl@apple.com">jackl@apple.com</a>&gt; wrote:<br><br></div><blockquote><div>For getter-setter pairs like `setLineWidth`, you might consider turning them into properties:<div><br></div><div><span style="font-family:Calibri;font-size:16px;">cairo.setLineWidth(0.1) // old</span></div><div><span style="font-family:Calibri;font-size:16px;">cairo.lineWidth = 0.1 // new</span></div><div><div><br><div><blockquote><div>On Dec 11, 2015, at 4:22 PM, Gage Morgan via swift-users &lt;<a href="mailto:swift-users@swift.org">swift-users@swift.org</a>&gt; wrote:</div><br class="ecxApple-interchange-newline"><div><div dir="ltr" style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;">Harlan,<div><br></div><div>The answer is yes. I even managed to get a couple you didn't list on my own:</div><div><br></div><div><div>let cairo = Cairo(format: CAIRO_FORMAT_ARGB32, width: 421, height: 410)</div><div>cairo.scale(10.0, y: 10.0)</div><div>cairo.moveTo(29.0, y: 14.7)</div><div>cairo.lineTo(37.6, y: 13.0)</div><div>cairo.moveTo(37.6, y: 13.0)</div><div>cairo.lineTo(30.4, y: 22.2)</div><div>cairo.moveTo(30.4, y: 22.2)</div><div>cairo.lineTo(29.0, y: 14.7)</div><div>cairo.setLineWidth(0.1)</div><div>cairo.stroke()</div><div>cairo.surfaceWriteToPNG("boobs.png")</div><div><br></div><div>Swift is both really neat and really frustrating when learning it.&nbsp;</div><br><div><hr id="ecxstopSpelling">Subject: Re: [swift-users] Need Help with C-to-Swift (finally)<br>From:<span class="ecxApple-converted-space">&nbsp;</span><a href="mailto:harlan@harlanhaskins.com">harlan@harlanhaskins.com</a><br>Date: Fri, 11 Dec 2015 17:21:38 -0500<br>CC:<span class="ecxApple-converted-space">&nbsp;</span><a href="mailto:kwame.bryan@gmail.com">kwame.bryan@gmail.com</a>;<span class="ecxApple-converted-space">&nbsp;</span><a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>To:<span class="ecxApple-converted-space">&nbsp;</span><a href="mailto:gagemorgan@outlook.com">gagemorgan@outlook.com</a><br><br>Gage,<div><br></div><div>Sorry, I just got back from class.</div><div><br></div><div>I’ll respond in line!</div><div><br><div><blockquote><div>On Dec 11, 2015, at 5:09 PM, Gage Morgan &lt;<a href="mailto:gagemorgan@outlook.com">gagemorgan@outlook.com</a>&gt; wrote:</div><br class="ecxApple-interchange-newline"><div><div><div>Harlan,</div><div><br></div><div>I read on<span class="ecxApple-converted-space">&nbsp;</span><a dir="ltr" href="http://cairographics.org/" target="_blank">cairographics.org</a><span class="ecxApple-converted-space">&nbsp;</span>about bindings awhile back. I think they want cairo, not surface, so we would have something like:</div><div><br></div><div>let cairo = Surface(format: CAIRO_FORMAT_ARGB32, width: 240, height: 80)</div><div>cairo.setFontFace("serif", weight: CAIRO_FONT_WEIGHT_BOLD)</div><div>cairo.setFontSize(32.0)</div><div>cairo.setSourceRGB(0.0, g: 0.0, b: 1.0)</div><div>cairo.moveTo(x: 10, y: 50)</div><div>cairo.showText("Hello, World!")</div><div>cairo.writeToPNG("hello.png")</div><div><br></div><div>Would this work the same as before without "surface" but instead "cairo”?<br></div></div></div></blockquote><div><br></div><div>Absolutely! That’s just a variable name — it could be called ‘puppies’, though that’s not very readable.</div><br><blockquote><div><div><div><br><div class="ecxacompli_signature">Sent from<span class="ecxApple-converted-space">&nbsp;</span><a href="https://aka.ms/qtex0l" target="_blank">Outlook Mobile</a></div><br></div><br><br><br><div class="ecxgmail_quote">On Fri, Dec 11, 2015 at 2:00 PM -0800, "Gage Morgan via swift-users"<span class="ecxApple-converted-space">&nbsp;</span><span dir="ltr">&lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt;</span><span class="ecxApple-converted-space">&nbsp;</span>wrote:<br><br></div><div><div>I went and looked at it, and even now it looks like I want to take every function I've used in Cairo and translate it to Swift. Swift is such a...simple language compared to everything else. That being said, as a result of the specs, it is also much more verbose in terms of writing the code. Compared to other languages, it is written out instead of shoved onto a few lines.&nbsp;</div><div><br></div><div>Is there a way to import modules into other modules? Because it looks like a weekend project that will eventually get posted by myself at<span class="ecxApple-converted-space">&nbsp;</span><a href="http://github.com/Christoffen-Corporation" target="_blank">http://github.com/Christoffen-Corporation</a>.&nbsp;<br><br><div class="ecxx_acompli_signature">Sent from<span class="ecxApple-converted-space">&nbsp;</span><a href="https://aka.ms/qtex0l" target="_blank">Outlook Mobile</a></div></div></div></div></div></blockquote><div><br></div><div>I’d recommend having a look at the Swift package manager example again —&nbsp;<a href="https://github.com/apple/swift-package-manager/blob/master/Documentation/SystemModules.md" target="_blank">https://github.com/apple/swift-package-manager/blob/master/Documentation/SystemModules.md</a></div><div><br></div><div>There’s an example of using those modules together.</div><br><blockquote><div><div><div><br><div class="ecxx_gmail_quote">On Fri, Dec 11, 2015 at 1:52 PM -0800, "Gage Morgan via swift-users"<span class="ecxApple-converted-space">&nbsp;</span><span dir="ltr">&lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt;</span><span class="ecxApple-converted-space">&nbsp;</span>wrote:<br><br></div><div><div>I meant the code posted in the Gist link above. I don't know jack squat about qsort. I'm hoping that if I can reverse-engineer code already produced, I can apply it to other parts of Cairo.&nbsp;<br><br><div class="ecxx_x_acompli_signature">Sent from<span class="ecxApple-converted-space">&nbsp;</span><a href="https://aka.ms/qtex0l" target="_blank">Outlook Mobile</a></div></div></div></div></div></div></blockquote><div><br></div><div>I’ll go ahead and comment it, but I think it’s simplistic enough that it should be readable with a grasp of some Swift concepts. Perhaps it’s a good idea to look through The Swift Programming Language to figure out some of the constructs I used — they’re fairly basic constructs.</div><br><blockquote><div><div><div><div><br><div class="ecxx_x_gmail_quote">On Fri, Dec 11, 2015 at 1:34 PM -0800, "Kwame Bryan"<span dir="ltr">&lt;<a href="mailto:kwame.bryan@gmail.com" target="_blank">kwame.bryan@gmail.com</a>&gt;</span><span class="ecxApple-converted-space">&nbsp;</span>wrote:<br><br></div><div style="word-wrap:break-word;">Tutorial on the subject.&nbsp;<a href="http://chris.eidhof.nl/posts/swift-c-interop.html" target="_blank">http://chris.eidhof.nl/posts/swift-c-interop.html</a>&nbsp;<div><br></div><div>Regards</div><div>Kwame</div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=-2FcgwiRAxmHDdptrhrsAJKMBtNqQpWV-2BwUfjpvH9AIapmo3-2BHsnvTus94jzsAd9QbgrzJUOBMUGL1vbZcJzhtyVp8DdIXzqymeEFv78CU98Vyvkel-2BZ9jAScwY1YDPFzrfK4k0wzAL0RYvODDsxuakhZXZY7WUvtIDD6jT8hO1G12IjFAP4zcPGisA85WWuoE0N2vgQ90Wpd69-2B1PAy-2FgJ6kuPbhfqVCSq9RdDYqcqzU-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0px !important;padding:0px !important;"></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=-2FcgwiRAxmHDdptrhrsAJKMBtNqQpWV-2BwUfjpvH9AIapEPR-2FCXY9amYXSxN3Pbi2XrZMfHEN794BjyOKzqKEN1I5HM69Lqapv6DjsA6FzE8d9q3N3v71RBohhpxfFJmwu-2FppXm9-2F5fp7k5-2B6DDHtFIR52wVygcHpVKdRV8liNPtLvkthJRTxyuxSppBSc-2BI5r-2B9L8DyZNdiOAXPmJzd91Fd8lk3drIZ4JVKfkyoAcyrw-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0px !important;padding:0px !important;"></div></div><span id="ecxcid:CAD42AA7-159A-44FE-8B20-00668767F2BB@student.rit.edu.">&lt;Mail Attachment.txt&gt;</span><span id="ecxcid:0E99C342-6109-49EF-9D11-9ADA11D25B61@student.rit.edu.">&lt;Mail Attachment.txt&gt;</span></div></blockquote></div><br></div></div></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=fPHCHxM8OEqkFI0LoY8YMuXDKRTx6ILsXcJMmyHEOCK1g2WPDrZyFsR7DLDlbrRiEA6-2FGdzFprAFvdEcY7UBE0x-2BFtj95YctjkpAVfe-2Bq7SV4xEdQv70imgp6XrHB8UEaqlZ4BYO9LAYgBuaTOwze-2B3ZnRJhC4BIQTgABw48xeW5yEF4z8bM-2F5EoYoKcqCRXbycyP-2Frx8zSSDmVf9vC2vt-2BHI1Qh6R8GHcjxzdgIsXQ-3D" alt="" width="1" height="1" border="0" style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;height:1px !important;width:1px !important;border-width:0px !important;padding:0px !important;"><span style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline !important;"><span class="ecxApple-converted-space">&nbsp;</span></span><span style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline !important;">_______________________________________________</span><br style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><span style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline !important;">swift-users mailing list</span><br style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><a href="mailto:swift-users@swift.org" style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;">swift-users@swift.org</a><br style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><a href="https://lists.swift.org/mailman/listinfo/swift-users" style="font-family:Calibri;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a></div></blockquote></div><br></div></div></div></blockquote></div>                                               </div>
</div></blockquote></body></html>