[cairo-commit] cairo-demo/png Makefile,1.2,1.3 text.c,1.1,1.2

Carl Worth commit at pdx.freedesktop.org
Fri Oct 24 17:51:28 PDT 2003


Committed by: cworth

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

Modified Files:
	Makefile text.c 
Log Message:
Change text to "hello, world".
Fix to generate a .png with transparent background.

Index: Makefile
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Makefile	24 Oct 2003 20:41:50 -0000	1.2
--- Makefile	25 Oct 2003 00:51:26 -0000	1.3
***************
*** 2,8 ****
  
  CFLAGS=-g -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls `pkg-config --cflags cairo`
! LDFLAGS=`pkg-config --libs cairo` write_png.o -lpng
  
! all: write_png.o ${EXAMPLES}
  
  write_png.o: write_png.c write_png.h
--- 2,10 ----
  
  CFLAGS=-g -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls `pkg-config --cflags cairo`
! LDFLAGS=`pkg-config --libs cairo` -lpng
  
! all: ${EXAMPLES}
! 
! ${EXAMPLES}: write_png.o
  
  write_png.o: write_png.c write_png.h

Index: text.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/text.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** text.c	24 Oct 2003 20:41:50 -0000	1.1
--- text.c	25 Oct 2003 00:51:26 -0000	1.2
***************
*** 31,35 ****
  #include "write_png.h"
  
! #define WIDTH 500
  #define HEIGHT 20
  #define STRIDE (WIDTH * 4)
--- 31,35 ----
  #include "write_png.h"
  
! #define WIDTH 80
  #define HEIGHT 20
  #define STRIDE (WIDTH * 4)
***************
*** 47,59 ****
  			    WIDTH, HEIGHT, STRIDE);
  
!     cairo_rectangle (cr, 0, 0, WIDTH, HEIGHT);
!     cairo_set_rgb_color (cr, 1, 1, 1);
!     cairo_fill (cr);
  
!     cairo_set_rgb_color (cr, 0, 0, 0);
  
      cairo_scale_font (cr, 10);
      cairo_move_to (cr, 10, 15);
!     cairo_show_text (cr, "S"); /* Hello World. ABCDEFGHIJKLMOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); */
  
      write_png_argb32 (image, "text.png", WIDTH, HEIGHT, STRIDE);
--- 47,62 ----
  			    WIDTH, HEIGHT, STRIDE);
  
!     cairo_set_rgb_color (cr, 0., 0., 0.);
  
!     cairo_save (cr);
!     cairo_rectangle (cr, 0., 0., WIDTH, HEIGHT);
!     cairo_set_alpha (cr, 0.);
!     cairo_set_operator (cr, CAIRO_OPERATOR_SRC);
!     cairo_fill (cr);
!     cairo_restore (cr);
  
      cairo_scale_font (cr, 10);
      cairo_move_to (cr, 10, 15);
!     cairo_show_text (cr, "hello, world");
  
      write_png_argb32 (image, "text.png", WIDTH, HEIGHT, STRIDE);





More information about the cairo-commit mailing list