程序我记得是从cairo的官网上找来的,运行的时候发现不是很给力,改动了一下~
/* testimage.c
* Copyright (C) 2005 Red Hat, Inc.
* Based on cairo-demo/X11/cairo-knockout.c
*
* Author: Owen Taylor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
* compile with
* gcc `pkg-config --cflags directfb` `pkg-config --cflags cairo` `pkg-config --libs directfb` `pkg-config --libs cairo` -o testcairo testcairo.c
* Run example
* export DFBARGS=system=sdl;./testcairo
*/
#include <stdio.h>
#include <math.h>
#include <cairo.h>
#include <directfb.h>
#include <cairo-directfb.h>
/* macro for a safe call to DirectFB functions */
#define DFBCHECK(x...) \
{ \
err = x; \
if (err != DFB_OK) { \
fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
DirectFBErrorFatal( #x, err ); \
} \
}
#define G_PI 3.1415926535897932384626433832795028841971693993751
#define G_PI_2 1.5707963267948966192313216916397514420985846996876
#define G_PI_4 0.78539816339744830961566084581987572104929234984378
#define where_am_i() fprintf(stderr,"%s # %i \n",__func__,__LINE__)
static void
oval_path (cairo_t *cr,