[cairo-commit] cairo-demo/png ChangeLog, 1.11, 1.12 caps_joins.c, 1.1, 1.2 hering.c, 1.1, 1.2 outline.c, 1.4, 1.5 spiral.c, 1.1, 1.2 splines_tolerance.c, 1.1, 1.2 stars.c, 1.1, 1.2

OEyvind Kolaas commit at pdx.freedesktop.org
Tue May 11 07:52:21 PDT 2004


Committed by: pippin

Update of /cvs/cairo/cairo-demo/png
In directory pdx:/tmp/cvs-serv17873

Modified Files:
	ChangeLog caps_joins.c hering.c outline.c spiral.c 
	splines_tolerance.c stars.c 
Log Message:
global replacing of ct with cr


Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/ChangeLog,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** a/ChangeLog	29 Apr 2004 05:38:57 -0000	1.11
--- b/ChangeLog	11 May 2004 14:52:19 -0000	1.12
***************
*** 1,2 ****
--- 1,5 ----
+ 2004-05-11  Øyvind Kolås <oeyvindk at hig.no>
+ 	* *.[ch] : replacing ct with cr
+ 
  2004-04-28  Carl Worth  <cworth at isi.edu>
  

Index: caps_joins.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/caps_joins.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/caps_joins.c	18 Aug 2003 18:11:38 -0000	1.1
--- b/caps_joins.c	11 May 2004 14:52:19 -0000	1.2
***************
*** 31,41 ****
  
  void
! draw_caps_joins (cairo_t *ct, int width, int height);
  
  void
! stroke_v_twice (cairo_t *ct, int dx, int dy);
  
  void
! draw_three_vs (cairo_t *ct, int width, int height, int line_width);
  
  #define WIDTH 600
--- 31,41 ----
  
  void
! draw_caps_joins (cairo_t *cr, int width, int height);
  
  void
! stroke_v_twice (cairo_t *cr, int dx, int dy);
  
  void
! draw_three_vs (cairo_t *cr, int width, int height, int line_width);
  
  #define WIDTH 600
