[cairo-commit] cairo-demo/cairo_snippets clip.cairo, NONE, 1.1 clip_image.cairo, NONE, 1.1 set_line_cap.cairo, NONE, 1.1 set_line_join.cairo, NONE, 1.1 caps.cairo, 1.2, NONE clipping.cairo, 1.1, NONE image_clipping.cairo, 1.1, NONE joins.cairo, 1.2, NONE

OEyvind Kolaas commit at pdx.freedesktop.org
Sat May 29 08:47:40 PDT 2004


Committed by: pippin

Update of /cvs/cairo/cairo-demo/cairo_snippets
In directory pdx:/tmp/cvs-serv14461

Added Files:
	clip.cairo clip_image.cairo set_line_cap.cairo 
	set_line_join.cairo 
Removed Files:
	caps.cairo clipping.cairo image_clipping.cairo joins.cairo 
Log Message:
renamed some of the snippets for closer mapping to the api they illustrate


--- NEW FILE: clip.cairo ---
cairo_arc (cr, 0.5, 0.5, 0.3, 0, 2 * M_PI);
cairo_clip (cr);

cairo_new_path (cr);  /* current path is not
                         consumed by cairo_clip() */
cairo_rectangle (cr, 0, 0, 1, 1);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0, 1, 0);
cairo_move_to (cr, 0, 0);
cairo_line_to (cr, 1, 1);
cairo_move_to (cr, 1, 0);
cairo_line_to (cr, 0, 1);
cairo_stroke (cr);

--- NEW FILE: clip_image.cairo ---
int              w,h,stride;
char            *buffer;
cairo_surface_t *image;

cairo_arc (cr, 0.5, 0.5, 0.3, 0, 2*M_PI);
cairo_clip (cr);
cairo_new_path (cr); /* path not consumed by clip()*/

buffer = read_png_argb32 (
              "data/romedalen.png", &w,&h, &stride);
image  = cairo_surface_create_for_image (
              buffer, CAIRO_FORMAT_ARGB32, w,h, stride);

cairo_scale (cr, 1.0/w, 1.0/h);

cairo_move_to (cr, 0, 0);
cairo_show_surface (cr, image, w, h);

cairo_surface_destroy (image);
free (buffer);

--- NEW FILE: set_line_cap.cairo ---
cairo_set_line_width (cr, 0.12);
cairo_set_line_cap  (cr, CAIRO_LINE_CAP_BUTT); /* default */
cairo_move_to (cr, 0.25, 0.2); cairo_line_to (cr, 0.25, 0.8);
cairo_stroke (cr);
cairo_set_line_cap  (cr, CAIRO_LINE_CAP_ROUND);
cairo_move_to (cr, 0.5, 0.2); cairo_line_to (cr, 0.5, 0.8);
cairo_stroke (cr);
cairo_set_line_cap  (cr, CAIRO_LINE_CAP_SQUARE);
cairo_move_to (cr, 0.75, 0.2); cairo_line_to (cr, 0.75, 0.8);
cairo_stroke (cr);

/* draw helping lines */
cairo_set_rgb_color (cr, 1,0.2,0.2);
cairo_set_line_width (cr, 0.01);
cairo_move_to (cr, 0.25, 0.2); cairo_line_to (cr, 0.25, 0.8);
cairo_move_to (cr, 0.5, 0.2);  cairo_line_to (cr, 0.5, 0.8);
cairo_move_to (cr, 0.75, 0.2); cairo_line_to (cr, 0.75, 0.8);
cairo_stroke (cr);

--- NEW FILE: set_line_join.cairo ---
cairo_set_line_width (cr, 0.16);
cairo_move_to (cr, 0.3, 0.33);
cairo_rel_line_to (cr, 0.2, -0.2);
cairo_rel_line_to (cr, 0.2, 0.2);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER); /* default */
cairo_stroke (cr);

cairo_move_to (cr, 0.3, 0.63);
cairo_rel_line_to (cr, 0.2, -0.2);
cairo_rel_line_to (cr, 0.2, 0.2);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_BEVEL);
cairo_stroke (cr);

cairo_move_to (cr, 0.3, 0.93);
cairo_rel_line_to (cr, 0.2, -0.2);
cairo_rel_line_to (cr, 0.2, 0.2);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
cairo_stroke (cr);



--- caps.cairo DELETED ---

--- clipping.cairo DELETED ---

--- image_clipping.cairo DELETED ---

--- joins.cairo DELETED ---





More information about the cairo-commit mailing list