Changeset 119
- Timestamp:
- 05/18/06 23:08:27 (6 years ago)
- Files:
-
- trunk/cairo/README.html (modified) (5 diffs)
- trunk/cairo/README.rst (modified) (6 diffs)
- trunk/cairo/build_docs_cairooo.brf (added)
- trunk/cairo/cairo-build.d (added)
- trunk/cairo/cairo/cairo.d (modified) (2 diffs)
- trunk/cairo/cairo/cairofuncs.d (modified) (1 diff)
- trunk/cairo/cairo/cairotypes.d (modified) (2 diffs)
- trunk/cairo/cairo/glitz (added)
- trunk/cairo/cairo/glitz/cairo_glitz.d (added)
- trunk/cairo/cairo/glitz/cairofuncs_glitz.d (added)
- trunk/cairo/cairo/glitz/cairotypes_glitz.d (added)
- trunk/cairo/cairo/loader.d (modified) (4 diffs)
- trunk/cairo/cairo/png/cairo_png.d (modified) (1 diff)
- trunk/cairo/cairo/png/cairofuncs_png.d (modified) (1 diff)
- trunk/cairo/cairo/png/cairotypes_png.d (modified) (1 diff)
- trunk/cairo/cairo/win32/cairo_win32.d (modified) (1 diff)
- trunk/cairo/cairo/win32/cairofuncs_win32.d (modified) (1 diff)
- trunk/cairo/cairo/win32/cairotypes_win32.d (modified) (1 diff)
- trunk/cairo/cairo/xlib (added)
- trunk/cairo/cairo/xlib/cairo_xlib.d (added)
- trunk/cairo/cairo/xlib/cairofuncs_xlib.d (added)
- trunk/cairo/cairo/xlib/cairotypes_xlib.d (added)
- trunk/cairo/cairo_snippets/cairo_snippets_png.d (modified) (1 diff)
- trunk/cairo/cairo_snippets/cairo_snippets_png_run.sh (modified) (1 diff)
- trunk/cairo/cairooo (added)
- trunk/cairo/cairooo-build.d (added)
- trunk/cairo/cairooo/all.d (added)
- trunk/cairo/cairooo/cairo.d (added)
- trunk/cairo/cairooo/callbacks.d (added)
- trunk/cairo/cairooo/context.d (added)
- trunk/cairo/cairooo/enums.d (added)
- trunk/cairo/cairooo/exceptions.d (added)
- trunk/cairo/cairooo/extra (added)
- trunk/cairo/cairooo/extra/all.d (added)
- trunk/cairo/cairooo/extra/shapetemplate.d (added)
- trunk/cairo/cairooo/extra/types.d (added)
- trunk/cairo/cairooo/fontextents.d (added)
- trunk/cairo/cairooo/fontface.d (added)
- trunk/cairo/cairooo/fontoptions.d (added)
- trunk/cairo/cairooo/glitz (added)
- trunk/cairo/cairooo/glitz/all.d (added)
- trunk/cairo/cairooo/glitz/glitz.d (added)
- trunk/cairo/cairooo/glitz/glitzsurface.d (added)
- trunk/cairo/cairooo/glyph.d (added)
- trunk/cairo/cairooo/gradient.d (added)
- trunk/cairo/cairooo/imagebuffersurface.d (added)
- trunk/cairo/cairooo/imagesurface.d (added)
- trunk/cairo/cairooo/lineargradient.d (added)
- trunk/cairo/cairooo/matrix.d (added)
- trunk/cairo/cairooo/path.d (added)
- trunk/cairo/cairooo/pattern.d (added)
- trunk/cairo/cairooo/png (added)
- trunk/cairo/cairooo/png/all.d (added)
- trunk/cairo/cairooo/png/png.d (added)
- trunk/cairo/cairooo/png/pngsurface.d (added)
- trunk/cairo/cairooo/radialgradient.d (added)
- trunk/cairo/cairooo/scaledfont.d (added)
- trunk/cairo/cairooo/solidpattern.d (added)
- trunk/cairo/cairooo/surface.d (added)
- trunk/cairo/cairooo/surfacepattern.d (added)
- trunk/cairo/cairooo/techdoc (added)
- trunk/cairo/cairooo/techdoc/reference-counting.rst (added)
- trunk/cairo/cairooo/textextents.d (added)
- trunk/cairo/cairooo/win32 (added)
- trunk/cairo/cairooo/win32/all.d (added)
- trunk/cairo/cairooo/win32/win32.d (added)
- trunk/cairo/cairooo/win32/win32fontface.d (added)
- trunk/cairo/cairooo/win32/win32scaledfont.d (added)
- trunk/cairo/cairooo/win32/win32surface.d (added)
- trunk/cairo/cairooo/xlib (added)
- trunk/cairo/cairooo/xlib/all.d (added)
- trunk/cairo/cairooo/xlib/drawablesurface.d (added)
- trunk/cairo/cairooo/xlib/pixmapsurface.d (added)
- trunk/cairo/cairooo/xlib/xlib.d (added)
- trunk/cairo/cairooo_snippets (added)
- trunk/cairo/cairooo_snippets/cairooo_snippets_png.d (added)
- trunk/cairo/cairooo_snippets/cairooo_snippets_png_run.bat (added)
- trunk/cairo/cairooo_snippets/cairooo_snippets_png_run.sh (added)
- trunk/cairo/cairooo_snippets/data (added)
- trunk/cairo/cairooo_snippets/data/README.rst (added)
- trunk/cairo/cairooo_snippets/data/romedalen.png (added)
- trunk/cairo/cairooo_snippets/output (added)
- trunk/cairo/cairooo_snippets/snippets (added)
- trunk/cairo/cairooo_snippets/snippets/all.d (added)
- trunk/cairo/cairooo_snippets/snippets/arc.d (added)
- trunk/cairo/cairooo_snippets/snippets/arc_negative.d (added)
- trunk/cairo/cairooo_snippets/snippets/clip.d (added)
- trunk/cairo/cairooo_snippets/snippets/clip_image.d (added)
- trunk/cairo/cairooo_snippets/snippets/common.d (added)
- trunk/cairo/cairooo_snippets/snippets/curve_rectangle.d (added)
- trunk/cairo/cairooo_snippets/snippets/curve_to.d (added)
- trunk/cairo/cairooo_snippets/snippets/fill_and_stroke.d (added)
- trunk/cairo/cairooo_snippets/snippets/fill_and_stroke2.d (added)
- trunk/cairo/cairooo_snippets/snippets/gradient.d (added)
- trunk/cairo/cairooo_snippets/snippets/image.d (added)
- trunk/cairo/cairooo_snippets/snippets/imagepattern.d (added)
- trunk/cairo/cairooo_snippets/snippets/path.d (added)
- trunk/cairo/cairooo_snippets/snippets/set_line_cap.d (added)
- trunk/cairo/cairooo_snippets/snippets/set_line_join.d (added)
- trunk/cairo/cairooo_snippets/snippets/text.d (added)
- trunk/cairo/cairooo_snippets/snippets/text_align_center.d (added)
- trunk/cairo/cairooo_snippets/snippets/text_extents.d (added)
- trunk/cairo/cairooo_tutorial (added)
- trunk/cairo/cairooo_tutorial/lesson01 (added)
- trunk/cairo/cairooo_tutorial/lesson01/lesson01.d (added)
- trunk/cairo/cairooo_tutorial/lesson01/lesson01.linux.brf (added)
- trunk/cairo/cairooo_tutorial/lesson01/lesson01.win32.brf (added)
- trunk/cairo/cairooo_tutorial/lesson02 (added)
- trunk/cairo/cairooo_tutorial/lesson02/lesson02.d (added)
- trunk/cairo/cairooo_tutorial/lesson02/lesson02.linux.brf (added)
- trunk/cairo/cairooo_tutorial/lesson02/lesson02.win32.brf (added)
- trunk/cairo/cairooo_tutorial/lesson03 (added)
- trunk/cairo/cairooo_tutorial/lesson03/lesson03.d (added)
- trunk/cairo/cairooo_tutorial/lesson03/lesson03.linux.brf (added)
- trunk/cairo/cairooo_tutorial/lesson03/lesson03.win32.brf (added)
- trunk/cairo/demos (added)
- trunk/cairo/demos/dlogo (added)
- trunk/cairo/demos/dlogo/README.rst (added)
- trunk/cairo/demos/dlogo/dlogo.d (added)
- trunk/cairo/demos/dlogo/dlogo.linux.brf (added)
- trunk/cairo/demos/dlogo/dlogo.win32.brf (added)
- trunk/cairo/util (added)
- trunk/cairo/util/script.d (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cairo/README.html
r97 r119 14 14 <!-- Build command: 15 15 rst2html.py - -date - -time README.rst README.html --> 16 <div class="contents topic" id="contents"> 17 <p class="topic-title first"><a name="contents">Contents</a></p> 18 <ul class="simple"> 19 <li><a class="reference" href="#introduction" id="id3" name="id3">Introduction</a></li> 20 <li><a class="reference" href="#installation" id="id4" name="id4">Installation</a><ul> 21 <li><a class="reference" href="#cairo-binding" id="id5" name="id5">cairo binding</a></li> 22 <li><a class="reference" href="#cairooo-binding" id="id6" name="id6">cairooo binding</a></li> 23 <li><a class="reference" href="#cairo-snippets" id="id7" name="id7">cairo snippets</a></li> 24 <li><a class="reference" href="#cairooo-tutorial" id="id8" name="id8">cairooo tutorial</a></li> 25 <li><a class="reference" href="#demos" id="id9" name="id9">demos</a></li> 26 <li><a class="reference" href="#documentation" id="id10" name="id10">documentation</a></li> 27 <li><a class="reference" href="#cairo-for-windows" id="id11" name="id11">cairo for Windows</a></li> 28 </ul> 29 </li> 30 <li><a class="reference" href="#usage" id="id12" name="id12">Usage</a><ul> 31 <li><a class="reference" href="#cairo" id="id13" name="id13">cairo</a></li> 32 <li><a class="reference" href="#cairooo" id="id14" name="id14">cairooo</a></li> 33 </ul> 34 </li> 35 <li><a class="reference" href="#contributing" id="id15" name="id15">Contributing</a></li> 36 <li><a class="reference" href="#thanks" id="id16" name="id16">Thanks</a></li> 37 <li><a class="reference" href="#credits" id="id17" name="id17">Credits</a></li> 38 </ul> 39 </div> 16 40 <div class="section" id="introduction"> 17 <h1><a name="introduction">Introduction</a></h1>41 <h1><a class="toc-backref" href="#id3" name="introduction">Introduction</a></h1> 18 42 <p>This project's aim is to provide a complete, up-to-date D binding for the 19 43 <a class="reference" href="http://cairographics.org/">cairo</a> 2D drawing API. Currently, the binding supports the base cairo 20 functions, PNG functions, and Win32 functions.</p> 44 functions and PNG functions. It also contains support for the Glitz, Win32 45 and Xlib backends, but these are largely untested.</p> 46 <p>This project also provides an object-oriented layer above the raw bindings 47 called <tt class="docutils literal"><span class="pre">cairooo</span></tt> which adds support for objects and exceptions, integrating 48 cairo more seamlessly with D style programming. In time, we hope to also 49 provide a library of additional, high-level functionality with this layer.</p> 21 50 </div> 22 51 <div class="section" id="installation"> 23 <h1><a name="installation">Installation</a></h1> 52 <h1><a class="toc-backref" href="#id4" name="installation">Installation</a></h1> 53 <div class="section" id="cairo-binding"> 54 <h2><a class="toc-backref" href="#id5" name="cairo-binding">cairo binding</a></h2> 24 55 <p>To install, simply copy the <tt class="docutils literal"><span class="pre">cairo</span></tt> directory to a place in your D 25 compiler's import path. That's all there is to it. Currently, there is no 26 automated support for building an import library, although this is planned 27 for a future release (ie: when I get around to it).</p> 56 compiler's import path. That's all there is to it.</p> 57 <p>If you really want to have import libraries to use, then you can build these 58 using the <tt class="docutils literal"><span class="pre">cairo-build.d</span></tt> script, which will place them in the <tt class="docutils literal"><span class="pre">lib</span></tt> 59 directory. It can be run using either:</p> 60 <pre class="literal-block"> 61 dmd -run cairo-build.d ARGS 62 </pre> 63 <p>Or, if that fails:</p> 64 <pre class="literal-block"> 65 build cairo-build.d 66 cairo-build ARGS 67 </pre> 68 <p>The command line arguments may be empty (signifying a default build), or 69 contain one or more targets to build. You may also use the <tt class="docutils literal"><span class="pre">--verbose</span></tt> 70 switch to get more verbose output, and the <tt class="docutils literal"><span class="pre">--debug</span></tt> switch to produce 71 libraries with debug symbols <a class="footnote-reference" href="#debuglibs" id="id1" name="id1">[1]</a>.</p> 72 <p>Use the <tt class="docutils literal"><span class="pre">--help</span></tt> switch for full usage information.</p> 73 </div> 74 <div class="section" id="cairooo-binding"> 75 <h2><a class="toc-backref" href="#id6" name="cairooo-binding">cairooo binding</a></h2> 76 <p>To install the cairooo binding, simply copy both the <tt class="docutils literal"><span class="pre">cairo</span></tt> and <tt class="docutils literal"><span class="pre">cairooo</span></tt> 77 directories to a place on your D compiler's import path.</p> 78 <p>If you want to build import libraries, then you can use the 79 <tt class="docutils literal"><span class="pre">cairooo-build.d</span></tt> script, which will build them to the <tt class="docutils literal"><span class="pre">lib</span></tt> directory. 80 Usage is mostly the same as using <tt class="docutils literal"><span class="pre">cairo-build.d</span></tt> (see above).</p> 81 </div> 82 <div class="section" id="cairo-snippets"> 83 <h2><a class="toc-backref" href="#id7" name="cairo-snippets">cairo snippets</a></h2> 84 <p>The <tt class="docutils literal"><span class="pre">cairo_snippets</span></tt> and <tt class="docutils literal"><span class="pre">cairooo_snippets</span></tt> directories contain the 85 "snippets" example programs provided by the cairo developers ported to D. 86 They use the <tt class="docutils literal"><span class="pre">cairo</span></tt> and <tt class="docutils literal"><span class="pre">cairooo</span></tt> bindings respectively.</p> 87 <p>These do not have a "proper" build script like the binding itself: they are 88 generally built with either a Windows batch file or shell script. However, if 89 you wish to build them manually, the command to do so usually looks like 90 this:</p> 91 <pre class="literal-block"> 92 build -cleanup -release -inline -I.. NAME_OF_SNIPPET 93 </pre> 94 <p>Just be sure to create the <tt class="docutils literal"><span class="pre">output</span></tt> directory if it does not exist first.</p> 95 </div> 96 <div class="section" id="cairooo-tutorial"> 97 <h2><a class="toc-backref" href="#id8" name="cairooo-tutorial">cairooo tutorial</a></h2> 98 <p>The <tt class="docutils literal"><span class="pre">cairooo_tutorial</span></tt> contains the beginnings of a very simple introductory 99 tutorial to programming image programs in D using the cairooo binding. It is 100 pathetically incomplete; however, it may be a useful starting point.</p> 101 </div> 102 <div class="section" id="demos"> 103 <h2><a class="toc-backref" href="#id9" name="demos">demos</a></h2> 104 <p>The <tt class="docutils literal"><span class="pre">demos</span></tt> directory will contain a few small demo programs to showcase the 105 binding. Currently, it only has one demo, so the plural is prehaps 106 misleading. Hopefully this will change :)</p> 107 </div> 108 <div class="section" id="documentation"> 109 <h2><a class="toc-backref" href="#id10" name="documentation">documentation</a></h2> 110 <p>Whilst this project hopes to eventually have full DDoc documentation for the 111 cairooo binding, we will not be providing anything other than minimal 112 documentation for the raw cairo API binding. The rationale is that since the 113 original C api and the raw D api are for the most part identical, there is no 114 need to duplicate the existing C documentation.</p> 115 <p>That said, the cairooo documentation itself is woefully lacking. What does 116 exist can be built using the following command:</p> 117 <pre class="literal-block"> 118 build @build_docs_cairooo.brf 119 </pre> 120 <p>Please note that you will need to create the following directory structure 121 <em>first</em> if it does not yet exist:</p> 122 <pre class="literal-block"> 123 docs\ 124 cairooo\ 125 extra\ 126 glitz\ 127 png\ 128 win32\ 129 xlib\ 130 </pre> 131 </div> 28 132 <div class="section" id="cairo-for-windows"> 29 <h2><a name="cairo-for-windows">cairo for Windows</a></h2>133 <h2><a class="toc-backref" href="#id11" name="cairo-for-windows">cairo for Windows</a></h2> 30 134 <p>If you are using Windows, you will also probably want to grab the cairo 31 135 library itself. The best version I have found is on <a class="reference" href="http://www.iki.fi/tml/index.html">Tor Lillqvist</a>'s … … 44 148 </div> 45 149 <div class="section" id="usage"> 46 <h1><a name="usage">Usage</a></h1> 150 <h1><a class="toc-backref" href="#id12" name="usage">Usage</a></h1> 151 <div class="section" id="cairo"> 152 <h2><a class="toc-backref" href="#id13" name="cairo">cairo</a></h2> 47 153 <p>To use the binding, simply import <tt class="docutils literal"><span class="pre">cairo.cairo</span></tt>, along with any other 48 154 parts of the library you need. For example, if you wanted the base cairo … … 66 172 look in the <tt class="docutils literal"><span class="pre">cairo_snippets</span></tt> directory.</p> 67 173 </div> 174 <div class="section" id="cairooo"> 175 <h2><a class="toc-backref" href="#id14" name="cairooo">cairooo</a></h2> 176 <p>To use the cairooo binding instead, import <tt class="docutils literal"><span class="pre">cairooo.all</span></tt>, along with any 177 other parts of the library that you need. To copy the above example, to 178 import the base and PNG functions:</p> 179 <pre class="literal-block"> 180 import cairooo.all; 181 import cairooo.png.all; 182 </pre> 183 <p>As with the raw binding, you need to tell the binding to load the cairo 184 library before you can use it. You can do that like so:</p> 185 <pre class="literal-block"> 186 Cairo.load(); 187 CairoPNG.load(); 188 </pre> 189 <p>Again, if anything fails to load, an exception will be thrown.</p> 190 <p>There are no huge, arbitrary differences between the flat C api and the 191 object-oriented one. The largest change is that anywhere you would pass a 192 handle, you instead pass an object. The naming translation is roughly:</p> 193 <pre class="literal-block"> 194 cairo_foo_bar_xxx_t* --> FooBarXXX 195 </pre> 196 <p>An exception to this is the cairo context, <tt class="docutils literal"><span class="pre">cairo_t*</span></tt>, which becomes 197 <tt class="docutils literal"><span class="pre">Context</span></tt>.</p> 198 <p>Also, the following differences should be kept in mind:</p> 199 <ul class="simple"> 200 <li>"lower_case_with_underscores" functions become "lowerCaseWithUnderscores".</li> 201 <li>"CAIRO_ENUM_TYPE_ENUM_NAME" becomes "EnumType.enumName".</li> 202 </ul> 203 <p>Finally, where there have been multiple ways of creating a certain kind of 204 object (such as a Surface or Pattern), creating them is split between using 205 constructors and static members. This will get resolved eventually, but for 206 the moment, which one to use is unclear.</p> 207 <p>The general rule is that if you want to convert:</p> 208 <pre class="literal-block"> 209 xxx = cairo_some_object_create_foo(arg1, arg2, ...); 210 </pre> 211 <p>You should try the following:</p> 212 <pre class="literal-block"> 213 xxx = new SomeObject(arg1, arg2, ...); 214 xxx = SomeObject.create(arg1, arg2, ...); 215 xxx = SomeObject.createFoo(arg1, arg2, ...); 216 </pre> 217 <p>For more concrete examples, see the <tt class="docutils literal"><span class="pre">cairooo_snippets</span></tt>, <tt class="docutils literal"><span class="pre">cairooo_tutorial</span></tt> 218 and <tt class="docutils literal"><span class="pre">demos</span></tt> directories.</p> 219 </div> 220 </div> 68 221 <div class="section" id="contributing"> 69 <h1><a name="contributing">Contributing</a></h1>70 <p>The cairo api has a lot offunctionality in it that this binding does not71 yet cover: X11, PDF, PS and more. However, the only binary version of cairo222 <h1><a class="toc-backref" href="#id15" name="contributing">Contributing</a></h1> 223 <p>The cairo api has a functionality in it that this binding does not 224 yet cover: PDF abd PS for example. However, the only binary version of cairo 72 225 I have access to is limited to what is currently covered, and I have thus 73 226 far had no success in compiling cairo myself.</p> … … 75 228 binding for some currently unsupported part of cairo. You can look at the 76 229 PNG binding for a simple example.</p> 230 <p>That, or you can write samples and demos to test the bindings that I can't. 231 In addition to being fun, you get to make pretty pictures in the process!</p> 77 232 </div> 78 233 <div class="section" id="thanks"> 79 <h1><a name="thanks">Thanks</a></h1>234 <h1><a class="toc-backref" href="#id16" name="thanks">Thanks</a></h1> 80 235 <ul class="simple"> 81 236 <li>Many thanks for the hard work by the people behind the cairo library.</li> … … 85 240 </div> 86 241 <div class="section" id="credits"> 87 <h1><a name="credits">Credits</a></h1>242 <h1><a class="toc-backref" href="#id17" name="credits">Credits</a></h1> 88 243 <p>cairo bindings for D Copyright © 2006 Daniel Keep. Portions Copyright © 89 244 2006 Michael Parker.</p> 90 245 <p>Released under the <a class="reference" href="http://www.opensource.org/licenses/bsd-license.php">BSD license</a>.</p> 91 246 <!-- Links --> 247 <!-- Footnotes --> 248 <table class="docutils footnote" frame="void" id="debuglibs" rules="none"> 249 <colgroup><col class="label" /><col /></colgroup> 250 <tbody valign="top"> 251 <tr><td class="label"><a class="fn-backref" href="#id1" name="debuglibs">[1]</a></td><td>The debug libraries will have "_debug" appended to their 252 filename, so you do not need to worry about overwriting your 253 release libraries.</td></tr> 254 </tbody> 255 </table> 92 256 </div> 93 257 </div> 94 258 <div class="footer"> 95 259 <hr class="footer" /> 96 Generated on: 2006-05- 04 14:08UTC.260 Generated on: 2006-05-19 02:45 UTC. 97 261 98 262 </div> trunk/cairo/README.rst
r97 r119 8 8 ====================== 9 9 10 .. contents:: 11 10 12 Introduction 11 13 ============ … … 13 15 This project's aim is to provide a complete, up-to-date D binding for the 14 16 cairo_ 2D drawing API. Currently, the binding supports the base cairo 15 functions, PNG functions, and Win32 functions. 17 functions and PNG functions. It also contains support for the Glitz, Win32 18 and Xlib backends, but these are largely untested. 19 20 This project also provides an object-oriented layer above the raw bindings 21 called ``cairooo`` which adds support for objects and exceptions, integrating 22 cairo more seamlessly with D style programming. In time, we hope to also 23 provide a library of additional, high-level functionality with this layer. 16 24 17 25 Installation 18 26 ============ 19 27 28 cairo binding 29 ------------- 30 20 31 To install, simply copy the ``cairo`` directory to a place in your D 21 compiler's import path. That's all there is to it. Currently, there is no 22 automated support for building an import library, although this is planned 23 for a future release (ie: when I get around to it). 32 compiler's import path. That's all there is to it. 33 34 If you really want to have import libraries to use, then you can build these 35 using the ``cairo-build.d`` script, which will place them in the ``lib`` 36 directory. It can be run using either:: 37 38 dmd -run cairo-build.d ARGS 39 40 Or, if that fails:: 41 42 build cairo-build.d 43 cairo-build ARGS 44 45 The command line arguments may be empty (signifying a default build), or 46 contain one or more targets to build. You may also use the ``--verbose`` 47 switch to get more verbose output, and the ``--debug`` switch to produce 48 libraries with debug symbols [#debuglibs]_. 49 50 Use the ``--help`` switch for full usage information. 51 52 cairooo binding 53 --------------- 54 55 To install the cairooo binding, simply copy both the ``cairo`` and ``cairooo`` 56 directories to a place on your D compiler's import path. 57 58 If you want to build import libraries, then you can use the 59 ``cairooo-build.d`` script, which will build them to the ``lib`` directory. 60 Usage is mostly the same as using ``cairo-build.d`` (see above). 61 62 cairo snippets 63 -------------- 64 65 The ``cairo_snippets`` and ``cairooo_snippets`` directories contain the 66 "snippets" example programs provided by the cairo developers ported to D. 67 They use the ``cairo`` and ``cairooo`` bindings respectively. 68 69 These do not have a "proper" build script like the binding itself: they are 70 generally built with either a Windows batch file or shell script. However, if 71 you wish to build them manually, the command to do so usually looks like 72 this:: 73 74 build -cleanup -release -inline -I.. NAME_OF_SNIPPET 75 76 Just be sure to create the ``output`` directory if it does not exist first. 77 78 cairooo tutorial 79 ---------------- 80 81 The ``cairooo_tutorial`` contains the beginnings of a very simple introductory 82 tutorial to programming image programs in D using the cairooo binding. It is 83 pathetically incomplete; however, it may be a useful starting point. 84 85 demos 86 ----- 87 88 The ``demos`` directory will contain a few small demo programs to showcase the 89 binding. Currently, it only has one demo, so the plural is prehaps 90 misleading. Hopefully this will change :) 91 92 documentation 93 ------------- 94 95 Whilst this project hopes to eventually have full DDoc documentation for the 96 cairooo binding, we will not be providing anything other than minimal 97 documentation for the raw cairo API binding. The rationale is that since the 98 original C api and the raw D api are for the most part identical, there is no 99 need to duplicate the existing C documentation. 100 101 That said, the cairooo documentation itself is woefully lacking. What does 102 exist can be built using the following command:: 103 104 build @build_docs_cairooo.brf 105 106 Please note that you will need to create the following directory structure 107 *first* if it does not yet exist:: 108 109 docs\ 110 cairooo\ 111 extra\ 112 glitz\ 113 png\ 114 win32\ 115 xlib\ 24 116 25 117 cairo for Windows … … 47 139 ===== 48 140 141 cairo 142 ----- 143 49 144 To use the binding, simply import ``cairo.cairo``, along with any other 50 145 parts of the library you need. For example, if you wanted the base cairo … … 69 164 look in the ``cairo_snippets`` directory. 70 165 166 cairooo 167 ------- 168 169 To use the cairooo binding instead, import ``cairooo.all``, along with any 170 other parts of the library that you need. To copy the above example, to 171 import the base and PNG functions:: 172 173 import cairooo.all; 174 import cairooo.png.all; 175 176 As with the raw binding, you need to tell the binding to load the cairo 177 library before you can use it. You can do that like so:: 178 179 Cairo.load(); 180 CairoPNG.load(); 181 182 Again, if anything fails to load, an exception will be thrown. 183 184 There are no huge, arbitrary differences between the flat C api and the 185 object-oriented one. The largest change is that anywhere you would pass a 186 handle, you instead pass an object. The naming translation is roughly:: 187 188 cairo_foo_bar_xxx_t* --> FooBarXXX 189 190 An exception to this is the cairo context, ``cairo_t*``, which becomes 191 ``Context``. 192 193 Also, the following differences should be kept in mind: 194 195 * "lower_case_with_underscores" functions become "lowerCaseWithUnderscores". 196 * "CAIRO_ENUM_TYPE_ENUM_NAME" becomes "EnumType.enumName". 197 198 Finally, where there have been multiple ways of creating a certain kind of 199 object (such as a Surface or Pattern), creating them is split between using 200 constructors and static members. This will get resolved eventually, but for 201 the moment, which one to use is unclear. 202 203 The general rule is that if you want to convert:: 204 205 xxx = cairo_some_object_create_foo(arg1, arg2, ...); 206 207 You should try the following:: 208 209 xxx = new SomeObject(arg1, arg2, ...); 210 xxx = SomeObject.create(arg1, arg2, ...); 211 xxx = SomeObject.createFoo(arg1, arg2, ...); 212 213 For more concrete examples, see the ``cairooo_snippets``, ``cairooo_tutorial`` 214 and ``demos`` directories. 215 71 216 Contributing 72 217 ============ 73 218 74 The cairo api has a lot offunctionality in it that this binding does not75 yet cover: X11, PDF, PS and more. However, the only binary version of cairo219 The cairo api has a functionality in it that this binding does not 220 yet cover: PDF abd PS for example. However, the only binary version of cairo 76 221 I have access to is limited to what is currently covered, and I have thus 77 222 far had no success in compiling cairo myself. … … 80 225 binding for some currently unsupported part of cairo. You can look at the 81 226 PNG binding for a simple example. 227 228 That, or you can write samples and demos to test the bindings that I can't. 229 In addition to being fun, you get to make pretty pictures in the process! 82 230 83 231 Thanks … … 104 252 .. _example snippets: http://cairographics.org/samples/ 105 253 254 .. Footnotes 255 256 .. [#debuglibs] The debug libraries will have "_debug" appended to their 257 filename, so you do not need to worry about overwriting your 258 release libraries. 259 260 trunk/cairo/cairo/cairo.d
r97 r119 2 2 * cairo bindings for D. 3 3 * 4 * Copyright: \© 2006 Daniel Keep 5 * License: BSD <http://www.opensource.org/licenses/bsd-license.php> 4 * Authors: Daniel Keep 5 * Copyright: 2006, Daniel Keep 6 * License: BSD v2 (http://www.opensource.org/licenses/bsd-license.php). 6 7 */ 7 8 /* 8 * Copyright (c)2006 Daniel Keep9 * Copyright © 2006 Daniel Keep 9 10 * All rights reserved. 10 11 * … … 62 63 cairo_load("libcairo-2.dll"); 63 64 else version(linux) 64 cairo_load("libcairo -2.so");65 cairo_load("libcairo.so"); 65 66 else 66 67 { trunk/cairo/cairo/cairofuncs.d
r98 r119 5 5 * This file is automatically generated; do not directly modify. 6 6 * 7 * Copyright: \© 2006 Daniel Keep 8 * License: BSD <http://www.opensource.org/licenses/bsd-license.php> 7 * Authors: Daniel Keep 8 * Copyright: 2006, Daniel Keep 9 * License: BSD v2 (http://www.opensource.org/licenses/bsd-license.php). 9 10 */ 10 11 /* 11 * Copyright (c)2006 Daniel Keep12 * Copyright © 2006 Daniel Keep 12 13 * All rights reserved. 13 14 * trunk/cairo/cairo/cairotypes.d
r98 r119 3 3 * by cairo. 4 4 * 5 * Copyright: \© 2006, Daniel Keep. 6 * License: BSD <http://www.opensource.org/licenses/bsd-license.php> 5 * Authors: Daniel Keep 6 * Copyright: 2006, Daniel Keep 7 * License: BSD v2 (http://www.opensource.org/licenses/bsd-license.php). 7 8 */ 8 9 /* 9 * Copyright (c)2006 Daniel Keep10 * Copyright © 2006 Daniel Keep 10 11 * All rights reserved. 11 12 * … … 87 88 } 88 89 89 alias cairo_status_t function(void* closure, char* data, uint length) cairo_write_func_t;90 91 alias cairo_status_t function(void* closure, char* data, uint length) cairo_read_func_t;90 alias cairo_status_t function(void* closure, ubyte* data, uint length) cairo_write_func_t; 91 92 alias cairo_status_t function(void* closure, ubyte* data, uint length) cairo_read_func_t; 92 93 93 94 enum cairo_operator_t trunk/cairo/cairo/loader.d
r97 r119 4 4 * the Derelict project's loader.d file. 5 5 * 6 * Copyright: \© 2005-2006, Derelict developers; 7 * \© 2006 Daniel Keep. 8 * License: BSD <http://www.opensource.org/licenses/bsd-license.php> 6 * Authors: Daniel Keep 7 * Copyright: 2005-2006, Derelict developers; 8 * 2006, Daniel Keep. 9 * License: BSD v2 (http://www.opensource.org/licenses/bsd-license.php). 9 10 */ 10 11 /* 11 * Copyright (c)2006 Daniel Keep12 * Copyright © 2006 Daniel Keep 12 13 * All rights reserved. 13 14 * … … 99 100 } 100 101 101 class SharedLibLoadException : Exception 102 class CairoLoaderException : Exception 103 { 104 this(char[] msg) 105 { 106 super(msg); 107 } 108 } 109 110 class SharedLibLoadException : CairoLoaderException 102 111 { 103 112 this(char[] libName) … … 108 117 } 109 118 110 class ProcNotFoundException : Exception119 class ProcNotFoundException : CairoLoaderException 111 120 { 112 121 this(SharedLib lib, char[] procName) … … 255 264 else version(linux) 256 265 { 266 version(build) 267 { 268 pragma(link, dl); 269 } 270 else 271 { 272 pragma(lib, "dl.a"); 273 } 274 257 275 private import std.c.linux.linux; 258 276 trunk/cairo/cairo/png/cairo_png.d
r97 r119 3 3 * cairo's PNG support. 4 4 * 5 * Copyright: \© 2006 Daniel Keep 6 * License: BSD <http://www.opensource.org/licenses/bsd-license.php> 5 * Authors: Daniel Keep 6 * Copyright: 2006, Daniel Keep 7 * License: BSD v2 (http://www.opensource.org/licenses/bsd-license.php). 7 8 */ 8 9 /* 9 * Copyright (c)2006 Daniel Keep10 * Copyright © 2006 Daniel Keep 10 11 * All rights reserved. 11 12 * trunk/cairo/cairo/png/cairofuncs_png.d
r97 r119 5 5 * This file is automatically generated; do not directly modify. 6 6 * 7 * Copyright: \© 2006 Daniel Keep 8 * License: BSD <http://www.opensource.org/licenses/bsd-license.php> 7 * Authors: Daniel Keep 8 * Copyright: 2006, Daniel Keep 9 * License: BSD v2 (http://www.opensource.org/licenses/bsd-license.php). 9 10 */ 10 11 /* 11 * Copyright (c)2006 Daniel Keep12 * Copyright © 2006 Daniel Keep 12 13 * All rights reserved. 13 14 * trunk/cairo/cairo/png/cairotypes_png.d
r97 r119 3 3 * Currently, it just imports cairo.cairotypes. 4 4 * 5 * Copyright: \© 2006 Daniel Keep 6 * License: BSD <http://www.opensource.org/licenses/bsd-license.php> 5 * Authors: Daniel Keep 6 * Copyright: 2006, Daniel Keep 7 * License: BSD v2 (http://www.opensource.org/licenses/bsd-license.php). 7 8 */ 8 9 /* 9 * Copyright (c)2006 Daniel Keep10 * Copyright © 2006 Daniel Keep 10 11 * All rights reserved. 11 12 * trunk/cairo/cairo/win32/cairo_win32.d
r97 r119 5 5 * 6 6 * Also, it requires the win32 bindings, which can be found 7 * at <http://www.dsource.org/projects/bindings/>.7 * at (http://www.dsource.org/projects/bindings/). 8 8 * 9 * Copyright: \© 2006 Daniel Keep 10 * License: BSD <http://www.opensource.org/licenses/bsd-license.php> 9 * Authors: Daniel Keep 10 * Copyright: 2006, Daniel Keep 11 * License: BSD v2 (http://www.opensource.org/licenses/bsd-license.php). 11 12 */ 12 13 /* 13 * Copyright (c)2006 Daniel Keep14 * Copyright © 2006 Daniel Keep 14 15 * All rights reserved. 15 16 * trunk/cairo/cairo/win32/cairofuncs_win32.d
r97 r119 5 5 * This file is automatically generated; do not directly modify. 6 6 * 7 * Copyright: \© 2006 Daniel Keep 8 * License: BSD <http://www.opensource.org/licenses/bsd-license.php> 7 * Authors: Daniel Keep 8 * Copyright: 2006, Daniel Keep 9 * License: BSD v2 (http://www.opensource.org/licenses/bsd-license.php). 9 10 */ 10 11 /* 11 * Copyright (c)2006 Daniel Keep12 * Copyright © 2006 Daniel Keep 12 13 * All rights reserved. 13 14 * trunk/cairo/cairo/win32/cairotypes_win32.d
r97 r119 5 5 * import :) 6 6 * 7 * Copyright: \© 2006 Daniel Keep 8 * License: BSD <http://www.opensource.org/licenses/bsd-license.php> 7 * Authors: Daniel Keep 8 * Copyright: 2006, Daniel Keep 9 * License: BSD v2 (http://www.opensource.org/licenses/bsd-license.php). 9 10 */ 10 11 /* 11 * Copyright (c)2006 Daniel Keep12 * Copyright © 2006 Daniel Keep 12 13 * All rights reserved. 13 14 * trunk/cairo/cairo_snippets/cairo_snippets_png.d
r97 r119 76 76 cairo_set_line_width(cr, LINE_WIDTH); 77 77 78 // Clear the background 79 cairo_rectangle(cr, 0, 0, 1, 1); 80 cairo_set_source_rgba(cr, 1, 1, 1, 0); 81 cairo_set_operator(cr, cairo_operator_t.CAIRO_OPERATOR_CLEAR); 82 cairo_fill(cr); 83 84 // Reset the context for the snippet 85 cairo_set_source_rgb(cr, 0, 0, 0); 86 cairo_set_operator(cr, cairo_operator_t.CAIRO_OPERATOR_OVER); 87 78 88 // Call the snippet. 79 89 cairo_save(cr); trunk/cairo/cairo_snippets/cairo_snippets_png_run.sh
r97 r119 1 # 1/usr/bin/bash1 #!/bin/bash 2 2 3 3 if [ ! -d output ]; then
