[cairo-commit] cairomm/examples/svg-surface Makefile.am, NONE,
1.1 main.cc, NONE, 1.1
Murray Cumming
commit at pdx.freedesktop.org
Thu Jan 26 07:59:18 PST 2006
- Previous message: [cairo-commit] cairomm/examples/ps-surface Makefile.am, NONE,
1.1 main.cc, NONE, 1.1
- Next message: [cairo-commit] cairo-demo/cairo-candy ChangeLog, 1.1, 1.2 INSTALL,
1.1, 1.2 Makefile, 1.1, 1.2 NEWS, 1.1, 1.2 README, 1.1,
1.2 cairo-clock.c, 1.2, 1.3 clock-drop-shadow.svg, NONE,
1.1 clock-face-shadow.svg, NONE, 1.1 clock-face.svg, NONE,
1.1 clock-frame.svg, NONE, 1.1 clock-glass.svg, NONE,
1.1 clock-hour-hand-shadow.svg, NONE, 1.1 clock-hour-hand.svg,
NONE, 1.1 clock-marks.svg, NONE,
1.1 clock-minute-hand-shadow.svg, NONE,
1.1 clock-minute-hand.svg, NONE,
1.1 clock-second-hand-shadow.svg, NONE,
1.1 clock-second-hand.svg, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: murrayc
Update of /cvs/cairo/cairomm/examples/svg-surface
In directory gabe:/tmp/cvs-serv5707/examples/svg-surface
Added Files:
Makefile.am main.cc
Log Message:
2006-01-25 Jonathon Jongsma <jonathon.jongsma at gmail.com>
* configure.in:
* examples/Makefile.am:
* examples/pdf-surface/:
* examples/ps-surface/:
* examples/svg-surface/: add examples for additional surfaces
--- NEW FILE: Makefile.am ---
include $(top_srcdir)/examples/Makefile.am_fragment
# build the executable but don't install it
noinst_PROGRAMS = example_svg_file
example_svg_file_SOURCES = main.cc
CLEANFILES = image.svg
--- NEW FILE: main.cc ---
#include <string>
#include <iostream>
#include <cairomm/context.h>
#include <cairomm/surface.h>
int main(int argc, char** argv)
{
#ifdef CAIRO_HAS_SVG_SURFACE
std::string filename = "image.svg";
double width = 600;
double height = 400;
Cairo::RefPtr<Cairo::SvgSurface> surface =
Cairo::SvgSurface::create(filename, width, height);
Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface);
cr->save(); // save the state of the context
cr->set_source_rgb(0.86, 0.85, 0.47);
cr->paint(); // fill image with the color
cr->restore(); // color is back to black now
cr->save();
// draw a border around the image
cr->set_line_width(20.0); // make the line wider
cr->rectangle(0.0, 0.0, cairo_image_surface_get_width(surface->cobj()), height);
cr->stroke();
cr->set_source_rgba(0.0, 0.0, 0.0, 0.7);
// draw a circle in the center of the image
cr->arc(width / 2.0, height / 2.0,
height / 4.0, 0.0, 2.0 * M_PI);
cr->stroke();
// draw a diagonal line
cr->move_to(width / 4.0, height / 4.0);
cr->line_to(width * 3.0 / 4.0, height * 3.0 / 4.0);
cr->stroke();
cr->restore();
cr->show_page();
std::cout << "Wrote PostScript file \"" << filename << "\"" << std::endl;
return 0;
#else
std::cout << "You must compile cairo with PDF support for this example to work."
<< std::endl;
return 1;
#endif
}
- Previous message: [cairo-commit] cairomm/examples/ps-surface Makefile.am, NONE,
1.1 main.cc, NONE, 1.1
- Next message: [cairo-commit] cairo-demo/cairo-candy ChangeLog, 1.1, 1.2 INSTALL,
1.1, 1.2 Makefile, 1.1, 1.2 NEWS, 1.1, 1.2 README, 1.1,
1.2 cairo-clock.c, 1.2, 1.3 clock-drop-shadow.svg, NONE,
1.1 clock-face-shadow.svg, NONE, 1.1 clock-face.svg, NONE,
1.1 clock-frame.svg, NONE, 1.1 clock-glass.svg, NONE,
1.1 clock-hour-hand-shadow.svg, NONE, 1.1 clock-hour-hand.svg,
NONE, 1.1 clock-marks.svg, NONE,
1.1 clock-minute-hand-shadow.svg, NONE,
1.1 clock-minute-hand.svg, NONE,
1.1 clock-second-hand-shadow.svg, NONE,
1.1 clock-second-hand.svg, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list