summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cvsignore11
-rw-r--r--AUTHORS9
-rw-r--r--COPYING504
-rw-r--r--ChangeLog0
-rw-r--r--INSTALL9
-rw-r--r--MAINTAINERS4
-rw-r--r--Makefile.am14
-rw-r--r--NEWS0
-rw-r--r--README13
-rwxr-xr-xautogen.sh46
-rw-r--r--cairomm-1.0.pc.in12
-rw-r--r--cairomm/.cvsignore2
-rw-r--r--cairomm/Makefile.am25
-rw-r--r--cairomm/cairomm.h25
-rw-r--r--cairomm/context.cc591
-rw-r--r--cairomm/context.h170
-rw-r--r--cairomm/enums.h17
-rw-r--r--cairomm/exception.cc21
-rw-r--r--cairomm/exception.h28
-rw-r--r--cairomm/fontface.cc70
-rw-r--r--cairomm/fontface.h62
-rw-r--r--cairomm/fontoptions.cc132
-rw-r--r--cairomm/fontoptions.h67
-rw-r--r--cairomm/path.cc78
-rw-r--r--cairomm/path.h48
-rw-r--r--cairomm/pattern.cc136
-rw-r--r--cairomm/pattern.h75
-rw-r--r--cairomm/private.cc8
-rw-r--r--cairomm/private.h29
-rw-r--r--cairomm/surface.cc155
-rw-r--r--cairomm/surface.h91
-rw-r--r--configure.in104
-rw-r--r--examples/.cvsignore2
-rw-r--r--examples/Makefile.am3
-rw-r--r--examples/Makefile.am_fragment5
-rw-r--r--examples/README23
36 files changed, 2589 insertions, 0 deletions
diff --git a/.cvsignore b/.cvsignore
new file mode 100644
index 0000000..2ab3200
--- /dev/null
+++ b/.cvsignore
@@ -0,0 +1,11 @@
+Makefile.in
+Makefile
+aclocal.m4
+autom4te.cache
+config.log
+config.status
+configure
+libtool
+libxml++-2.6.pc
+libxml++.spec
+
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..1067358
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,9 @@
+Please do not email us directly - use the mailing list.
+See http://libxmlplusplus.sourceforge.net
+
+Maintainers:
+----------
+Murray Cumming
+
+Based on code from Leonard Ritter.
+
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..b1e3f5a
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ChangeLog
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..b2d270b
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,9 @@
+Simple install procedure
+ ========================
+
+ % gzip -dc libxml++-<version>.tar.gz | tar xvf - # unpack the sources
+ % cd libxml++-<version> # change to toplevel directory
+ % ./configure # run the `configure' script
+ % make # build libxml++
+ % make install # install libxml++
+
diff --git a/MAINTAINERS b/MAINTAINERS
new file mode 100644
index 0000000..cd73f09
--- /dev/null
+++ b/MAINTAINERS
@@ -0,0 +1,4 @@
+Please use the mailing list rather than emailing developers directly.
+
+Murray Cumming
+Email: murrayc@murrayc.com
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..bda689e
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,14 @@
+## Process this file with automake to produce Makefile.in
+
+SUBDIRS = cairomm examples
+#docs examples
+
+EXTRA_DIST = cairomm-1.0.pc.in
+
+DIST_SUBDIRS = $(SUBDIRS)
+
+# Install the pkg-config file:
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = cairomm-1.0.pc
+
+
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/NEWS
diff --git a/README b/README
new file mode 100644
index 0000000..708d5b3
--- /dev/null
+++ b/README
@@ -0,0 +1,13 @@
+libxml++
+-------------
+
+This library provides a C++ interface to cairo.
+
+Read the file 'INSTALL' for instructions to compile and install the library.
+
+See the examples directory for example code.
+
+Use pkg-config to discover the necessary include and linker arguments. For instance,
+ pkg-config cairomm-1.0 --cflags --libs
+Ideally you would use PKG_CHECK_MODULES in your configure.ac file.
+See http://www.openismus.com for generic help with that.
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..58f0403
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,46 @@
+#! /bin/sh
+
+# $Id: autogen.sh,v 1.1 2005-12-02 13:34:41 murrayc Exp $
+#
+# Copyright (c) 2002 Daniel Elstner <daniel.elstner@gmx.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License VERSION 2 as
+# published by the Free Software Foundation. You are not allowed to
+# use any other version of the license; unless you got the explicit
+# permission from the author to do so.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+dir=`echo "$0" | sed 's,[^/]*$,,'`
+test "x${dir}" = "x" && dir='.'
+
+if test "x`cd "${dir}" 2>/dev/null && pwd`" != "x`pwd`"
+then
+ echo "This script must be executed directly from the source directory."
+ exit 1
+fi
+
+rm -f config.cache acconfig.h
+
+echo "- aclocal." && \
+aclocal && \
+echo "- libtoolize." && \
+libtoolize --force && \
+echo "- autoconf." && \
+autoconf && \
+echo "- automake." && \
+automake --add-missing --gnu && \
+echo && \
+./configure "$@" && exit 0
+
+exit 1
+
diff --git a/cairomm-1.0.pc.in b/cairomm-1.0.pc.in
new file mode 100644
index 0000000..c283225
--- /dev/null
+++ b/cairomm-1.0.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: cairomm
+Description: C++ wrapper for cairo
+Requires: cairo
+Version: @VERSION@
+Libs: -L${libdir} -lcairomm-1.0
+Cflags: -I${includedir}/cairomm-1.0
+
diff --git a/cairomm/.cvsignore b/cairomm/.cvsignore
new file mode 100644
index 0000000..3dda729
--- /dev/null
+++ b/cairomm/.cvsignore
@@ -0,0 +1,2 @@
+Makefile.in
+Makefile
diff --git a/cairomm/Makefile.am b/cairomm/Makefile.am
new file mode 100644
index 0000000..a0fe3ea
--- /dev/null
+++ b/cairomm/Makefile.am
@@ -0,0 +1,25 @@
+SUBDIRS =
+
+INCLUDES = -I$(top_srcdir) @CAIROMM_CFLAGS@
+
+h_sources_public = cairomm.h context.h enums.h fontface.h fontoptions.h path.h pattern.h surface.h exception.h
+h_sources_private = private.h
+cc_sources = context.cc fontface.cc fontoptions.cc path.cc pattern.cc surface.cc exception.cc
+cc_sources_private = private.cc
+
+# Support for DLL on cygwin/mingw using libtool > 1.4
+if PLATFORM_WIN32
+win32_dlls_ldflags = -no-undefined -Wl,--export-all-symbols
+else
+win32_dlls_ldflags =
+endif
+
+lib_LTLIBRARIES = libcairomm-1.0.la
+libcairomm_1_0_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) $(win32_dlls_ldflags)
+libcairomm_1_0_la_LIBADD = @CAIROMM_LIBS@
+libcairomm_1_0_la_SOURCES = $(cc_sources) $(h_sources_public) $(h_sources_private) $(cc_sources_private)
+
+# Install the headers:
+library_includedir=$(includedir)/cairomm-1.0/cairomm
+library_include_HEADERS = $(h_sources_public)
+
diff --git a/cairomm/cairomm.h b/cairomm/cairomm.h
new file mode 100644
index 0000000..5973c92
--- /dev/null
+++ b/cairomm/cairomm.h
@@ -0,0 +1,25 @@
+/* node.h
+ * libxml++ and this file are copyright (C) 2000 by Ari Johnson, and
+ * are covered by the GNU Lesser General Public License, which should be
+ * included with libxml++ as the file COPYING.
+ */
+
+#ifndef __LIBXMLCPP_H
+#define __LIBXMLCPP_H
+
+#include <libxml++/exceptions/internal_error.h>
+#include <libxml++/exceptions/parse_error.h>
+#include <libxml++/parsers/domparser.h>
+#include <libxml++/parsers/saxparser.h>
+#include <libxml++/parsers/textreader.h>
+#include <libxml++/nodes/node.h>
+#include <libxml++/nodes/commentnode.h>
+#include <libxml++/nodes/element.h>
+#include <libxml++/nodes/entityreference.h>
+#include <libxml++/nodes/textnode.h>
+#include <libxml++/attribute.h>
+#include <libxml++/document.h>
+#include <libxml++/validators/validator.h>
+#include <libxml++/validators/dtdvalidator.h>
+
+#endif //__LIBXMLCPP_H
diff --git a/cairomm/context.cc b/cairomm/context.cc
new file mode 100644
index 0000000..1d99a12
--- /dev/null
+++ b/cairomm/context.cc
@@ -0,0 +1,591 @@
+#include <cairomm/context.h>
+#include <cairomm/private.h>
+
+namespace Cairo
+{
+
+Context::Context(Surface& target)
+: m_cobject(0)
+{
+ m_cobject = cairo_create(target.cobj());
+}
+
+Context::Context(cairo_t* cobject, bool has_reference)
+: m_cobject(0)
+{
+ if(has_reference)
+ m_cobject = cobject;
+ else
+ m_cobject = cairo_reference(cobject);
+}
+
+Context::Context(const Context& src)
+{
+ //Reference-counting, instead of copying by value:
+ if(!src.m_cobject)
+ m_cobject = 0;
+ else
+ m_cobject = cairo_reference(src.m_cobject);
+}
+
+Context::~Context()
+{
+ if(m_cobject)
+ cairo_destroy(m_cobject);
+}
+
+
+Context& Context::operator=(const Context& src)
+{
+ //Reference-counting, instead of copying by value:
+
+ if(this == &src)
+ return *this;
+
+ if(m_cobject == src.m_cobject)
+ return *this;
+
+ if(m_cobject)
+ {
+ cairo_destroy(m_cobject);
+ m_cobject = 0;
+ }
+
+ if(!src.m_cobject)
+ return *this;
+
+ m_cobject = cairo_reference(src.m_cobject);
+
+ return *this;
+}
+
+
+void Context::save()
+{
+ cairo_save(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::restore()
+{
+ cairo_restore(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_operator(Operator op)
+{
+ cairo_set_operator(m_cobject, (cairo_operator_t)op);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_source(const Pattern& source)
+{
+ cairo_set_source(m_cobject, const_cast<cairo_pattern_t*>(source.cobj()));
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_source_rgb(double red, double green, double blue)
+{
+ cairo_set_source_rgb(m_cobject, red, green, blue);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_source_rgba(double red, double green, double blue,
+double alpha)
+{
+ cairo_set_source_rgba(m_cobject, red, green, blue, alpha);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_source_surface(Surface& surface, double x, double y)
+{
+ cairo_set_source_surface(m_cobject, surface.cobj(), x, y);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_tolerance(double tolerance)
+{
+ cairo_set_tolerance(m_cobject, tolerance);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_antialias(Antialias antialias)
+{
+ cairo_set_antialias(m_cobject, (cairo_antialias_t)antialias);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_fill_rule(FillRule fill_rule)
+{
+ cairo_set_fill_rule(m_cobject, (cairo_fill_rule_t)fill_rule);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_line_width(double width)
+{
+ cairo_set_line_width(m_cobject, width);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_line_cap(LineCap line_cap)
+{
+ cairo_set_line_cap(m_cobject, (cairo_line_cap_t)line_cap);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_line_join(LineJoin line_join)
+{
+ cairo_set_line_join(m_cobject, (cairo_line_join_t)line_join);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_dash(std::valarray<double>& dashes, double offset)
+{
+ cairo_set_dash(m_cobject, &dashes[0], dashes.size(), offset);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_dash()
+{
+ cairo_set_dash(m_cobject, 0, 0, 0);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_miter_limit(double limit)
+{
+ cairo_set_miter_limit(m_cobject, limit);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::translate(double tx, double ty)
+{
+ cairo_translate(m_cobject, tx, ty);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::scale(double sx, double sy)
+{
+ cairo_scale(m_cobject, sx, sy);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::rotate(double angle)
+{
+ cairo_rotate(m_cobject, angle);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::rotate_deg(double angle)
+{
+ cairo_rotate(m_cobject, angle*M_PI/180.0);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::transform(const cairo_matrix_t& matrix)
+{
+ cairo_transform(m_cobject, &matrix);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_matrix(const cairo_matrix_t& matrix)
+{
+ cairo_set_matrix(m_cobject, &matrix);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::identity_matrix()
+{
+ cairo_identity_matrix(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::user_to_device(double& x, double& y)
+{
+ cairo_user_to_device(m_cobject, &x, &y);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::user_to_device_distance(double& dx, double& dy)
+{
+ cairo_user_to_device_distance(m_cobject, &dx, &dy);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::device_to_user(double& x, double& y)
+{
+ cairo_device_to_user(m_cobject, &x, &y);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::device_to_user_distance(double& dx, double& dy)
+{
+ cairo_device_to_user_distance(m_cobject, &dx, &dy);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::new_path()
+{
+ cairo_new_path(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::move_to(double x, double y)
+{
+ cairo_move_to(m_cobject, x, y);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::line_to(double x, double y)
+{
+ cairo_line_to(m_cobject, x, y);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::curve_to(double x1, double y1, double x2, double y2, double x3, double y3)
+{
+ cairo_curve_to(m_cobject, x1, y1, x2, y2, x3, y3);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::arc(double xc, double yc, double radius, double angle1, double angle2)
+{
+ cairo_arc(m_cobject, xc, yc, radius, angle1, angle2);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::arc_negative(double xc, double yc, double radius, double angle1, double angle2)
+{
+ cairo_arc_negative(m_cobject, xc, yc, radius, angle1, angle2);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::rel_move_to(double dx, double dy)
+{
+ cairo_rel_move_to(m_cobject, dx, dy);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::rel_line_to(double dx, double dy)
+{
+ cairo_rel_line_to(m_cobject, dx, dy);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::rel_curve_to(double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
+{
+ cairo_rel_curve_to(m_cobject, dx1, dy1, dx2, dy2, dx3, dy3);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::rectangle(double x, double y, double width, double height)
+{
+ cairo_rectangle(m_cobject, x, y, width, height);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::close_path()
+{
+ cairo_close_path(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::paint()
+{
+ cairo_paint(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::paint_with_alpha(double alpha)
+{
+ cairo_paint_with_alpha(m_cobject, alpha);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::mask(Pattern& pattern)
+{
+ cairo_mask(m_cobject, pattern.cobj());
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::mask_surface(Surface& surface, double surface_x, double surface_y)
+{
+ cairo_mask_surface(m_cobject, surface.cobj(), surface_x, surface_y);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::stroke()
+{
+ cairo_stroke(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::stroke_preserve()
+{
+ cairo_stroke_preserve(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::fill()
+{
+ cairo_fill(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::fill_preserve()
+{
+ cairo_fill_preserve(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::copy_page()
+{
+ cairo_copy_page(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::show_page()
+{
+ cairo_show_page(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+bool Context::in_stroke(double x, double y) const
+{
+ const bool result = cairo_in_stroke(m_cobject, x, y);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+bool Context::in_fill(double x, double y) const
+{
+ const bool result = cairo_in_fill(m_cobject, x, y);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+void Context::stroke_extents(double& x1, double& y1, double& x2, double& y2) const
+{
+ cairo_stroke_extents(m_cobject, &x1, &y1, &x2, &y2);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::fill_extents(double& x1, double& y1, double& x2, double& y2) const
+{
+ cairo_fill_extents(m_cobject, &x1, &y1, &x2, &y2);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::reset_clip()
+{
+ cairo_reset_clip(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::clip()
+{
+ cairo_clip(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::clip_preserve()
+{
+ cairo_clip_preserve(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::select_font_face (const std::string& family, FontSlant slant, FontWeight weight)
+{
+ cairo_select_font_face (m_cobject, family.c_str(), (cairo_font_slant_t)slant, (cairo_font_weight_t)weight);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_font_size(double size)
+{
+ cairo_set_font_size(m_cobject, size);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_font_matrix(const cairo_matrix_t &matrix)
+{
+ cairo_set_font_matrix(m_cobject, &matrix);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::get_font_matrix(cairo_matrix_t &matrix) const
+{
+ cairo_get_font_matrix(m_cobject, &matrix);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_font_options(const FontOptions& options)
+{
+ cairo_set_font_options(m_cobject, options.cobj());
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::show_text(const std::string& utf8)
+{
+ cairo_show_text(m_cobject, utf8.c_str());
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::show_glyphs(const std::vector<Glyph>& glyphs)
+{
+ cairo_show_glyphs(m_cobject, const_cast<cairo_glyph_t*>(&glyphs[0]), glyphs.size());
+ check_object_status_and_throw_exception(*this);
+}
+
+FontFace Context::get_font_face() const
+{
+ cairo_font_face_t* cfontface = cairo_get_font_face(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return FontFace(cfontface, false /* does not have reference */);
+}
+
+void Context::font_extents(FontExtents& extents)
+{
+ cairo_font_extents(m_cobject, &extents);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_font_face(const FontFace& font_face)
+{
+ cairo_set_font_face(m_cobject, const_cast<cairo_font_face_t*>(font_face.cobj()));
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::text_extents(const std::string& utf8, TextExtents& extents)
+{
+ cairo_text_extents(m_cobject, utf8.c_str(), &extents);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::glyph_extents(const std::vector<Glyph>& glyphs, TextExtents& extents) const
+{
+ cairo_glyph_extents(m_cobject, const_cast<cairo_glyph_t*>(&glyphs[0]), glyphs.size(), &extents);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::text_path(const std::string& utf8)
+{
+ cairo_text_path(m_cobject, utf8.c_str());
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::glyph_path(const std::vector<Glyph>& glyphs)
+{
+ cairo_glyph_path(m_cobject, const_cast<cairo_glyph_t*>(&glyphs[0]), glyphs.size());
+ check_object_status_and_throw_exception(*this);
+}
+
+Operator Context::get_operator() const
+{
+ const Operator result = cairo_get_operator(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+Pattern Context::get_source() const
+{
+ cairo_pattern_t* pattern = cairo_get_source(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return Pattern(pattern, false /* does not have reference */);
+}
+
+double Context::get_tolerance() const
+{
+ const double result = cairo_get_tolerance(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+Antialias Context::get_antialias() const
+{
+ const Antialias result = cairo_get_antialias(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+void Context::get_current_point(double& x, double& y) const
+{
+ cairo_get_current_point(m_cobject, &x, &y);
+ check_object_status_and_throw_exception(*this);
+}
+
+FillRule Context::get_fill_rule() const
+{
+ const FillRule result = cairo_get_fill_rule(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+double Context::get_line_width() const
+{
+ const double result = cairo_get_line_width(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+LineCap Context::get_line_cap() const
+{
+ const LineCap result = cairo_get_line_cap(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+LineJoin Context::get_line_join() const
+{
+ const LineJoin result = cairo_get_line_join(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+double Context::get_miter_limit() const
+{
+ const double result = cairo_get_miter_limit(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+void Context::get_matrix(cairo_matrix_t &matrix)
+{
+ cairo_get_matrix(m_cobject, &matrix);
+ check_object_status_and_throw_exception(*this);
+}
+
+Surface Context::get_target()
+{
+ cairo_surface_t* surface = cairo_get_target(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return Surface(surface, false /* does not have reference */);
+}
+
+const Surface Context::get_target() const
+{
+ cairo_surface_t* surface = cairo_get_target(const_cast<cairo_t*>(m_cobject));
+ check_object_status_and_throw_exception(*this);
+ return Surface(surface, false /* does not have reference */);
+}
+
+Path* Context::copy_path() const
+{
+ cairo_path_t* cresult = cairo_copy_path(const_cast<cairo_t*>(m_cobject));
+ check_object_status_and_throw_exception(*this);
+ return new Path(cresult, true /* take ownership */); //The caller must delete it.
+}
+
+Path* Context::copy_path_flat() const
+{
+ cairo_path_t* cresult = cairo_copy_path_flat(const_cast<cairo_t*>(m_cobject));
+ check_object_status_and_throw_exception(*this);
+ return new Path(cresult, true /* take ownership */); //The caller must delete it.
+}
+
+//TODO: Should this be const? Does cairo_append_path() take ownership?
+void Context::append_path(const Path& path)
+{
+ cairo_append_path(m_cobject, const_cast<cairo_path_t*>(path.cobj()));
+ check_object_status_and_throw_exception(*this);
+}
+
+} //namespace Cairo
diff --git a/cairomm/context.h b/cairomm/context.h
new file mode 100644
index 0000000..417b629
--- /dev/null
+++ b/cairomm/context.h
@@ -0,0 +1,170 @@
+#ifndef __CAIROMM_CONTEXT_H
+#define __CAIROMM_CONTEXT_H
+
+#include <cairomm/surface.h>
+#include <cairomm/fontface.h>
+#include <cairomm/pattern.h>
+#include <cairomm/path.h>
+#include <valarray>
+#include <vector>
+#include <cairo.h>
+
+
+namespace Cairo
+{
+
+typedef cairo_operator_t Operator;
+typedef cairo_fill_rule_t FillRule;
+typedef cairo_line_cap_t LineCap;
+typedef cairo_line_join_t LineJoin;
+typedef cairo_font_slant_t FontSlant;
+typedef cairo_font_weight_t FontWeight;
+
+typedef cairo_glyph_t Glyph; //A simple struct.
+typedef cairo_font_extents_t FontExtents; //A simple struct.
+typedef cairo_text_extents_t TextExtents; //A simple struct.
+
+/** The context is the main object used when drawing with cairo. To draw with cairo, you create a context,
+ * set the target surface, and drawing options for the context, create shapes with methods like move_to() and
+ * line_to(), and then draw shapes with stroke() or fill().
+ *
+ * This is a reference-counted object. The copy constructor creates a second reference to the object, instead of creating an independent copy of the object.
+ *
+ * Contexts can be pushed to a stack via save(). They may then safely be changed, without losing the current
+ * state. Use restore() to restore to the saved state.
+ */
+class Context
+{
+public:
+ Context();
+ explicit Context(Surface& src);
+
+ /** Create a C++ wrapper for the C instance.
+ * @param cobject The C instance.
+ * @param has_reference Whether we already have a reference. Otherwise, the constructor will take an extra reference.
+ */
+ explicit Context(cairo_t* cobject, bool has_reference = false);
+
+ /** Create a second reference to the context.
+ * Changing this instance will change the original instance.
+ */
+ Context(const Context& src);
+
+ //TODO?: Context(cairo_surface_t *target);
+ virtual ~Context();
+
+ /** Create a second reference to the context.
+ * Changing this instance will change the original instance.
+ */
+ Context& operator=(const Context& src);
+
+ void save();
+ void restore();
+ void set_operator(Operator op);
+ void set_source(const Pattern& source);
+ void set_source_rgb(double red, double green, double blue);
+ void set_source_rgba(double red, double green, double blue, double alpha);
+ void set_source_surface(Surface& surface, double x, double y);
+ void set_tolerance(double tolerance);
+ void set_antialias(Antialias antialias);
+ void set_fill_rule(FillRule fill_rule);
+ void set_line_width(double width);
+ void set_line_cap(LineCap line_cap);
+ void set_line_join(LineJoin line_join);
+ void set_dash(std::valarray<double>& dashes, double offset);
+ void set_dash();
+ void set_miter_limit(double limit);
+ void translate(double tx, double ty);
+ void scale(double sx, double sy);
+ void rotate(double angle);
+ void rotate_deg(double angle);
+ void transform(const cairo_matrix_t &matrix);
+ void set_matrix(const cairo_matrix_t &matrix);
+ void identity_matrix();
+ void user_to_device(double& x, double& y);
+ void user_to_device_distance(double& dx, double& dy);
+ void device_to_user(double& x, double& y);
+ void device_to_user_distance(double& dx, double& dy);
+ void new_path();
+ void move_to(double x, double y);
+ void line_to(double x, double y);
+ void curve_to(double x1, double y1, double x2, double y2, double x3, double y3);
+ void arc(double xc, double yc, double radius, double angle1, double angle2);
+ void arc_negative(double xc, double yc, double radius, double angle1, double angle2);
+ void rel_move_to(double dx, double dy);
+ void rel_line_to(double dx, double dy);
+ void rel_curve_to(double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
+ void rectangle(double x, double y, double width, double height);
+ void close_path();
+ void paint();
+ void paint_with_alpha(double alpha);
+ void mask(Pattern& pattern); //Should the source be const?
+ void mask_surface(Surface& surface, double surface_x, double surface_y); //TODO: Should the source be const?
+ void stroke();
+ void stroke_preserve();
+ void fill();
+ void fill_preserve();
+ void copy_page();
+ void show_page();
+ bool in_stroke(double x, double y) const;
+ bool in_fill(double x, double y) const;
+ void stroke_extents(double& x1, double& y1, double& x2, double& y2) const;
+ void fill_extents(double& x1, double& y1, double& x2, double& y2) const;
+ void reset_clip();
+ void clip();
+ void clip_preserve();
+ void select_font_face (const std::string& family, FontSlant slant, FontWeight weight);
+ void set_font_size(double size);
+ void set_font_matrix(const cairo_matrix_t &matrix);
+ void get_font_matrix(cairo_matrix_t &matrix) const;
+ void set_font_options(const FontOptions& options);
+ void show_text(const std::string& utf8);
+ void show_glyphs(const std::vector<Glyph>& glyphs);
+ FontFace get_font_face() const;
+ void font_extents(FontExtents& extents);
+ void set_font_face(const FontFace& font_face);
+ void text_extents(const std::string& utf8, TextExtents& extents);
+ void glyph_extents(const std::vector<Glyph>& glyphs, TextExtents& extents) const;
+ void text_path(const std::string& utf8);
+ void glyph_path(const std::vector<Glyph>& glyphs); //TODO: Is this an output parameter?
+ Operator get_operator() const;
+ Pattern get_source() const;
+ double get_tolerance() const;
+ Antialias get_antialias() const;
+ void get_current_point (double& x, double& y) const;
+ FillRule get_fill_rule() const;
+ double get_line_width() const;
+ LineCap get_line_cap() const;
+ LineJoin get_line_join() const;
+
+ double get_miter_limit() const;
+ void get_matrix(cairo_matrix_t &matrix);
+
+ Surface get_target();
+ const Surface get_target() const;
+
+ Path* copy_path() const;
+ Path* copy_path_flat() const;
+
+ void append_path(const Path& path);
+
+ typedef cairo_t cobject;
+ inline cobject* cobj() { return m_cobject; }
+ inline const cobject* cobj() const { return m_cobject; }
+
+ #ifndef DOXYGEN_IGNORE_THIS
+ ///For use only by the cairomm implementation.
+ inline Status get_status() const
+ { return cairo_status(const_cast<cairo_t*>(cobj())); }
+ #endif //DOXYGEN_IGNORE_THIS
+
+protected:
+
+
+ cobject* m_cobject;
+};
+
+} // namespace Cairo
+
+#endif //__CAIROMM_CONTEXT_H
+
diff --git a/cairomm/enums.h b/cairomm/enums.h
new file mode 100644
index 0000000..7501f24
--- /dev/null
+++ b/cairomm/enums.h
@@ -0,0 +1,17 @@
+#ifndef __CAIROMM_ENUMS_H
+#define __CAIROMM_ENUMS_H
+
+#include <cairo.h>
+
+namespace Cairo
+{
+
+#ifndef DOXYGEN_IGNORE_THIS
+//This is only used internally, but it must be in a public header because we inline some methods.
+typedef cairo_status_t Status;
+#endif //DOXYGEN_IGNORE_THIS
+
+} // namespace Cairo
+
+#endif //__CAIROMM_ENUMS_H
+
diff --git a/cairomm/exception.cc b/cairomm/exception.cc
new file mode 100644
index 0000000..8c1bce7
--- /dev/null
+++ b/cairomm/exception.cc
@@ -0,0 +1,21 @@
+#include <cairomm/exception.h>
+
+namespace Cairo
+{
+
+exception::exception(Status status)
+: m_status(status)
+{
+}
+
+exception::~exception() throw()
+{}
+
+const char* exception::what() const throw()
+{
+ //Hopefully this is a const char* to a static string.
+ return cairo_status_to_string((cairo_status_t)m_status);
+}
+
+} //namespace xmlpp
+
diff --git a/cairomm/exception.h b/cairomm/exception.h
new file mode 100644
index 0000000..04372f0
--- /dev/null
+++ b/cairomm/exception.h
@@ -0,0 +1,28 @@
+#ifndef __CAIRO_EXCEPTION_H
+#define __CAIRO_EXCEPTION_H
+
+#include <cairomm/enums.h>
+#include <exception>
+
+namespace Cairo
+{
+
+typedef cairo_status_t Status;
+
+/** Base class for all cairo exceptions.
+ */
+class exception: public std::exception
+{
+public:
+ explicit exception(Status status);
+ virtual ~exception() throw();
+
+ virtual const char* what() const throw();
+
+private:
+ Status m_status;
+};
+
+} // namespace xmlpp
+
+#endif // __CAIRO_EXCEPTION_H
diff --git a/cairomm/fontface.cc b/cairomm/fontface.cc
new file mode 100644
index 0000000..3b4768c
--- /dev/null
+++ b/cairomm/fontface.cc
@@ -0,0 +1,70 @@
+#include <cairomm/fontface.h>
+#include <cairomm/private.h>
+
+namespace Cairo
+{
+
+FontFace::FontFace(cairo_font_face_t* cobject, bool has_reference)
+: m_cobject(0)
+{
+ if(has_reference)
+ m_cobject = cobject;
+ else
+ m_cobject = cairo_font_face_reference(cobject);
+}
+
+FontFace::FontFace(const FontFace& src)
+{
+ //Reference-counting, instead of copying by value:
+ if(!src.m_cobject)
+ m_cobject = 0;
+ else
+ m_cobject = cairo_font_face_reference(src.m_cobject);
+}
+
+FontFace::~FontFace()
+{
+ if(m_cobject)
+ cairo_font_face_destroy(m_cobject);
+}
+
+
+FontFace& FontFace::operator=(const FontFace& src)
+{
+ //Reference-counting, instead of copying by value:
+
+ if(this == &src)
+ return *this;
+
+ if(m_cobject == src.m_cobject)
+ return *this;
+
+ if(m_cobject)
+ {
+ cairo_font_face_destroy(m_cobject);
+ m_cobject = 0;
+ }
+
+ if(!src.m_cobject)
+ return *this;
+
+ m_cobject = cairo_font_face_reference(src.m_cobject);
+
+ return *this;
+}
+
+void* FontFace::get_user_data(const cairo_user_data_key_t *key)
+{
+ void* result = cairo_font_face_get_user_data(m_cobject, key);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+void FontFace::set_user_data(const cairo_user_data_key_t* key, void *user_data, cairo_destroy_func_t destroy)
+{
+ const Status status = (Status)cairo_font_face_set_user_data(m_cobject, key, user_data, destroy);
+ check_status_and_throw_exception(status);
+}
+
+
+} //namespace Cairo
diff --git a/cairomm/fontface.h b/cairomm/fontface.h
new file mode 100644
index 0000000..a34e292
--- /dev/null
+++ b/cairomm/fontface.h
@@ -0,0 +1,62 @@
+#ifndef __CAIROMM_FONTFACE_H
+#define __CAIROMM_FONTFACE_H
+
+#include <cairomm/enums.h>
+#include <cairo/cairo.h>
+
+
+namespace Cairo
+{
+
+/**
+ * This is a reference-counted object. The copy constructor creates a second reference to the object, instead
+ * of creating an independent copy of the object.
+ */
+class FontFace
+{
+public:
+ FontFace();
+
+ /** Create a C++ wrapper for the C instance.
+ * @param cobject The C instance.
+ * @param has_reference Whether we already have a reference. Otherwise, the constructor will take an extra reference.
+ */
+ explicit FontFace(cairo_font_face_t* cobject, bool has_reference = false);
+
+ /** Create a second reference to the FontFace.
+ * Changing this instance will change the original instance.
+ */
+ FontFace(const FontFace& src);
+
+ //TODO?: FontFace(cairo_font_face_t *target);
+ virtual ~FontFace();
+
+ /** Create a second reference to the FontFace.
+ * Changing this instance will change the original instance.
+ */
+ FontFace& operator=(const FontFace& src);
+
+ void *get_user_data(const cairo_user_data_key_t *key);
+
+ void set_user_data(const cairo_user_data_key_t *key, void *user_data, cairo_destroy_func_t destroy); //TODO: Use a sigc::slot?
+
+
+ typedef cairo_font_face_t cobject;
+ inline cobject* cobj() { return m_cobject; }
+ inline const cobject* cobj() const { return m_cobject; }
+
+ #ifndef DOXYGEN_IGNORE_THIS
+ ///For use only by the cairomm implementation.
+ inline Status get_status() const
+ { return cairo_font_face_status(const_cast<cairo_font_face_t*>(cobj())); }
+ #endif //DOXYGEN_IGNORE_THIS
+
+protected:
+
+ cobject* m_cobject;
+};
+
+} // namespace Cairo
+
+#endif //__CAIROMM_FONTFACE_H
+
diff --git a/cairomm/fontoptions.cc b/cairomm/fontoptions.cc
new file mode 100644
index 0000000..bbc29f6
--- /dev/null
+++ b/cairomm/fontoptions.cc
@@ -0,0 +1,132 @@
+#include <cairomm/fontoptions.h>
+#include <cairomm/private.h>
+
+namespace Cairo
+{
+
+FontOptions::FontOptions()
+: m_cobject(0)
+{
+ m_cobject = cairo_font_options_create();
+}
+
+FontOptions::FontOptions(cairo_font_options_t* cobject, bool take_ownership)
+: m_cobject(0)
+{
+ if(take_ownership)
+ m_cobject = cobject;
+ else
+ m_cobject = cairo_font_options_copy(cobject);
+}
+
+FontOptions::FontOptions(const FontOptions& src)
+{
+ //Reference-counting, instead of copying by value:
+ if(!src.m_cobject)
+ m_cobject = 0;
+ else
+ m_cobject = cairo_font_options_copy(src.m_cobject);
+}
+
+FontOptions::~FontOptions()
+{
+ if(m_cobject)
+ cairo_font_options_destroy(m_cobject);
+}
+
+
+FontOptions& FontOptions::operator=(const FontOptions& src)
+{
+ //Reference-counting, instead of copying by value:
+
+ if(this == &src)
+ return *this;
+
+ if(m_cobject == src.m_cobject)
+ return *this;
+
+ if(m_cobject)
+ {
+ cairo_font_options_destroy(m_cobject);
+ m_cobject = 0;
+ }
+
+ if(!src.m_cobject)
+ return *this;
+
+ m_cobject = cairo_font_options_copy(src.m_cobject);
+
+ return *this;
+}
+
+bool FontOptions::operator==(const FontOptions& src) const
+{
+ return cairo_font_options_equal(m_cobject, src.cobj());
+}
+
+void FontOptions::merge(const FontOptions& src)
+{
+ cairo_font_options_merge(m_cobject, src.cobj());
+ check_object_status_and_throw_exception(*this);
+}
+
+unsigned long FontOptions::hash() const
+{
+ const unsigned long result = cairo_font_options_hash(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+void FontOptions::set_antialias(Antialias antialias)
+{
+ cairo_font_options_set_antialias(m_cobject, (cairo_antialias_t)antialias);
+ check_object_status_and_throw_exception(*this);
+}
+
+Antialias FontOptions::get_antialias() const
+{
+ const Antialias result = cairo_font_options_get_antialias(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+void FontOptions::set_subpixel_order(SubpixelOrder subpixel_order)
+{
+ cairo_font_options_set_subpixel_order(m_cobject, (cairo_subpixel_order_t)subpixel_order);
+ check_object_status_and_throw_exception(*this);
+}
+
+SubpixelOrder FontOptions::get_subpixel_order() const
+{
+ const SubpixelOrder result = cairo_font_options_get_subpixel_order(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+void FontOptions::set_hint_style(HintStyle hint_style)
+{
+ cairo_font_options_set_hint_style(m_cobject, (cairo_hint_style_t)hint_style);
+ check_object_status_and_throw_exception(*this);
+}
+
+HintStyle FontOptions::get_hint_style() const
+{
+ const HintStyle result = cairo_font_options_get_hint_style(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+void FontOptions::set_hint_metrics(HintMetrics hint_metrics)
+{
+ cairo_font_options_set_hint_metrics(m_cobject, (cairo_hint_metrics_t)hint_metrics);
+ check_object_status_and_throw_exception(*this);
+}
+
+HintMetrics FontOptions::get_hint_metrics() const
+{
+ const HintMetrics result = cairo_font_options_get_hint_metrics(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+} //namespace Cairo
diff --git a/cairomm/fontoptions.h b/cairomm/fontoptions.h
new file mode 100644
index 0000000..032fa15
--- /dev/null
+++ b/cairomm/fontoptions.h
@@ -0,0 +1,67 @@
+#ifndef __CAIROMM_FONTOPTIONS_H
+#define __CAIROMM_FONTOPTIONS_H
+
+#include <cairomm/enums.h>
+#include <string>
+#include <cairo/cairo.h>
+
+
+namespace Cairo
+{
+
+typedef cairo_antialias_t Antialias;
+typedef cairo_subpixel_order_t SubpixelOrder;
+typedef cairo_hint_style_t HintStyle;
+typedef cairo_hint_metrics_t HintMetrics;
+
+/** How a font should be rendered.
+ */
+class FontOptions
+{
+public:
+ FontOptions();
+ explicit FontOptions(cairo_font_options_t* cobject, bool take_ownership = false);
+ FontOptions(const FontOptions& src);
+
+ virtual ~FontOptions();
+
+ FontOptions& operator=(const FontOptions& src);
+
+ bool operator ==(const FontOptions& src) const;
+ //bool operator !=(const FontOptions& src) const;
+
+ void merge(const FontOptions& other);
+
+ unsigned long hash() const;
+
+ void set_antialias(Antialias antialias);
+ Antialias get_antialias() const;
+
+ void set_subpixel_order(SubpixelOrder subpixel_order);
+ SubpixelOrder get_subpixel_order() const;
+
+ void set_hint_style(HintStyle hint_style);
+ HintStyle get_hint_style() const;
+
+ void set_hint_metrics(HintMetrics hint_metrics);
+ HintMetrics get_hint_metrics() const;
+
+ typedef cairo_font_options_t cobject;
+ inline cobject* cobj() { return m_cobject; }
+ inline const cobject* cobj() const { return m_cobject; }
+
+ #ifndef DOXYGEN_IGNORE_THIS
+ ///For use only by the cairomm implementation.
+ inline Status get_status() const
+ { return cairo_font_options_status(const_cast<cairo_font_options_t*>(cobj())); }
+ #endif //DOXYGEN_IGNORE_THIS
+
+protected:
+
+ cobject* m_cobject;
+};
+
+} // namespace Cairo
+
+#endif //__CAIROMM_FONTOPTIONS_H
+
diff --git a/cairomm/path.cc b/cairomm/path.cc
new file mode 100644
index 0000000..1611f3a
--- /dev/null
+++ b/cairomm/path.cc
@@ -0,0 +1,78 @@
+#include <cairomm/path.h>
+#include <cairomm/private.h>
+#include <iostream>
+
+namespace Cairo
+{
+
+/*
+Path::Path()
+: m_cobject(0)
+{
+ m_cobject = cairo_path_create();
+}
+*/
+
+Path::Path(cairo_path_t* cobject, bool take_ownership)
+: m_cobject(0)
+{
+ if(take_ownership)
+ m_cobject = cobject;
+ else
+ {
+ std::cerr << "cairomm: Path::Path(): copying of the underlying cairo_path_t* is not yet implemented." << std::endl;
+ //m_cobject = cairo_path_copy(cobject);
+ }
+}
+
+/*
+Path::Path(const Path& src)
+{
+ //Reference-counting, instead of copying by value:
+ if(!src.m_cobject)
+ m_cobject = 0;
+ else
+ m_cobject = cairo_path_copy(src.m_cobject);
+}
+*/
+
+Path::~Path()
+{
+ if(m_cobject)
+ cairo_path_destroy(m_cobject);
+}
+
+/*
+Path& Path::operator=(const Path& src)
+{
+ //Reference-counting, instead of copying by value:
+
+ if(this == &src)
+ return *this;
+
+ if(m_cobject == src.m_cobject)
+ return *this;
+
+ if(m_cobject)
+ {
+ cairo_path_destroy(m_cobject);
+ m_cobject = 0;
+ }
+
+ if(!src.m_cobject)
+ return *this;
+
+ m_cobject = cairo_path_copy(src.m_cobject);
+
+ return *this;
+}
+*/
+
+/*
+bool Path::operator==(const Path& src) const
+{
+ return cairo_path_equal(m_cobject, src.cobj());
+}
+*/
+
+} //namespace Cairo
diff --git a/cairomm/path.h b/cairomm/path.h
new file mode 100644
index 0000000..cfafce2
--- /dev/null
+++ b/cairomm/path.h
@@ -0,0 +1,48 @@
+#ifndef __CAIROMM_PATH_H
+#define __CAIROMM_PATH_H
+
+#include <cairomm/enums.h>
+#include <string>
+#include <cairo/cairo.h>
+
+
+namespace Cairo
+{
+
+/** A data structure for holding a path.
+ * Use Context::copy_path() or Context::copy_path_flat() to instantiate a new Path.
+ */
+class Path
+{
+public:
+ //Path();
+ explicit Path(cairo_path_t* cobject, bool take_ownership = false);
+ //Path(const Path& src);
+
+ virtual ~Path();
+
+ //Path& operator=(const Path& src);
+
+ //bool operator ==(const Path& src) const;
+ //bool operator !=(const Path& src) const;
+
+ typedef cairo_path_t cobject;
+ inline cobject* cobj() { return m_cobject; }
+ inline const cobject* cobj() const { return m_cobject; }
+
+ #ifndef DOXYGEN_IGNORE_THIS
+ ///For use only by the cairomm implementation.
+ //There is no *_status() function for this object:
+ //inline Status get_status() const
+ //{ return cairo_path_status(const_cast<cairo_path_t*>(cobj())); }
+ #endif //DOXYGEN_IGNORE_THIS
+
+protected:
+
+ cobject* m_cobject;
+};
+
+} // namespace Cairo
+
+#endif //__CAIROMM_PATH_H
+
diff --git a/cairomm/pattern.cc b/cairomm/pattern.cc
new file mode 100644
index 0000000..d963e0b
--- /dev/null
+++ b/cairomm/pattern.cc
@@ -0,0 +1,136 @@
+#include <cairomm/pattern.h>
+#include <cairomm/private.h>
+
+namespace Cairo
+{
+
+Pattern::Pattern(cairo_pattern_t* cobject, bool has_reference)
+: m_cobject(0)
+{
+ if(has_reference)
+ m_cobject = cobject;
+ else
+ m_cobject = cairo_pattern_reference(cobject);
+}
+
+Pattern::Pattern(const Pattern& src)
+{
+ //Reference-counting, instead of copying by value:
+ if(!src.m_cobject)
+ m_cobject = 0;
+ else
+ m_cobject = cairo_pattern_reference(src.m_cobject);
+}
+
+Pattern::~Pattern()
+{
+ if(m_cobject)
+ cairo_pattern_destroy(m_cobject);
+}
+
+
+Pattern& Pattern::operator=(const Pattern& src)
+{
+ //Reference-counting, instead of copying by value:
+
+ if(this == &src)
+ return *this;
+
+ if(m_cobject == src.m_cobject)
+ return *this;
+
+ if(m_cobject)
+ {
+ cairo_pattern_destroy(m_cobject);
+ m_cobject = 0;
+ }
+
+ if(!src.m_cobject)
+ return *this;
+
+ m_cobject = cairo_pattern_reference(src.m_cobject);
+
+ return *this;
+}
+
+Pattern Pattern::create_rgb(double red, double green, double blue)
+{
+ cairo_pattern_t* cobject = cairo_pattern_create_rgb(red, green, blue);
+ return Pattern(cobject, true /* has reference */);
+}
+
+Pattern Pattern::create_rgba(double red, double green, double blue, double alpha)
+{
+ cairo_pattern_t* cobject = cairo_pattern_create_rgba(red, green, blue, alpha);
+ return Pattern(cobject, true /* has reference */);
+}
+
+Pattern Pattern::create_for_surface(cairo_surface_t *surface)
+{
+ cairo_pattern_t* cobject = cairo_pattern_create_for_surface(surface);
+ return Pattern(cobject, true /* has reference */);
+}
+
+Pattern Pattern::create_linear(double x0, double y0, double x1, double y1)
+{
+ cairo_pattern_t* cobject = cairo_pattern_create_linear(x0, y0, x1, y1);
+ return Pattern(cobject, true /* has reference */);
+}
+
+Pattern Pattern::create_radial(double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)
+{
+ cairo_pattern_t* cobject = cairo_pattern_create_radial(cx0, cy0, radius0, cx1, cy1, radius1);
+ return Pattern(cobject, true /* has reference */);
+}
+
+void Pattern::add_color_stop_rgb(double offset, double red, double green, double blue)
+{
+ cairo_pattern_add_color_stop_rgb(m_cobject, offset, red, green, blue);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Pattern::add_color_stop_rgba(double offset, double red, double green, double blue, double alpha)
+{
+ cairo_pattern_add_color_stop_rgba(m_cobject, offset, red, green, blue, alpha);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Pattern::set_matrix(const cairo_matrix_t &matrix)
+{
+ cairo_pattern_set_matrix(m_cobject, &matrix);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Pattern::get_matrix(cairo_matrix_t &matrix) const
+{
+ cairo_pattern_get_matrix(m_cobject, &matrix);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Pattern::set_extend(Extend extend)
+{
+ cairo_pattern_set_extend(m_cobject, (cairo_extend_t)extend);
+ check_object_status_and_throw_exception(*this);
+}
+
+Extend Pattern::get_extend() const
+{
+ const Extend result = cairo_pattern_get_extend(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+void Pattern::set_filter(Filter filter)
+{
+ cairo_pattern_set_filter(m_cobject, (cairo_filter_t)filter);
+ check_object_status_and_throw_exception(*this);
+}
+
+Filter Pattern::get_filter() const
+{
+ Filter result = cairo_pattern_get_filter(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+} //namespace Cairo
diff --git a/cairomm/pattern.h b/cairomm/pattern.h
new file mode 100644
index 0000000..d0725d1
--- /dev/null
+++ b/cairomm/pattern.h
@@ -0,0 +1,75 @@
+#ifndef __CAIROMM_PATTERN_H
+#define __CAIROMM_PATTERN_H
+
+#include <cairomm/enums.h>
+#include <cairo/cairo.h>
+
+
+namespace Cairo
+{
+
+typedef cairo_extend_t Extend;
+typedef cairo_filter_t Filter;
+
+/**
+ * This is a reference-counted object. The copy constructor creates a second reference to the object, instead
+ * of creating an independent copy of the object.
+ */
+class Pattern
+{
+public:
+ Pattern();
+
+ /** Create a C++ wrapper for the C instance.
+ * @param cobject The C instance.
+ * @param has_reference Whether we already have a reference. Otherwise, the constructor will take an extra reference.
+ */
+ explicit Pattern(cairo_pattern_t* cobject, bool has_reference = false);
+
+ /** Create a second reference to the Pattern.
+ * Changing this instance will change the original instance.
+ */
+ Pattern(const Pattern& src);
+
+ //TODO?: Pattern(cairo_pattern_t *target);
+ virtual ~Pattern();
+
+ /** Create a second reference to the Pattern.
+ * Changing this instance will change the original instance.
+ */
+ Pattern& operator=(const Pattern& src);
+
+ static Pattern create_rgb(double red, double green, double blue);
+ static Pattern create_rgba(double red, double green, double blue, double alpha);
+
+ static Pattern create_for_surface(cairo_surface_t *surface);
+ static Pattern create_linear(double x0, double y0, double x1, double y1);
+ static Pattern create_radial(double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
+
+ void add_color_stop_rgb(double offset, double red, double green, double blue);
+ void add_color_stop_rgba(double offset, double red, double green, double blue, double alpha);
+ void set_matrix(const cairo_matrix_t &matrix);
+ void get_matrix(cairo_matrix_t &matrix) const;
+ void set_extend(Extend extend);
+ Extend get_extend() const;
+ void set_filter(Filter filter);
+ Filter get_filter() const;
+
+ typedef cairo_pattern_t cobject;
+ inline cobject* cobj() { return m_cobject; }
+ inline const cobject* cobj() const { return m_cobject; }
+
+ #ifndef DOXYGEN_IGNORE_THIS
+ ///For use only by the cairomm implementation.
+ inline Status get_status() const
+ { return cairo_pattern_status(const_cast<cairo_pattern_t*>(cobj())); }
+ #endif //DOXYGEN_IGNORE_THIS
+
+protected:
+ cobject* m_cobject;
+};
+
+} // namespace Cairo
+
+#endif //__CAIROMM_PATTERN_H
+
diff --git a/cairomm/private.cc b/cairomm/private.cc
new file mode 100644
index 0000000..b92f2a6
--- /dev/null
+++ b/cairomm/private.cc
@@ -0,0 +1,8 @@
+#include <cairomm/private.h>
+#include <cairomm/exception.h>
+
+namespace Cairo
+{
+
+
+} //namespace Cairo
diff --git a/cairomm/private.h b/cairomm/private.h
new file mode 100644
index 0000000..b67fd91
--- /dev/null
+++ b/cairomm/private.h
@@ -0,0 +1,29 @@
+#ifndef __CAIROMM_PRIVATE_H
+#define __CAIROMM_PRIVATE_H
+
+#include <cairomm/enums.h>
+#include <cairomm/exception.h>
+#include <string>
+
+
+namespace Cairo
+{
+
+//We inline this because it is called so often.
+inline void check_status_and_throw_exception(Status status)
+{
+ if(status != CAIRO_STATUS_SUCCESS)
+ throw exception(status);
+}
+
+template<class T>
+void check_object_status_and_throw_exception(const T& object)
+{
+ //get_status() is normally an inlined member method.
+ check_status_and_throw_exception(object.get_status());
+}
+
+} // namespace Cairo
+
+#endif //__CAIROMM_PRIVATE_H
+
diff --git a/cairomm/surface.cc b/cairomm/surface.cc
new file mode 100644
index 0000000..ccb2d48
--- /dev/null
+++ b/cairomm/surface.cc
@@ -0,0 +1,155 @@
+#include <cairomm/surface.h>
+#include <cairomm/private.h>
+
+namespace Cairo
+{
+
+Surface::Surface(cairo_surface_t* cobject, bool has_reference)
+: m_cobject(0)
+{
+ if(has_reference)
+ m_cobject = cobject;
+ else
+ m_cobject = cairo_surface_reference(cobject);
+}
+
+Surface::Surface(const Surface& src)
+{
+ //Reference-counting, instead of copying by value:
+ if(!src.m_cobject)
+ m_cobject = 0;
+ else
+ m_cobject = cairo_surface_reference(src.m_cobject);
+}
+
+Surface::~Surface()
+{
+ if(m_cobject)
+ cairo_surface_destroy(m_cobject);
+}
+
+
+Surface& Surface::operator=(const Surface& src)
+{
+ //Reference-counting, instead of copying by value:
+
+ if(this == &src)
+ return *this;
+
+ if(m_cobject == src.m_cobject)
+ return *this;
+
+ if(m_cobject)
+ {
+ cairo_surface_destroy(m_cobject);
+ m_cobject = 0;
+ }
+
+ if(!src.m_cobject)
+ return *this;
+
+ m_cobject = cairo_surface_reference(src.m_cobject);
+
+ return *this;
+}
+
+Surface Surface::create(Format format, int width, int height)
+{
+ cairo_surface_t* cobject = cairo_image_surface_create((cairo_format_t)format, width, height);
+ //Not possible with a static method: check_object_status_and_throw_exception(*this);
+ return Surface(cobject, true /* has reference */);
+}
+
+Surface Surface::create(unsigned char* data, Format format, int width, int height, int stride)
+{
+ cairo_surface_t* cobject = cairo_image_surface_create_for_data(data, (cairo_format_t)format, width, height, stride);
+ //Not possible with a static method: check_object_status_and_throw_exception(*this);
+ return Surface(cobject, true /* has reference */);
+}
+
+Surface Surface::create(const Surface& other, Content content, int width, int height)
+{
+ cairo_surface_t* cobject = cairo_surface_create_similar(other.m_cobject, (cairo_content_t)content, width, height);
+ //Not possible with a static method: check_object_status_and_throw_exception(*this);
+ return Surface(cobject, true /* has reference */);
+}
+
+void Surface::finish()
+{
+ cairo_surface_finish(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+/* Seems to have been removed from the Cairo API:
+Status Surface::write_to_png(const std::string& filename)
+{
+ return (Status)cairo_surface_write_to_png(m_cobject, filename.c_str());
+}
+
+Status Surface::write_to_png_stream(cairo_write_func_t write_func, void *closure)
+{
+ return (Status)cairo_surface_write_to_png_stream(m_cobject, write_func, closure);
+}
+*/
+
+void* Surface::get_user_data(const cairo_user_data_key_t *key)
+{
+ void* result = cairo_surface_get_user_data(m_cobject, key);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+void Surface::set_user_data(const cairo_user_data_key_t* key, void *user_data, cairo_destroy_func_t destroy)
+{
+ const Status status = (Status)cairo_surface_set_user_data(m_cobject, key, user_data, destroy);
+ check_status_and_throw_exception(status);
+}
+
+void Surface::get_font_options(FontOptions& options)
+{
+ cairo_font_options_t* cfontoptions = cairo_font_options_create();
+ cairo_surface_get_font_options(m_cobject, cfontoptions);
+ options = FontOptions(cfontoptions);
+ cairo_font_options_destroy(cfontoptions);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Surface::flush()
+{
+ cairo_surface_flush(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Surface::mark_dirty()
+{
+ cairo_surface_mark_dirty(m_cobject);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Surface::mark_dirty(int x, int y, int width, int height)
+{
+ cairo_surface_mark_dirty_rectangle(m_cobject, x, y, width, height);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Surface::set_device_offset(double x_offset, double y_offset)
+{
+ cairo_surface_set_device_offset(m_cobject, x_offset, y_offset);
+ check_object_status_and_throw_exception(*this);
+}
+
+int Surface::get_width() const
+{
+ const int result = cairo_image_surface_get_width(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+int Surface::get_height() const
+{
+ const int result = cairo_image_surface_get_height(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return result;
+}
+
+} //namespace Cairo
diff --git a/cairomm/surface.h b/cairomm/surface.h
new file mode 100644
index 0000000..7353f69
--- /dev/null
+++ b/cairomm/surface.h
@@ -0,0 +1,91 @@
+#ifndef __CAIROMM_SURFACE_H
+#define __CAIROMM_SURFACE_H
+
+#include <cairomm/fontoptions.h>
+#include <cairomm/enums.h>
+#include <cairo/cairo.h>
+
+
+namespace Cairo
+{
+
+typedef cairo_content_t Content;
+typedef cairo_format_t Format;
+
+/** A cairo surface represents an image, either as the destination of a drawing operation or as source when
+ * drawing onto another surface. There are different subtypes of cairo surface for different drawing
+ * backends.
+ *
+ * This is a reference-counted object. The copy constructor creates a second reference to the object, instead of creating an independent copy of the object.
+ */
+class Surface
+{
+public:
+ Surface();
+
+ /** Create a C++ wrapper for the C instance.
+ * @param cobject The C instance.
+ * @param has_reference Whether we already have a reference. Otherwise, the constructor will take an extra reference.
+ */
+ explicit Surface(cairo_surface_t* cobject, bool has_reference = false);
+
+ /** Create a second reference to the surface.
+ * Changing this instance will change the original instance.
+ */
+ Surface(const Surface& src);
+
+ //TODO?: Surface(cairo_surface_t *target);
+ virtual ~Surface();
+
+ /** Create a second reference to the surface.
+ * Changing this instance will change the original instance.
+ */
+ Surface& operator=(const Surface& src);
+
+ //We use create_*() methods, instead of constructors, because
+ //a) We want to make it clear that these are new instance, not just new references to the same instances.
+ //b) Overloading on parameter types are not always enough to distinguish them.
+ static Surface create(const Surface& other, Content content, int width, int height);
+ static Surface create(Format format, int width, int height);
+ static Surface create(unsigned char* data, Format format, int width, int height, int stride);
+
+ //void write_to_png(const std::string& filename);
+ //void write_to_png_stream(cairo_write_func_t write_func, void *closure); //TODO: Use a sigc::slot?
+ void *get_user_data(const cairo_user_data_key_t *key);
+
+ void set_user_data(const cairo_user_data_key_t *key, void *user_data, cairo_destroy_func_t destroy); //TODO: Use a sigc::slot?
+
+ void get_font_options(FontOptions& options);
+
+ void finish();
+ void flush();
+
+ void mark_dirty();
+ void mark_dirty(int x, int y, int width, int height);
+
+ void set_device_offset(double x_offset, double y_offset);
+
+ int get_width() const;
+ int get_height() const;
+
+ void create_from_png(const char* filename);
+ void create_from_png_stream(cairo_read_func_t read_func, void *closure);
+
+ typedef cairo_surface_t cobject;
+ inline cobject* cobj() { return m_cobject; }
+ inline const cobject* cobj() const { return m_cobject; }
+
+ #ifndef DOXYGEN_IGNORE_THIS
+ ///For use only by the cairomm implementation.
+ inline Status get_status() const
+ { return cairo_surface_status(const_cast<cairo_surface_t*>(cobj())); }
+ #endif //DOXYGEN_IGNORE_THIS
+
+protected:
+ cobject* m_cobject;
+};
+
+} // namespace Cairo
+
+#endif //__CAIROMM_SURFACE_H
+
diff --git a/configure.in b/configure.in
new file mode 100644
index 0000000..2041fb3
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,104 @@
+AC_INIT(cairomm/cairomm.h)
+
+#release versioning
+GENERIC_MAJOR_VERSION=0
+GENERIC_MINOR_VERSION=1
+GENERIC_MICRO_VERSION=0
+GENERIC_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION.$GENERIC_MICRO_VERSION
+AC_SUBST(GENERIC_MAJOR_VERSION)
+AC_SUBST(GENERIC_MINOR_VERSION)
+AC_SUBST(GENERIC_MICRO_VERSION)
+AC_SUBST(GENERIC_VERSION)
+
+#shared library versioning
+GENERIC_LIBRARY_VERSION=0:1:0
+# | | |
+# +------+ | +---+
+# | | |
+# current:revision:age
+# | | |
+# | | +- increment if interfaces have been added
+# | | set to zero if interfaces have been removed
+# or changed
+# | +- increment if source code has changed
+# | set to zero if current is incremented
+# +- increment if interfaces have been added, removed or changed
+AC_SUBST(GENERIC_LIBRARY_VERSION)
+
+
+
+VERSION=$GENERIC_VERSION
+
+
+AM_INIT_AUTOMAKE(cairomm, $GENERIC_VERSION)
+
+AC_PROG_CXX
+AC_PROG_CXXCPP
+AC_LANG_CPLUSPLUS
+AC_PROG_INSTALL
+AC_LIBTOOL_WIN32_DLL
+AM_PROG_LIBTOOL
+
+dnl Used for enabling the "-no-undefined" and "-export-all-symbols" flags
+dnl while generating DLLs. Borrowed from the official gtk+-2 configure.in
+AC_MSG_CHECKING([for some Win32 platform])
+case "$host" in
+ *-*-mingw*|*-*-cygwin*)
+ platform_win32=yes
+ ;;
+ *)
+ platform_win32=no
+ ;;
+esac
+AC_MSG_RESULT([$platform_win32])
+AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
+
+# Ensure MSVC-compatible struct packing convention is used when
+# compiling for Win32 with gcc.
+# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
+# gcc2 uses "-fnative-struct".
+if test x"$platform_win32" = xyes; then
+ if test x"$GCC" = xyes; then
+ msnative_struct=''
+ AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
+ if test -z "$ac_cv_prog_CC"; then
+ our_gcc="$CC"
+ else
+ our_gcc="$ac_cv_prog_CC"
+ fi
+ case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
+ 2.)
+ if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
+ msnative_struct='-fnative-struct'
+ fi
+ ;;
+ *)
+ if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
+ msnative_struct='-mms-bitfields'
+ fi
+ ;;
+ esac
+ if test x"$msnative_struct" = x ; then
+ AC_MSG_RESULT([no way])
+ AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
+ else
+ CXXFLAGS="$CXXFLAGS $msnative_struct"
+ AC_MSG_RESULT([${msnative_struct}])
+ fi
+ fi
+fi
+
+AC_CHECK_HEADERS(string list map, , exit)
+
+PKG_CHECK_MODULES(CAIROMM, cairo >= 1.0)
+
+GLIBMM_CHECK_PERL([5.6.0])
+
+AC_OUTPUT(
+ Makefile
+ cairomm/Makefile
+
+ examples/Makefile
+
+ cairomm-1.0.pc
+)
diff --git a/examples/.cvsignore b/examples/.cvsignore
new file mode 100644
index 0000000..3dda729
--- /dev/null
+++ b/examples/.cvsignore
@@ -0,0 +1,2 @@
+Makefile.in
+Makefile
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 0000000..739d4db
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS =
+
+EXTRA_DIST = README Makefile.am_fragment
diff --git a/examples/Makefile.am_fragment b/examples/Makefile.am_fragment
new file mode 100644
index 0000000..0cc394a
--- /dev/null
+++ b/examples/Makefile.am_fragment
@@ -0,0 +1,5 @@
+#Where to find the header files needed by the source files:
+INCLUDES = -I$(top_srcdir) @LIBXML_CFLAGS@
+
+#The libraries that the executable needs to link against:
+LIBS = $(top_builddir)/cairomm/cairommm-1.0.la @LIBS@ @LIBXML_LIBS@
diff --git a/examples/README b/examples/README
new file mode 100644
index 0000000..bb6f596
--- /dev/null
+++ b/examples/README
@@ -0,0 +1,23 @@
+Examples:
+
+Simple parsing examples:
+ dom_parser - Shows how to parse an XML Document with the DOM parser.
+ sax_parser - Shows how to parse an XML Document with the SAX parser.
+
+Building XML doxuments:
+ dom_build - Shows how to build an XML document using the DOM Parser API.
+ sax_parser_build_dom - Shows how to parse an XML document with the SAX parser, building a separate custom DOM as you parse.
+ dom_read_write: Reads an XML document with the DOM parser and writes it again. The output should be the same as the input.
+ import_node: Adds a part of an XML document to another, using the DOM parser.
+
+Entity parsing:
+ dom_parser_entities: Shows how to detect entity references when using the DOM parser.
+ sax_parser_entities: Shows how to detect (and maybe resolve) entity references when using the SAX Parser.
+
+XPath:
+ dom_xpath: Shows how to get XML nodes by specifying them with an XPath, when using the DOM parser.
+
+Others:
+ sax_exception: Shows how to implement a libxml++ exception that can be thrown by your SAX parser.
+ dom_parser_raw: Test parse_memory_raw() by converting a UTF-8-encoded XML document to UCS-2 and passing the raw memory to the parser.
+