***************
*** 48,67 ****
  main (void)
  {
!     cairo_t *ct;
  
!     ct = cairo_create ();
  
!     cairo_set_target_image (ct, image, CAIRO_FORMAT_ARGB32,
  		      WIDTH, HEIGHT, STRIDE);
  
!     cairo_rectangle (ct, 0, 0, WIDTH, HEIGHT);
!     cairo_set_rgb_color (ct, 1, 1, 1);
!     cairo_fill (ct);
  
!     draw_caps_joins (ct, WIDTH, HEIGHT);
  
      write_png_argb32 (image, "caps_joins.png", WIDTH, HEIGHT, STRIDE);
  
!     cairo_destroy (ct);
  
      return 0;
--- 48,67 ----
  main (void)
  {
!     cairo_t *cr;
  
!     cr = cairo_create ();
  
!     cairo_set_target_image (cr, image, CAIRO_FORMAT_ARGB32,
  		      WIDTH, HEIGHT, STRIDE);
  
!     cairo_rectangle (cr, 0, 0, WIDTH, HEIGHT);
!     cairo_set_rgb_color (cr, 1, 1, 1);
!     cairo_fill (cr);
  
!     draw_caps_joins (cr, WIDTH, HEIGHT);
  
      write_png_argb32 (image, "caps_joins.png", WIDTH, HEIGHT, STRIDE);
  
!     cairo_destroy (cr);
  
      return 0;
***************
*** 69,118 ****
  
  void
! stroke_v_twice (cairo_t *ct, int width, int height)
  {
!     cairo_move_to (ct, 0, 0);
!     cairo_rel_line_to (ct, width / 2, height / 2);
!     cairo_rel_line_to (ct, width / 2, - height / 2);
  
!     cairo_save (ct);
!     cairo_stroke (ct);
!     cairo_restore (ct);
  
!     cairo_save (ct);
      {
! 	cairo_set_line_width (ct, 2.0);
! 	cairo_set_line_cap (ct, CAIRO_LINE_CAP_BUTT);
! 	cairo_set_rgb_color (ct, 1, 1, 1);
! 	cairo_stroke (ct);
      }
!     cairo_restore (ct);
  
!     cairo_new_path (ct);
  }
  
  void
! draw_caps_joins (cairo_t *ct, int width, int height)
  {
      int line_width = height / 12 & (~1);
  
!     cairo_set_line_width (ct, line_width);
!     cairo_set_rgb_color (ct, 0, 0, 0);
  
!     cairo_translate (ct, line_width, line_width);
      width -= 2 *line_width;
  
!     cairo_set_line_join (ct, CAIRO_LINE_JOIN_BEVEL);
!     cairo_set_line_cap (ct, CAIRO_LINE_CAP_BUTT);
!     stroke_v_twice (ct, width, height);
  
!     cairo_translate (ct, 0, height / 4 - line_width);
!     cairo_set_line_join (ct, CAIRO_LINE_JOIN_MITER);
!     cairo_set_line_cap (ct, CAIRO_LINE_CAP_SQUARE);
!     stroke_v_twice (ct, width, height);
  
!     cairo_translate (ct, 0, height / 4 - line_width);
!     cairo_set_line_join (ct, CAIRO_LINE_JOIN_ROUND);
!     cairo_set_line_cap (ct, CAIRO_LINE_CAP_ROUND);
!     stroke_v_twice (ct, width, height);
  }
  
--- 69,118 ----
  
  void
! stroke_v_twice (cairo_t *cr, int width, int height)
  {
!     cairo_move_to (cr, 0, 0);
!     cairo_rel_line_to (cr, width / 2, height / 2);
!     cairo_rel_line_to (cr, width / 2, - height / 2);
  
!     cairo_save (cr);
!     cairo_stroke (cr);
!     cairo_restore (cr);
  
!     cairo_save (cr);
      {
! 	cairo_set_line_width (cr, 2.0);
! 	cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
! 	cairo_set_rgb_color (cr, 1, 1, 1);
! 	cairo_stroke (cr);
      }
!     cairo_restore (cr);
  
!     cairo_new_path (cr);
  }
  
  void
! draw_caps_joins (cairo_t *cr, int width, int height)
  {
      int line_width = height / 12 & (~1);
  
!     cairo_set_line_width (cr, line_width);
!     cairo_set_rgb_color (cr, 0, 0, 0);
  
!     cairo_translate (cr, line_width, line_width);
      width -= 2 *line_width;
  
!     cairo_set_line_join (cr, CAIRO_LINE_JOIN_BEVEL);
!     cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
!     stroke_v_twice (cr, width, height);
  
!     cairo_translate (cr, 0, height / 4 - line_width);
!     cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
!     cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
!     stroke_v_twice (cr, width, height);
  
!     cairo_translate (cr, 0, height / 4 - line_width);
!     cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
!     cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
!     stroke_v_twice (cr, width, height);
  }
  

Index: hering.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/hering.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/hering.c	18 Aug 2003 18:11:38 -0000	1.1
--- b/hering.c	11 May 2004 14:52:19 -0000	1.2
***************
*** 32,36 ****
  
  void
! draw_hering (cairo_t *ct, int width, int height);
  
  #define WIDTH 300
--- 32,36 ----
  
  void
! draw_hering (cairo_t *cr, int width, int height);
  
  #define WIDTH 300
***************
*** 43,62 ****
  main (void)
  {
!     cairo_t *ct;
  
!     ct = cairo_create ();
  
!     cairo_set_target_image (ct, image, CAIRO_FORMAT_ARGB32,
  		      WIDTH, HEIGHT, STRIDE);
  
!     cairo_rectangle (ct, 0, 0, WIDTH, HEIGHT);
!     cairo_set_rgb_color (ct, 1, 1, 1);
!     cairo_fill (ct);
  
!     draw_hering (ct, WIDTH, HEIGHT);
  
      write_png_argb32 (image, "hering.png", WIDTH, HEIGHT, STRIDE);
  
!     cairo_destroy (ct);
  
      return 0;
--- 43,62 ----
  main (void)
  {
!     cairo_t *cr;
  
!     cr = cairo_create ();
  
!     cairo_set_target_image (cr, image, CAIRO_FORMAT_ARGB32,
  		      WIDTH, HEIGHT, STRIDE);
  
!     cairo_rectangle (cr, 0, 0, WIDTH, HEIGHT);
!     cairo_set_rgb_color (cr, 1, 1, 1);
!     cairo_fill (cr);
  
!     draw_hering (cr, WIDTH, HEIGHT);
  
      write_png_argb32 (image, "hering.png", WIDTH, HEIGHT, STRIDE);
  
!     cairo_destroy (cr);
  
      return 0;
***************
*** 64,68 ****
  
  void
! draw_hering (cairo_t *ct, int width, int height)
  {
  #define LINES 32
--- 64,68 ----
  
  void
! draw_hering (cairo_t *cr, int width, int height)
  {
  #define LINES 32
***************
*** 72,102 ****
      int i;
  
!     cairo_set_rgb_color (ct, 0, 0, 0);
!     cairo_set_line_width (ct, 2.0);
  
!     cairo_save (ct);
      {
! 	cairo_translate (ct, width / 2, height / 2);
! 	cairo_rotate (ct, MAX_THETA);
  	
  	for (i=0; i < LINES; i++) {
! 	    cairo_move_to (ct, -2 * width, 0);
! 	    cairo_line_to (ct, 2 * width, 0);
! 	    cairo_stroke (ct);
  	    
! 	    cairo_rotate (ct, - THETA_INC);
  	}
      }
!     cairo_restore (ct);
  
!     cairo_set_line_width (ct, 6);
!     cairo_set_rgb_color (ct, 1, 0, 0);
  
!     cairo_move_to (ct, width / 4, 0);
!     cairo_rel_line_to (ct, 0, height);
!     cairo_stroke (ct);
  
!     cairo_move_to (ct, 3 * width / 4, 0);
!     cairo_rel_line_to (ct, 0, height);
!     cairo_stroke (ct);
  }
--- 72,102 ----
      int i;
  
!     cairo_set_rgb_color (cr, 0, 0, 0);
!     cairo_set_line_width (cr, 2.0);
  
!     cairo_save (cr);
      {
! 	cairo_translate (cr, width / 2, height / 2);
! 	cairo_rotate (cr, MAX_THETA);
  	
  	for (i=0; i < LINES; i++) {
! 	    cairo_move_to (cr, -2 * width, 0);
! 	    cairo_line_to (cr, 2 * width, 0);
! 	    cairo_stroke (cr);
  	    
! 	    cairo_rotate (cr, - THETA_INC);
  	}
      }
!     cairo_restore (cr);
  
!     cairo_set_line_width (cr, 6);
!     cairo_set_rgb_color (cr, 1, 0, 0);
  
!     cairo_move_to (cr, width / 4, 0);
!     cairo_rel_line_to (cr, 0, height);
!     cairo_stroke (cr);
  
!     cairo_move_to (cr, 3 * width / 4, 0);
!     cairo_rel_line_to (cr, 0, height);
!     cairo_stroke (cr);
  }

Index: outline.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/outline.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** a/outline.c	6 Apr 2004 20:08:20 -0000	1.4
--- b/outline.c	11 May 2004 14:52:19 -0000	1.5
***************
*** 31,47 ****
  
  void
! draw_outlines (cairo_t *ct, int surface_width, int surface_height);
  
  void
! draw_flat (cairo_t *ct, double width, double height);
  
  void
! draw_tent (cairo_t *ct, double width, double height);
  
  void
! draw_cylinder (cairo_t *ct, double width, double height);
  
  cairo_pattern_t *
! create_gradient (cairo_t *ct, double width, double height);
  
  #define WIDTH 750
--- 31,47 ----
  
  void
! draw_outlines (cairo_t *cr, int surface_width, int surface_height);
  
  void
! draw_flat (cairo_t *cr, double width, double height);
  
  void
! draw_tent (cairo_t *cr, double width, double height);
  
  void
! draw_cylinder (cairo_t *cr, double width, double height);
  
  cairo_pattern_t *
! create_gradient (cairo_t *cr, double width, double height);
  
  #define WIDTH 750
***************
*** 54,73 ****
  main (void)
  {
!     cairo_t *ct;
  
!     ct = cairo_create ();
  
!     cairo_set_target_image (ct, image, CAIRO_FORMAT_ARGB32,
  		      WIDTH, HEIGHT, STRIDE);
  
!     cairo_rectangle (ct, 0, 0, WIDTH, HEIGHT);
!     cairo_set_rgb_color (ct, 1, 1, 1);
!     cairo_fill (ct);
  
!     draw_outlines (ct, WIDTH, HEIGHT);
  
      write_png_argb32 (image, "outline.png", WIDTH, HEIGHT, STRIDE);
  
!     cairo_destroy (ct);
  
      return 0;
--- 54,73 ----
  main (void)
  {
!     cairo_t *cr;
  
!     cr = cairo_create ();
  
!     cairo_set_target_image (cr, image, CAIRO_FORMAT_ARGB32,
  		      WIDTH, HEIGHT, STRIDE);
  
!     cairo_rectangle (cr, 0, 0, WIDTH, HEIGHT);
!     cairo_set_rgb_color (cr, 1, 1, 1);
!     cairo_fill (cr);
  
!     draw_outlines (cr, WIDTH, HEIGHT);
  
      write_png_argb32 (image, "outline.png", WIDTH, HEIGHT, STRIDE);
  
!     cairo_destroy (cr);
  
      return 0;
***************
*** 75,79 ****
  
  cairo_pattern_t *
! create_gradient (cairo_t *ct, double width, double height)
  {
      cairo_surface_t *gradient;
--- 75,79 ----
  
  cairo_pattern_t *
! create_gradient (cairo_t *cr, double width, double height)
  {
      cairo_surface_t *gradient;
***************
*** 81,104 ****
      cairo_pattern_t *gradient_pattern;
  
!     cairo_save (ct);
  
!     gradient = cairo_surface_create_similar (cairo_current_target_surface (ct),
  					     CAIRO_FORMAT_ARGB32,
  					     3, 2);
!     cairo_set_target_surface (ct, gradient);
  
!     cairo_set_rgb_color (ct, 0, 0, 0);
!     cairo_rectangle (ct, 0, 0, 1, 2);
!     cairo_fill (ct);
  
!     cairo_set_rgb_color (ct, 1, 1, 1);
!     cairo_rectangle (ct, 1, 0, 1, 2);
!     cairo_fill (ct);
  
!     cairo_set_rgb_color (ct, 0, 0, 0);
!     cairo_rectangle (ct, 2, 0, 1, 2);
!     cairo_fill (ct);
  
!     cairo_restore (ct);
  
      matrix = cairo_matrix_create ();
--- 81,104 ----
      cairo_pattern_t *gradient_pattern;
  
!     cairo_save (cr);
  
!     gradient = cairo_surface_create_similar (cairo_current_target_surface (cr),
  					     CAIRO_FORMAT_ARGB32,
  					     3, 2);
!     cairo_set_target_surface (cr, gradient);
  
!     cairo_set_rgb_color (cr, 0, 0, 0);
!     cairo_rectangle (cr, 0, 0, 1, 2);
!     cairo_fill (cr);
  
!     cairo_set_rgb_color (cr, 1, 1, 1);
!     cairo_rectangle (cr, 1, 0, 1, 2);
!     cairo_fill (cr);
  
!     cairo_set_rgb_color (cr, 0, 0, 0);
!     cairo_rectangle (cr, 2, 0, 1, 2);
!     cairo_fill (cr);
  
!     cairo_restore (cr);
  
      matrix = cairo_matrix_create ();
***************
*** 117,121 ****
  
  void
! draw_outlines (cairo_t *ct, int surface_width, int surface_height)
  {
      cairo_pattern_t *gradient;
--- 117,121 ----
  
  void
! draw_outlines (cairo_t *cr, int surface_width, int surface_height)
  {
      cairo_pattern_t *gradient;
***************
*** 126,143 ****
      height = surface_height;
  
!     gradient = create_gradient (ct, width, height);
  
!     cairo_set_pattern (ct, gradient);
!     draw_flat (ct, width, height);
  
!     cairo_translate (ct, width + pad, 0);
!     cairo_set_pattern (ct, gradient);
!     draw_tent (ct, width, height);
  
!     cairo_translate (ct, width + pad, 0);
!     cairo_set_pattern (ct, gradient);
!     draw_cylinder (ct, width, height);
  
!     cairo_restore (ct);
  
      cairo_pattern_destroy (gradient);
--- 126,143 ----
      height = surface_height;
  
!     gradient = create_gradient (cr, width, height);
  
!     cairo_set_pattern (cr, gradient);
!     draw_flat (cr, width, height);
  
!     cairo_translate (cr, width + pad, 0);
!     cairo_set_pattern (cr, gradient);
!     draw_tent (cr, width, height);
  
!     cairo_translate (cr, width + pad, 0);
!     cairo_set_pattern (cr, gradient);
!     draw_cylinder (cr, width, height);
  
!     cairo_restore (cr);
  
      cairo_pattern_destroy (gradient);
***************
*** 145,190 ****
  
  void
! draw_flat (cairo_t *ct, double width, double height)
  {
      double hwidth = width / 2.0;
  
!     cairo_rectangle (ct, 0, hwidth, width, height - hwidth);
  
!     cairo_fill (ct);
  }
  
  void
! draw_tent (cairo_t *ct, double width, double height)
  {
      double hwidth = width / 2.0;
  
!     cairo_move_to    (ct,       0,  hwidth);
!     cairo_rel_line_to (ct,  hwidth, -hwidth);
!     cairo_rel_line_to (ct,  hwidth,  hwidth);
!     cairo_rel_line_to (ct,       0,  height - hwidth);
!     cairo_rel_line_to (ct, -hwidth, -hwidth);
!     cairo_rel_line_to (ct, -hwidth,  hwidth);
!     cairo_close_path (ct);
  
!     cairo_fill (ct);
  }
  
  void
! draw_cylinder (cairo_t *ct, double width, double height)
  {
      double hwidth = width / 2.0;
  
!     cairo_move_to (ct, 0, hwidth);
!     cairo_rel_curve_to (ct,
  		      0, -hwidth,
  		  width, -hwidth,
  		  width, 0);
!     cairo_rel_line_to (ct, 0, height - hwidth);
!     cairo_rel_curve_to (ct,
  		       0, -hwidth,
  		  -width, -hwidth,
  		  -width, 0);
!     cairo_close_path (ct);
  
!     cairo_fill (ct);
  }
--- 145,190 ----
  
  void
! draw_flat (cairo_t *cr, double width, double height)
  {
      double hwidth = width / 2.0;
  
!     cairo_rectangle (cr, 0, hwidth, width, height - hwidth);
  
!     cairo_fill (cr);
  }
  
  void
! draw_tent (cairo_t *cr, double width, double height)
  {
      double hwidth = width / 2.0;
  
!     cairo_move_to    (cr,       0,  hwidth);
!     cairo_rel_line_to (cr,  hwidth, -hwidth);
!     cairo_rel_line_to (cr,  hwidth,  hwidth);
!     cairo_rel_line_to (cr,       0,  height - hwidth);
!     cairo_rel_line_to (cr, -hwidth, -hwidth);
!     cairo_rel_line_to (cr, -hwidth,  hwidth);
!     cairo_close_path (cr);
  
!     cairo_fill (cr);
  }
  
  void
! draw_cylinder (cairo_t *cr, double width, double height)
  {
      double hwidth = width / 2.0;
  
!     cairo_move_to (cr, 0, hwidth);
!     cairo_rel_curve_to (cr,
  		      0, -hwidth,
  		  width, -hwidth,
  		  width, 0);
!     cairo_rel_line_to (cr, 0, height - hwidth);
!     cairo_rel_curve_to (cr,
  		       0, -hwidth,
  		  -width, -hwidth,
  		  -width, 0);
!     cairo_close_path (cr);
  
!     cairo_fill (cr);
  }

Index: spiral.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/spiral.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/spiral.c	18 Aug 2003 18:11:38 -0000	1.1
--- b/spiral.c	11 May 2004 14:52:19 -0000	1.2
***************
*** 31,35 ****
  
  void
! draw_spiral (cairo_t *ct, int width, int height);
  
  #define WIDTH 600
--- 31,35 ----
  
  void
! draw_spiral (cairo_t *cr, int width, int height);
  
  #define WIDTH 600
***************
*** 42,61 ****
  main (void)
  {
!     cairo_t *ct;
  
!     ct = cairo_create ();
  
!     cairo_set_target_image (ct, image, CAIRO_FORMAT_ARGB32,
  		      WIDTH, HEIGHT, STRIDE);
  
!     cairo_rectangle (ct, 0, 0, WIDTH, HEIGHT);
!     cairo_set_rgb_color (ct, 1, 1, 1);
!     cairo_fill (ct);
  
!     draw_spiral (ct, WIDTH, HEIGHT);
  
      write_png_argb32 (image, "spiral.png", WIDTH, HEIGHT, STRIDE);
  
!     cairo_destroy (ct);
  
      return 0;
--- 42,61 ----
  main (void)
  {
!     cairo_t *cr;
  
!     cr = cairo_create ();
  
!     cairo_set_target_image (cr, image, CAIRO_FORMAT_ARGB32,
  		      WIDTH, HEIGHT, STRIDE);
  
!     cairo_rectangle (cr, 0, 0, WIDTH, HEIGHT);
!     cairo_set_rgb_color (cr, 1, 1, 1);
!     cairo_fill (cr);
  
!     draw_spiral (cr, WIDTH, HEIGHT);
  
      write_png_argb32 (image, "spiral.png", WIDTH, HEIGHT, STRIDE);
  
!     cairo_destroy (cr);
  
      return 0;
***************
*** 63,67 ****
  
  void
! draw_spiral (cairo_t *ct, int width, int height)
  {
      int wd = .02 * width;
--- 63,67 ----
  
  void
! draw_spiral (cairo_t *cr, int width, int height)
  {
      int wd = .02 * width;
***************
*** 72,84 ****
      height -= 2;
  
!     cairo_move_to (ct, width + 1, 1-hd);
      for (i=0; i < 9; i++) {
! 	cairo_rel_line_to (ct, 0, height - hd * (2 * i - 1));
! 	cairo_rel_line_to (ct, - (width - wd * (2 *i)), 0);
! 	cairo_rel_line_to (ct, 0, - (height - hd * (2*i)));
! 	cairo_rel_line_to (ct, width - wd * (2 * i + 1), 0);
      }
  
!     cairo_set_rgb_color (ct, 0, 0, 1);
!     cairo_stroke (ct);
  }
--- 72,84 ----
      height -= 2;
  
!     cairo_move_to (cr, width + 1, 1-hd);
      for (i=0; i < 9; i++) {
! 	cairo_rel_line_to (cr, 0, height - hd * (2 * i - 1));
! 	cairo_rel_line_to (cr, - (width - wd * (2 *i)), 0);
! 	cairo_rel_line_to (cr, 0, - (height - hd * (2*i)));
! 	cairo_rel_line_to (cr, width - wd * (2 * i + 1), 0);
      }
  
!     cairo_set_rgb_color (cr, 0, 0, 1);
!     cairo_stroke (cr);
  }

Index: splines_tolerance.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/splines_tolerance.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/splines_tolerance.c	18 Aug 2003 18:11:38 -0000	1.1
--- b/splines_tolerance.c	11 May 2004 14:52:19 -0000	1.2
***************
*** 31,38 ****
  
  void
! draw_spline (cairo_t *ct, double height);
  
  void
! draw_splines (cairo_t *ct, int width, int height);
  
  #define WIDTH 600
--- 31,38 ----
  
  void
! draw_spline (cairo_t *cr, double height);
  
  void
! draw_splines (cairo_t *cr, int width, int height);
  
  #define WIDTH 600
***************
*** 45,64 ****
  main (void)
  {
!     cairo_t *ct;
  
!     ct = cairo_create ();
  
!     cairo_set_target_image (ct, image, CAIRO_FORMAT_ARGB32,
  		      WIDTH, HEIGHT, STRIDE);
  
!     cairo_rectangle (ct, 0, 0, WIDTH, HEIGHT);
!     cairo_set_rgb_color (ct, 1, 1, 1);
!     cairo_fill (ct);
  
!     draw_splines (ct, WIDTH, HEIGHT);
  
      write_png_argb32 (image, "splines_tolerance.png", WIDTH, HEIGHT, STRIDE);
  
!     cairo_destroy (ct);
  
      return 0;
--- 45,64 ----
  main (void)
  {
!     cairo_t *cr;
  
!     cr = cairo_create ();
  
!     cairo_set_target_image (cr, image, CAIRO_FORMAT_ARGB32,
  		      WIDTH, HEIGHT, STRIDE);
  
!     cairo_rectangle (cr, 0, 0, WIDTH, HEIGHT);
!     cairo_set_rgb_color (cr, 1, 1, 1);
!     cairo_fill (cr);
  
!     draw_splines (cr, WIDTH, HEIGHT);
  
      write_png_argb32 (image, "splines_tolerance.png", WIDTH, HEIGHT, STRIDE);
  
!     cairo_destroy (cr);
  
      return 0;
***************
*** 66,82 ****
  
  void
! draw_spline (cairo_t *ct, double height)
  {
!     cairo_move_to (ct, 0, .1 * height);
      height = .8 * height;
!     cairo_rel_curve_to (ct,
  		  -height/2, height/2,
  		  height/2, height/2,
  		  0, height);
!     cairo_stroke (ct);
  }
  
  void
! draw_splines (cairo_t *ct, int width, int height)
  {
      int i;
--- 66,82 ----
  
  void
! draw_spline (cairo_t *cr, double height)
  {
!     cairo_move_to (cr, 0, .1 * height);
      height = .8 * height;
!     cairo_rel_curve_to (cr,
  		  -height/2, height/2,
  		  height/2, height/2,
  		  0, height);
!     cairo_stroke (cr);
  }
  
  void
! draw_splines (cairo_t *cr, int width, int height)
  {
      int i;
***************
*** 85,96 ****
      double gap = width / 6;
  
!     cairo_set_rgb_color (ct, 0, 0, 0);
!     cairo_set_line_width (ct, line_width);
  
!     cairo_translate (ct, gap, 0);
      for (i=0; i < 5; i++) {
! 	cairo_set_tolerance (ct, tolerance[i]);
! 	draw_spline (ct, height);
! 	cairo_translate (ct, gap, 0);
      }
  }
--- 85,96 ----
      double gap = width / 6;
  
!     cairo_set_rgb_color (cr, 0, 0, 0);
!     cairo_set_line_width (cr, line_width);
  
!     cairo_translate (cr, gap, 0);
      for (i=0; i < 5; i++) {
! 	cairo_set_tolerance (cr, tolerance[i]);
! 	draw_spline (cr, height);
! 	cairo_translate (cr, gap, 0);
      }
  }

Index: stars.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/stars.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/stars.c	18 Aug 2003 18:11:38 -0000	1.1
--- b/stars.c	11 May 2004 14:52:19 -0000	1.2
***************
*** 32,39 ****
  
  void
! draw_stars (cairo_t *ct, int width, int height);
  
  void
! star_path (cairo_t *ct);
  
  #define WIDTH 600
--- 32,39 ----
  
  void
! draw_stars (cairo_t *cr, int width, int height);
  
  void
! star_path (cairo_t *cr);
  
  #define WIDTH 600
***************
*** 46,65 ****
  main (void)
  {
!     cairo_t *ct;
  
!     ct = cairo_create ();
  
!     cairo_set_target_image (ct, image, CAIRO_FORMAT_ARGB32,
  		      WIDTH, HEIGHT, STRIDE);
  
!     cairo_rectangle (ct, 0, 0, WIDTH, HEIGHT);
!     cairo_set_rgb_color (ct, 1, 1, 1);
!     cairo_fill (ct);
  
!     draw_stars (ct, WIDTH, HEIGHT);
  
      write_png_argb32 (image, "stars.png", WIDTH, HEIGHT, STRIDE);
  
!     cairo_destroy (ct);
  
      return 0;
--- 46,65 ----
  main (void)
  {
!     cairo_t *cr;
  
!     cr = cairo_create ();
  
!     cairo_set_target_image (cr, image, CAIRO_FORMAT_ARGB32,
  		      WIDTH, HEIGHT, STRIDE);
  
!     cairo_rectangle (cr, 0, 0, WIDTH, HEIGHT);
!     cairo_set_rgb_color (cr, 1, 1, 1);
!     cairo_fill (cr);
  
!     draw_stars (cr, WIDTH, HEIGHT);
  
      write_png_argb32 (image, "stars.png", WIDTH, HEIGHT, STRIDE);
  
!     cairo_destroy (cr);
  
      return 0;
***************
*** 67,106 ****
  
  void
! star_path (cairo_t *ct)
  {
      int i;
      double theta = 4 * M_PI / 5.0;
  
!     cairo_move_to (ct, 0, 0);
      for (i=0; i < 4; i++) {
! 	cairo_rel_line_to (ct, 1.0, 0);
! 	cairo_rotate (ct, theta);
      }
!     cairo_close_path (ct);
  }
  
  void
! draw_stars (cairo_t *ct, int width, int height)
  {
!     cairo_set_rgb_color (ct, 0, 0, 0);
  
!     cairo_save (ct);
      {
! 	cairo_translate (ct, 5, height / 2.6);
! 	cairo_scale (ct, height, height);
! 	star_path (ct);
! 	cairo_set_fill_rule (ct, CAIRO_FILL_RULE_WINDING);
! 	cairo_fill (ct);
      }
!     cairo_restore (ct);
  
!     cairo_save (ct);
      {
! 	cairo_translate (ct, width - height - 5, height / 2.6);
! 	cairo_scale (ct, height, height);
! 	star_path (ct);
! 	cairo_set_fill_rule (ct, CAIRO_FILL_RULE_EVEN_ODD);
! 	cairo_fill (ct);
      }
!     cairo_restore (ct);
  }
--- 67,106 ----
  
  void
! star_path (cairo_t *cr)
  {
      int i;
      double theta = 4 * M_PI / 5.0;
  
!     cairo_move_to (cr, 0, 0);
      for (i=0; i < 4; i++) {
! 	cairo_rel_line_to (cr, 1.0, 0);
! 	cairo_rotate (cr, theta);
      }
!     cairo_close_path (cr);
  }
  
  void
! draw_stars (cairo_t *cr, int width, int height)
  {
!     cairo_set_rgb_color (cr, 0, 0, 0);
  
!     cairo_save (cr);
      {
! 	cairo_translate (cr, 5, height / 2.6);
! 	cairo_scale (cr, height, height);
! 	star_path (cr);
! 	cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING);
! 	cairo_fill (cr);
      }
!     cairo_restore (cr);
  
!     cairo_save (cr);
      {
! 	cairo_translate (cr, width - height - 5, height / 2.6);
! 	cairo_scale (cr, height, height);
! 	star_path (cr);
! 	cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
! 	cairo_fill (cr);
      }
!     cairo_restore (cr);
  }





More information about the cairo-commit mailing list