diff options
author | Murray Cumming <murrayc@murrayc.com> | 2006-01-21 16:22:40 +0000 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2006-01-21 16:22:40 +0000 |
commit | a8ceaa343d7c0d17b44403ed120c669814395f7c (patch) | |
tree | 9eba77bf009389df7179f1e48126b8b7121a70bd /examples | |
parent | 51fecda0dd28e39f848b32bc5cf30085c4bc0f74 (diff) |
2006-01-15 Jonathon Jongsma <jonathon.jongsma@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.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/png_file/Makefile.am | 2 | ||||
-rw-r--r-- | examples/png_file/main.cc | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/examples/png_file/Makefile.am b/examples/png_file/Makefile.am index 7f94f54..a4095b8 100644 --- a/examples/png_file/Makefile.am +++ b/examples/png_file/Makefile.am @@ -3,3 +3,5 @@ include $(top_srcdir)/examples/Makefile.am_fragment # 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 diff --git a/examples/png_file/main.cc b/examples/png_file/main.cc index 44124ab..22a2e74 100644 --- a/examples/png_file/main.cc +++ b/examples/png_file/main.cc @@ -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 @@ int main(int argc, char** argv) #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; |