[cairo-commit] cairomm/examples/png_file Makefile.am, 1.1, 1.2 main.cc, 1.1, 1.2

Murray Cumming commit at pdx.freedesktop.org
Sat Jan 21 08:22:42 PST 2006


Committed by: murrayc

Update of /cvs/cairo/cairomm/examples/png_file
In directory gabe:/tmp/cvs-serv8772/examples/png_file

Modified Files:
	Makefile.am main.cc 
Log Message:
2006-01-15  Jonathon Jongsma  <jonathon.jongsma at gmail.com>

        * cairomm/surface.cc:
        * cairomm/surface.h: backwards-incompatible API change for the Surface
        types.  Cairo::Surface is now a base class for all of the other surface
        types, and should not be used directly.  New Surface types include
        ImageSurface, XlibSurface, Win32Surface, PdfSurface, PsSurface,
        SvgSurface, and GlitzSurface.
        Modified Surface::write_to_png() and Surface::write_to_png_stream() so
        that they throw exceptions like the other functions instead of returning a
        cairo_status_t value.
        Added API documentation for all Surface classes and all member functions
        of the Surface class heirarchy.
        * examples/png_file/Makefile.am: added generated PNG file to CLEANFILES
        * examples/png_file/main.cc: updated the PNG example to use the new
        ImageSurface class instead of using the Surface class directly.
        * cairomm/*: Renamed the Cairo::Status type to Cairo::ErrorStatus since it
        conflicts with a #define Status in XLib and is not used exposed in the API
        anyway.


Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/cairomm/examples/png_file/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile.am	7 Jan 2006 11:53:02 -0000	1.1
+++ Makefile.am	21 Jan 2006 16:22:40 -0000	1.2
@@ -3,3 +3,5 @@
 # build the executable but don't install it
 noinst_PROGRAMS = example_png_file
 example_png_file_SOURCES = main.cc
+
+CLEANFILES = example_png_file.png
\ No newline at end of file

Index: main.cc
===================================================================
RCS file: /cvs/cairo/cairomm/examples/png_file/main.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- main.cc	7 Jan 2006 11:53:02 -0000	1.1
+++ main.cc	21 Jan 2006 16:22:40 -0000	1.2
@@ -1,11 +1,12 @@
 #include <string>
 #include <iostream>
-#include <cairomm/cairomm.h>
+#include <cairomm/context.h>
+#include <cairomm/surface.h>
 
 int main(int argc, char** argv)
 {
-    Cairo::RefPtr<Cairo::Surface> surface =
-        Cairo::Surface::create(CAIRO_FORMAT_ARGB32, 600, 400);
+    Cairo::RefPtr<Cairo::ImageSurface> surface =
+        Cairo::ImageSurface::create(CAIRO_FORMAT_ARGB32, 600, 400);
 
     Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface);
 
@@ -34,7 +35,7 @@
 
 #ifdef CAIRO_HAS_PNG_FUNCTIONS
 
-    std::string filename = "example_png_file.png";
+    std::string filename = "image.png";
     surface->write_to_png(filename);
 
     std::cout << "Wrote png file \"" << filename << "\"" << std::endl;



More information about the cairo-commit mailing list