网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
02月04日漏签0天
c语言吧 关注:801,836贴子:4,375,994
  • 看贴

  • 图片

  • 吧主推荐

  • 视频

  • 游戏

  • 首页 上一页 1 2 3 下一页 尾页
  • 35回复贴,共3页
  • ,跳到 页  
<<返回c语言吧
>0< 加载中...

回复:Cairo & C语言 & GTK+3.0 & Linux

  • 取消只看楼主
  • 收藏

  • 回复
  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo015.c 贝塞尔曲线 Bézier Curve */
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
void df_draw_brush (struct df_canvas const *pcanvas)
{
cairo_t *cr;
cairo_matrix_t matrix;
cr = cairo_create (surface);
cairo_matrix_init (&matrix,
100,100, /* A点 */
100,300, /* B点 */
424,300); /* C点 */
cairo_set_line_width (cr, 20);
cairo_set_source_rgba (cr, 0.1, 0.1, 0.9, 0.8);
cairo_move_to (cr, matrix.xx, matrix.yx); /* ABC */
cairo_curve_to (cr, matrix.xx, matrix.yx, matrix.xy, matrix.yy, matrix.x0, matrix.y0);
cairo_move_to (cr, matrix.xy, matrix.yy + 300); /* BCA */
cairo_curve_to (cr, matrix.xy, matrix.yy + 300, matrix.x0, matrix.y0 + 300, matrix.xx, matrix.yx + 300);
cairo_move_to (cr, matrix.x0, matrix.y0 + 500); /* CAB */
cairo_curve_to (cr, matrix.x0, matrix.y0 + 500, matrix.xx, matrix.yx + 500, matrix.xy, matrix.yy + 500);
cairo_stroke (cr);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png",28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 900.0;
df_init_canvas (canvas);
df_draw_brush (canvas);
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo016.c 贝塞尔曲线 Bézier Curve */
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
void df_draw_brush (struct df_canvas const *pcanvas)
{
cairo_t *cr;
double x0, y0, x1, y1, x2, y2, x3, y3;
cr = cairo_create (surface);
x0 = 100; y0 = 100; /* A点 */
x1 = 100; y1 = 300; /* B点 */
x2 = 424; y2 = 300; /* C点 */
x3 = 424; y3 = 100; /* D点 */
cairo_set_line_width (cr, 20);
cairo_set_source_rgba (cr, 0.1, 0.1, 0.9, 0.8);
/* 贝塞尔三次曲线 ABCD */
cairo_move_to (cr, x0, y0);
cairo_curve_to (cr, x1, y1, x2, y2, x3, y3);
/* 贝塞尔三次曲线 ABDC */
cairo_move_to (cr, x0, y0 + 300);
cairo_curve_to (cr, x1, y1 + 300, x3, y3 + 300, x2, y2 + 300);
/* 贝塞尔三次曲线 ADBC */
cairo_move_to (cr, x0, y0 + 500);
cairo_curve_to (cr, x3, y3 + 500, x1, y1 + 500, x2, y2 + 500);
cairo_stroke (cr);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png",28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 900.0;
df_init_canvas (canvas);
df_draw_brush (canvas);
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


2026-02-04 06:04:12
广告
不感兴趣
开通SVIP免广告
  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo017.c 贝塞尔曲线 Bézier Curve */
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
struct df_point
{
double x;
double y;
};
void df_draw_brush (struct df_canvas const *pcanvas)
{
cairo_t *cr;
int i;
struct df_point p[10] = {
{550.0, 100.0}, /* A点 */
{50.0, 100.0}, /* B点 */
{50.0, 800.0}, /* C点 */
{550.0, 800.0}, /* D点 */
{350.0, 800.0}, /* E点 */
{350.0, 450.0}, /* F点 */
{550.0, 450.0}, /* G点 */
{350.0, 450.0}, /* H点 */
{350.0, 100.0}, /* I点 */
{550.0, 100.0} /* J点 */
};
cr = cairo_create (surface);
cairo_set_line_width (cr, 20);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_BEVEL);
/* 三条曲线ABCD,DEFG,GHIJ 耳:)*/
cairo_move_to (cr, p[0].x, p[0].y);
for (i = 0; i < 7; i += 3)
{
cairo_curve_to (cr, p[i + 1].x, p[i + 1].y, p[i + 2].x, p[i + 2].y, p[i + 3].x, p[i + 3].y);
}
cairo_stroke (cr);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png",28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 900.0;
df_init_canvas (canvas);
df_draw_brush (canvas);
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo018.c 贝塞尔曲线 Bézier Curve */
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
void df_draw_brush (struct df_canvas const *pcanvas)
{
cairo_t *cr;
double dashes [] = {50.0, 10.0, 10.0, 10.0};
int ndash = sizeof (dashes) / sizeof (dashes[0]);
double offset = -5.0;
cr = cairo_create (surface);
cairo_set_dash (cr, dashes, ndash, offset); /* 设置虚线 */
cairo_set_line_width (cr, 10);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_BEVEL);
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8);
cairo_move_to (cr, 500.0, 300.0);
cairo_line_to (cr, 100.0, 300.0);
/* 以(100,300)为圆点,画曲线 */
cairo_rel_curve_to (cr, 100.0, -124.0, 224.0, -124.0, 400.0, -200.0);
cairo_stroke (cr);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png",28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 370.0;
df_init_canvas (canvas);
df_draw_brush (canvas);
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo025.c 模式 cairo_mesh_pattern_line_to
* C1 Side 1 C2
* +---------------+
* | |
* | P1 P2 |
* | |
* Side 0 | | Side 2
* | |
* | |
* | P0 P3 |
* | |
* +---------------+
* C0 Side 3 C3
*/
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
void df_draw_brush (struct df_canvas const *pcanvas)
{
cairo_t *cr;
cairo_pattern_t *pat;
cr = cairo_create (surface);
pat = cairo_pattern_create_mesh();
cairo_set_source_rgba (cr, 0.1, 0.1, 0.1, 0.9);
/* 第一张图 黄色直线 */
cairo_mesh_pattern_begin_patch (pat);
cairo_mesh_pattern_move_to (pat, 150, 80);
cairo_mesh_pattern_line_to (pat, 500, 80);
cairo_mesh_pattern_set_corner_color_rgba (pat, 0, 1, 1, 0, 0.9); /* side 0*/
cairo_mesh_pattern_end_patch (pat);
cairo_rectangle (cr, 100, 60, 400, 40); /* 黑色四边形剪切路径 */
cairo_fill_preserve (cr);
/* 第二张图 */
cairo_mesh_pattern_begin_patch (pat);
cairo_mesh_pattern_move_to (pat, 300, 300);
cairo_mesh_pattern_line_to (pat, 100, 200);
cairo_mesh_pattern_line_to (pat, 500, 200);
cairo_mesh_pattern_set_corner_color_rgba (pat, 0, 1, 0, 0, 0.9); /* 红色 */
cairo_mesh_pattern_end_patch (pat);
cairo_rectangle (cr, 100, 180, 400, 150);
cairo_fill_preserve (cr);
/* 第三张图 */
cairo_mesh_pattern_begin_patch (pat);
cairo_mesh_pattern_move_to (pat, 300, 500);
cairo_mesh_pattern_line_to (pat, 100, 400);
cairo_mesh_pattern_line_to (pat, 500, 400);
cairo_mesh_pattern_set_corner_color_rgba (pat, 0, 1, 0, 0, 0.9); /* 红色 c0 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 1, 0, 1, 0, 0.9); /* 绿色 c1 */
cairo_mesh_pattern_end_patch (pat);
cairo_rectangle (cr, 100, 380, 400, 150);
cairo_fill_preserve (cr);
/* 第四张图 */
cairo_mesh_pattern_begin_patch (pat);
cairo_mesh_pattern_move_to (pat, 300, 700);
cairo_mesh_pattern_line_to (pat, 100, 600);
cairo_mesh_pattern_line_to (pat, 500, 600);
cairo_mesh_pattern_set_corner_color_rgba (pat, 0, 1, 0, 0, 0.9); /* 红色 c0 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 2, 0, 1, 0, 0.9); /* 绿色 c2 */
cairo_mesh_pattern_end_patch (pat);
cairo_rectangle (cr, 100, 580, 400, 150);
cairo_fill_preserve (cr);
/* 第五张图 */
cairo_mesh_pattern_begin_patch (pat);
cairo_mesh_pattern_move_to (pat, 300, 900);
cairo_mesh_pattern_line_to (pat, 100, 800);
cairo_mesh_pattern_line_to (pat, 500, 800);
cairo_mesh_pattern_set_corner_color_rgba (pat, 0, 1, 0, 0, 0.9); /* 红色 c0 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 3, 0, 1, 0, 0.9); /* 绿色 c3 */
cairo_mesh_pattern_end_patch (pat);
cairo_rectangle (cr, 100, 780, 400, 150);
cairo_fill_preserve (cr);
/* 第六张图 */
cairo_mesh_pattern_begin_patch (pat);
cairo_mesh_pattern_move_to (pat, 300, 1100);
cairo_mesh_pattern_line_to (pat, 100, 1000);
cairo_mesh_pattern_line_to (pat, 500, 1000);
cairo_mesh_pattern_set_corner_color_rgba (pat, 1, 1, 0, 0, 0.9); /* 红色 c1 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 2, 0, 1, 0, 0.9); /* 绿色 c2 */
cairo_mesh_pattern_end_patch (pat);
cairo_rectangle (cr, 100, 980, 400, 150);
cairo_fill_preserve (cr);
/* 第七张图 */
cairo_mesh_pattern_begin_patch (pat);
cairo_mesh_pattern_move_to (pat, 300, 1300);
cairo_mesh_pattern_line_to (pat, 100, 1200);
cairo_mesh_pattern_line_to (pat, 500, 1200);
cairo_mesh_pattern_set_corner_color_rgba (pat, 1, 1, 0, 0, 0.9); /* 红色 c1 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 3, 0, 1, 0, 0.9); /* 绿色 c3 */
cairo_mesh_pattern_end_patch (pat);
cairo_rectangle (cr, 100, 1180, 400, 150);
cairo_fill_preserve (cr);
cairo_set_source (cr, pat);
cairo_fill (cr);
cairo_stroke (cr);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_pattern_destroy (pat);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png",28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 1400.0;
df_init_canvas (canvas);
df_draw_brush (canvas);
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo026.c 模式 cairo_mesh_pattern_line_to */
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
void df_draw_brush (struct df_canvas const *pcanvas)
{
cairo_t *cr;
cairo_pattern_t *pat;
cr = cairo_create (surface);
pat = cairo_pattern_create_mesh();
cairo_set_source_rgba (cr, 0.1, 0.1, 0.1, 0.9);
/* 第一张图 */
cairo_mesh_pattern_begin_patch (pat);
cairo_mesh_pattern_move_to (pat, 100, 300); /* 红 */
cairo_mesh_pattern_line_to (pat, 300, 40); /* 绿 */
cairo_mesh_pattern_line_to (pat, 500, 300); /* 蓝 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 0, 1, 0, 0, 0.9); /* 红 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 1, 0, 1, 0, 0.9); /* 绿 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 2, 0, 0, 1, 0.9); /* 蓝 */
cairo_mesh_pattern_end_patch (pat);
cairo_rectangle (cr, 50, 20, 500, 300);
cairo_fill_preserve (cr);
/* 第二张图 */
cairo_mesh_pattern_begin_patch (pat);
cairo_mesh_pattern_move_to (pat, 100, 620); /* 红 */
cairo_mesh_pattern_line_to (pat, 300, 360); /* 绿 */
cairo_mesh_pattern_line_to (pat, 500, 620); /* 蓝 */
cairo_mesh_pattern_line_to (pat, 300, 860); /* 白 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 0, 1, 0, 0, 0.9); /* 红 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 1, 0, 1, 0, 0.9); /* 绿 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 2, 0, 0, 1, 0.9); /* 蓝 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 3, 1, 1, 1, 0.9); /* 白 */
cairo_mesh_pattern_end_patch (pat);
cairo_rectangle (cr, 50, 350, 500, 550);
cairo_fill_preserve (cr);
/* 第三张图 */
cairo_mesh_pattern_begin_patch (pat);
cairo_mesh_pattern_move_to (pat, 100, 1150); /* 红 */
cairo_mesh_pattern_line_to (pat, 200, 950); /* 绿 */
cairo_mesh_pattern_line_to (pat, 520, 1150); /* 蓝 */
cairo_mesh_pattern_line_to (pat, 450, 950); /* 白 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 0, 1, 0, 0, 0.9); /* 红 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 1, 0, 1, 0, 0.9); /* 绿 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 2, 0, 0, 1, 0.9); /* 蓝 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 3, 1, 1, 1, 0.9); /* 白 */
cairo_mesh_pattern_end_patch (pat);
cairo_rectangle (cr, 50, 920, 500, 250);
cairo_fill_preserve (cr);
cairo_set_source (cr, pat);
cairo_fill (cr);
cairo_stroke (cr);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_pattern_destroy (pat);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png",28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 1200.0;
df_init_canvas (canvas);
df_draw_brush (canvas);
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo027.c 模式 cairo_mesh_pattern_curve_to */
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
void df_draw_brush (struct df_canvas const *pcanvas)
{
cairo_t *cr;
cairo_pattern_t *pat;
cr = cairo_create (surface);
pat = cairo_pattern_create_mesh();
cairo_set_source_rgba (cr, 0.1, 0.1, 0.1, 0.9);
/* 第一张图 */
cairo_mesh_pattern_begin_patch (pat);
cairo_mesh_pattern_move_to (pat, 120, 100);
cairo_mesh_pattern_curve_to (pat, 120, 300, 450, 300, 450, 100);
cairo_mesh_pattern_set_corner_color_rgba (pat, 0, 1, 0, 0, 0.9); /* 红 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 1, 0, 1, 0, 0.9); /* 绿 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 2, 0, 0, 1, 0.9); /* 蓝 */
cairo_mesh_pattern_end_patch (pat);
cairo_rectangle (cr, 50, 50, 500, 220);
cairo_fill_preserve (cr);
/* 第二张图 */
cairo_mesh_pattern_begin_patch (pat);
cairo_mesh_pattern_move_to (pat, 120, 370);
cairo_mesh_pattern_curve_to (pat, 120, 570, 450, 570, 450, 370);
cairo_mesh_pattern_curve_to (pat, 240, 570, 240, 670, 120, 770);
cairo_mesh_pattern_set_corner_color_rgba (pat, 0, 1, 0, 0, 0.9); /* 红 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 1, 0, 1, 0, 0.9); /* 绿 */
cairo_mesh_pattern_set_corner_color_rgba (pat, 2, 0, 0, 1, 0.9); /* 蓝 */
cairo_mesh_pattern_end_patch (pat);
cairo_rectangle (cr, 50, 290, 500, 570);
cairo_fill_preserve (cr);
/* */
cairo_set_source (cr, pat);
cairo_fill (cr);
cairo_stroke (cr);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_pattern_destroy (pat);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png",28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 900.0;
df_init_canvas (canvas);
df_draw_brush (canvas);
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo028.c 模式 cairo_mesh_pattern_curve_to */
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
void df_draw_brush (struct df_canvas const *pcanvas)
{
cairo_t *cr;
cairo_pattern_t *pat;
cr = cairo_create (surface);
pat = cairo_pattern_create_mesh();
cairo_set_source_rgba (cr, 0.1, 0.1, 0.1, 0.9);
cairo_translate (cr, 300, 180); /* 设置世界坐标 */
cairo_mesh_pattern_begin_patch (pat);
cairo_mesh_pattern_move_to (pat, 0, 0);
cairo_mesh_pattern_curve_to (pat, 30, -30, 60, 30, 100, 0); /* 上 */
cairo_mesh_pattern_curve_to (pat, 60, 30, 130, 60, 100, 100); /* 右 */
cairo_mesh_pattern_curve_to (pat, 60, 70, 30, 130, 0, 100); /* 下 */
cairo_mesh_pattern_curve_to (pat, 30, 70, -30, 30, 0, 0); /* 左 */
cairo_mesh_pattern_set_corner_color_rgb (pat, 0, 1, 0, 0); /* 红 */
cairo_mesh_pattern_set_corner_color_rgb (pat, 1, 0, 1, 0); /* 绿 */
cairo_mesh_pattern_set_corner_color_rgb (pat, 2, 0, 0, 1); /* 蓝 */
cairo_mesh_pattern_set_corner_color_rgb (pat, 3, 1, 1, 0); /* 黄 */
cairo_mesh_pattern_end_patch (pat);
cairo_rectangle (cr, -250, -150, 500, 320);
cairo_fill_preserve (cr);
cairo_set_source (cr, pat);
cairo_fill (cr);
cairo_stroke (cr);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_pattern_destroy (pat);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png",28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 370.0;
df_init_canvas (canvas);
df_draw_brush (canvas);
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


2026-02-04 05:58:12
广告
不感兴趣
开通SVIP免广告
  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo029.c cairo_pattern_create_linear */
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
void df_draw_brush (struct df_canvas const *pcanvas)
{
cairo_t *cr;
cairo_pattern_t *pat;
double i, k;
int count;
cr = cairo_create (surface);
/* 红黑 */
pat = cairo_pattern_create_linear (80.0, 80.0, 550.0, 350.0); /* 左上至右下 */
count = 1;
for (i = 0.1; i < 1; i += 0.1)
{
k = (count % 2 == 0) ? 0.0 : 1.0;
cairo_pattern_add_color_stop_rgba (pat, i, k, 0.0, 0.0, 0.7);
count++;
}
cairo_rectangle (cr, 80, 50, 450, 153);
cairo_set_source (cr, pat);
cairo_fill (cr);
/* 绿黑 */
pat = cairo_pattern_create_linear (50.0, 250.0, 580.0, 250.0); /* 从左到右 (Y不变)*/
count = 1;
for (i = 0.05; i < 0.95; i += 0.025)
{
k = (count % 2 == 0) ? 0.0 : 1.0;
cairo_pattern_add_color_stop_rgba (pat, i, 0, k, 0.0, 0.7);
count++;
}
cairo_rectangle (cr, 80, 250, 450, 153);
cairo_set_source (cr, pat);
cairo_fill (cr);
/* 黄黑 */
pat = cairo_pattern_create_linear (80.0, 450.0, 80.0, 600.0); /* 从上到下 (X不变) */
cairo_pattern_add_color_stop_rgba (pat, 0.1, 0.0, 0.0, 0.0, 0.7);
cairo_pattern_add_color_stop_rgba (pat, 0.5, 1.0, 1.0, 0.0, 0.7);
cairo_pattern_add_color_stop_rgba (pat, 0.9, 0.0, 0.0, 0.0, 0.7);
cairo_rectangle (cr, 80, 450, 450, 153);
cairo_set_source (cr, pat);
cairo_fill (cr);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png", 28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 660.0;
df_init_canvas (canvas);
df_draw_brush (canvas);
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo030.c 混合操作 cairo_set_operator */
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
static void df_draw_brush (struct df_canvas const *pcanvas, cairo_operator_t op, double height)
{
cairo_t *cr;
cr = cairo_create (surface);
cairo_t *arc_cr, *rect_cr;
cairo_surface_t *arc_surface, *rect_surface;
/* 圆弧-红边黄色填充 */
arc_surface = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, 600, 370);
arc_cr = cairo_create (arc_surface);
cairo_arc (arc_cr, 300, 170, 100, 0, 2 * M_PI);
cairo_set_line_width (arc_cr, 20);
cairo_set_source_rgb (arc_cr, 0.9, 0.0, 0.0);
cairo_stroke_preserve (arc_cr);
cairo_set_source_rgb (arc_cr, 0.9, 0.9, 0.0);
cairo_fill (arc_cr);
/* 四边形 - 黑边蓝色填充 */
rect_surface = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, 600, 370);
rect_cr = cairo_create (rect_surface);
cairo_rectangle (rect_cr, 50, 50, 250, 250);
cairo_set_line_width (rect_cr, 20);
cairo_set_source_rgb (rect_cr, 0.0, 0.0, 0.0);
cairo_stroke_preserve (rect_cr);
cairo_set_source_rgb (rect_cr, 0.0, 0.0, 0.9);
cairo_fill (rect_cr);
/* 混合两个画布内容 */
cairo_set_operator (arc_cr, op); /* 设置混合操作 */
cairo_set_source_surface (arc_cr, rect_surface, 0, 0);
cairo_paint (arc_cr);
cairo_set_source_surface (cr, arc_surface, 0, height);
cairo_paint (cr);
cairo_stroke (cr);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_surface_destroy (arc_surface);
cairo_surface_destroy (rect_surface);
cairo_destroy (arc_cr);
cairo_destroy (rect_cr);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png", 28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 1600.0;
df_init_canvas (canvas);
int i;
cairo_operator_t op[] = {
CAIRO_OPERATOR_SOURCE, /* 忽略目标层 */
CAIRO_OPERATOR_OVER, /* 源在目标上层绘制 */
CAIRO_OPERATOR_IN, /* 留下目标包含的内容 */
CAIRO_OPERATOR_OUT, /* 留下目标不包含的内容 */
CAIRO_OPERATOR_ATOP /* 留下目标和目标包含的源内容 */
};
for (i = 0; i < 5; i++)
{
df_draw_brush (canvas, op[i], i * 300.0);
}
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo031.c 混合操作 cairo_set_operator */
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
static void df_draw_brush (struct df_canvas const *pcanvas, cairo_operator_t op, double height)
{
cairo_t *cr;
cr = cairo_create (surface);
cairo_t *arc_cr, *rect_cr;
cairo_surface_t *arc_surface, *rect_surface;
/* 圆弧-红边黄色填充 */
arc_surface = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, 600, 370);
arc_cr = cairo_create (arc_surface);
cairo_arc (arc_cr, 300, 170, 100, 0, 2 * M_PI);
cairo_set_line_width (arc_cr, 20);
cairo_set_source_rgb (arc_cr, 0.9, 0.0, 0.0);
cairo_stroke_preserve (arc_cr);
cairo_set_source_rgb (arc_cr, 0.9, 0.9, 0.0);
cairo_fill (arc_cr);
/* 四边形 - 黑边蓝色填充 */
rect_surface = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, 600, 370);
rect_cr = cairo_create (rect_surface);
cairo_rectangle (rect_cr, 50, 50, 250, 250);
cairo_set_line_width (rect_cr, 20);
cairo_set_source_rgb (rect_cr, 0.0, 0.0, 0.0);
cairo_stroke_preserve (rect_cr);
cairo_set_source_rgb (rect_cr, 0.0, 0.0, 0.9);
cairo_fill (rect_cr);
/* 混合两个画布内容 */
cairo_set_operator (arc_cr, op); /* 设置混合操作 */
cairo_set_source_surface (arc_cr, rect_surface, 0, 0);
cairo_paint (arc_cr);
cairo_set_source_surface (cr, arc_surface, 0, height);
cairo_paint (cr);
cairo_stroke (cr);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_surface_destroy (arc_surface);
cairo_surface_destroy (rect_surface);
cairo_destroy (arc_cr);
cairo_destroy (rect_cr);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png", 28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 1600.0;
df_init_canvas (canvas);
int i;
cairo_operator_t op[] = {
CAIRO_OPERATOR_DEST, /* 忽略源 */
CAIRO_OPERATOR_DEST_OVER, /* 在源顶层绘制 */
CAIRO_OPERATOR_DEST_IN, /* 留下源包含的内容 */
CAIRO_OPERATOR_DEST_OUT, /* 留下源不包含的内容 */
CAIRO_OPERATOR_DEST_ATOP /* 留下源和源包含的内容 */
};
for (i = 0; i < 5; i++)
{
df_draw_brush (canvas, op[i], i * 300.0);
}
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo032.c 混合操作 cairo_set_operator */
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
static void df_draw_brush (struct df_canvas const *pcanvas, cairo_operator_t op, double height)
{
cairo_t *cr;
cr = cairo_create (surface);
cairo_t *arc_cr, *rect_cr;
cairo_surface_t *arc_surface, *rect_surface;
/* 圆弧-红边黄色填充 */
arc_surface = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, 600, 370);
arc_cr = cairo_create (arc_surface);
cairo_arc (arc_cr, 300, 170, 100, 0, 2 * M_PI);
cairo_set_line_width (arc_cr, 20);
cairo_set_source_rgb (arc_cr, 0.9, 0.0, 0.0);
cairo_stroke_preserve (arc_cr);
cairo_set_source_rgb (arc_cr, 0.9, 0.9, 0.0);
cairo_fill (arc_cr);
/* 四边形 - 黑边蓝色填充 */
rect_surface = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, 600, 370);
rect_cr = cairo_create (rect_surface);
cairo_rectangle (rect_cr, 50, 50, 250, 250);
cairo_set_line_width (rect_cr, 20);
cairo_set_source_rgb (rect_cr, 0.0, 0.0, 0.0);
cairo_stroke_preserve (rect_cr);
cairo_set_source_rgb (rect_cr, 0.0, 0.0, 0.9);
cairo_fill (rect_cr);
/* 混合两个画布内容 */
cairo_set_operator (arc_cr, op); /* 设置混合操作 */
cairo_set_source_surface (arc_cr, rect_surface, 0, 0);
cairo_paint (arc_cr);
cairo_set_source_surface (cr, arc_surface, 0, height);
cairo_paint (cr);
cairo_stroke (cr);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_surface_destroy (arc_surface);
cairo_surface_destroy (rect_surface);
cairo_destroy (arc_cr);
cairo_destroy (rect_cr);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png", 28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 1000.0;
df_init_canvas (canvas);
int i;
cairo_operator_t op[] = {
CAIRO_OPERATOR_XOR,
CAIRO_OPERATOR_ADD,
CAIRO_OPERATOR_SATURATE
};
for (i = 0; i < 3; i++)
{
df_draw_brush (canvas, op[i], i * 300.0);
}
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo033.c 混合操作 cairo_set_operator */
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
static void df_draw_brush (struct df_canvas const *pcanvas, cairo_operator_t op, double height)
{
cairo_t *cr;
cr = cairo_create (surface);
cairo_t *arc_cr, *rect_cr;
cairo_surface_t *arc_surface, *rect_surface;
/* 圆弧-红边黄色填充 */
arc_surface = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, 600, 370);
arc_cr = cairo_create (arc_surface);
cairo_arc (arc_cr, 300, 170, 100, 0, 2 * M_PI);
cairo_set_line_width (arc_cr, 20);
cairo_set_source_rgb (arc_cr, 0.9, 0.0, 0.0);
cairo_stroke_preserve (arc_cr);
cairo_set_source_rgb (arc_cr, 0.9, 0.9, 0.0);
cairo_fill (arc_cr);
/* 四边形 - 黑边蓝色填充 */
rect_surface = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, 600, 370);
rect_cr = cairo_create (rect_surface);
cairo_rectangle (rect_cr, 50, 50, 250, 250);
cairo_set_line_width (rect_cr, 20);
cairo_set_source_rgb (rect_cr, 0.0, 0.0, 0.0);
cairo_stroke_preserve (rect_cr);
cairo_set_source_rgb (rect_cr, 0.0, 0.0, 0.9);
cairo_fill (rect_cr);
/* 混合两个画布内容 */
cairo_set_operator (arc_cr, op); /* 设置混合操作 */
cairo_set_source_surface (arc_cr, rect_surface, 0, 0);
cairo_paint (arc_cr);
cairo_set_source_surface (cr, arc_surface, 0, height);
cairo_paint (cr);
cairo_stroke (cr);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_surface_destroy (arc_surface);
cairo_surface_destroy (rect_surface);
cairo_destroy (arc_cr);
cairo_destroy (rect_cr);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png", 28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 1500.0;
df_init_canvas (canvas);
int i;
cairo_operator_t op[] = {
CAIRO_OPERATOR_MULTIPLY,
CAIRO_OPERATOR_SCREEN,
CAIRO_OPERATOR_OVERLAY,
CAIRO_OPERATOR_DARKEN,
CAIRO_OPERATOR_LIGHTEN
};
for (i = 0; i < 5; i++)
{
df_draw_brush (canvas, op[i], i * 300.0);
}
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo034.c 混合操作 cairo_set_operator */
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
static void df_draw_brush (struct df_canvas const *pcanvas, cairo_operator_t op, double height)
{
cairo_t *cr;
cr = cairo_create (surface);
cairo_t *arc_cr, *rect_cr;
cairo_surface_t *arc_surface, *rect_surface;
/* 圆弧-红边黄色填充 */
arc_surface = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, 600, 370);
arc_cr = cairo_create (arc_surface);
cairo_arc (arc_cr, 300, 170, 100, 0, 2 * M_PI);
cairo_set_line_width (arc_cr, 20);
cairo_set_source_rgb (arc_cr, 0.9, 0.0, 0.0);
cairo_stroke_preserve (arc_cr);
cairo_set_source_rgb (arc_cr, 0.9, 0.9, 0.0);
cairo_fill (arc_cr);
/* 四边形 - 黑边蓝色填充 */
rect_surface = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, 600, 370);
rect_cr = cairo_create (rect_surface);
cairo_rectangle (rect_cr, 50, 50, 250, 250);
cairo_set_line_width (rect_cr, 20);
cairo_set_source_rgb (rect_cr, 0.0, 0.0, 0.0);
cairo_stroke_preserve (rect_cr);
cairo_set_source_rgb (rect_cr, 0.0, 0.0, 0.9);
cairo_fill (rect_cr);
/* 混合两个画布内容 */
cairo_set_operator (arc_cr, op); /* 设置混合操作 */
cairo_set_source_surface (arc_cr, rect_surface, 0, 0);
cairo_paint (arc_cr);
cairo_set_source_surface (cr, arc_surface, 0, height);
cairo_paint (cr);
cairo_stroke (cr);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_surface_destroy (arc_surface);
cairo_surface_destroy (rect_surface);
cairo_destroy (arc_cr);
cairo_destroy (rect_cr);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png", 28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 1500.0;
df_init_canvas (canvas);
int i;
cairo_operator_t op[] = {
CAIRO_OPERATOR_COLOR_DODGE,
CAIRO_OPERATOR_COLOR_BURN,
CAIRO_OPERATOR_HARD_LIGHT,
CAIRO_OPERATOR_SOFT_LIGHT,
CAIRO_OPERATOR_DIFFERENCE,
CAIRO_OPERATOR_EXCLUSION,
CAIRO_OPERATOR_HSL_HUE,
CAIRO_OPERATOR_HSL_SATURATION,
CAIRO_OPERATOR_HSL_COLOR,
CAIRO_OPERATOR_HSL_LUMINOSITY
};
for (i = 0; i < 5; i++)
{
df_draw_brush (canvas, op[i], i * 300.0);
}
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


2026-02-04 05:52:12
广告
不感兴趣
开通SVIP免广告
  • AutoRunAs
  • 麻婆豆腐
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/* cairo035.c 读取旋转图片内容 */
#include <cairo.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
static cairo_surface_t *surface = NULL;
struct df_canvas
{
char filename[28];
int type;
double width;
double height;
};
void df_draw_brush (struct df_canvas const *pcanvas)
{
int w, h;
cairo_surface_t* image;
cairo_t *cr;
cr = cairo_create (surface);
image = cairo_image_surface_create_from_png ("star.png"); /* 读取图片内容 */
w = cairo_image_surface_get_width (image);
h = cairo_image_surface_get_height (image);
cairo_translate (cr, 0.5 * w, 0.5 * h);
cairo_rotate (cr, 18 * M_PI / 180);
cairo_translate (cr, -0.5 * w, -0.5 * h);
cairo_set_source_surface (cr, image, 0, 0);
cairo_paint (cr);
cairo_surface_destroy (image);
cairo_surface_write_to_png (surface, pcanvas -> filename);
cairo_destroy (cr);
}
void df_init_canvas (struct df_canvas const *pcanvas)
{
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) pcanvas -> width, (int) pcanvas -> height);
}
int main (int argc, char *argv[])
{
struct df_canvas *canvas;
canvas = (struct df_canvas*) malloc (sizeof (struct df_canvas));
strncpy(canvas -> filename, "hello.png", 28);
canvas -> type = CAIRO_SURFACE_TYPE_IMAGE;
canvas -> width = 600.0;
canvas -> height = 600.0;
df_init_canvas (canvas);
df_draw_brush (canvas);
free (canvas);
if (surface != NULL) cairo_surface_destroy (surface);
return 0;
}


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 首页 上一页 1 2 3 下一页 尾页
  • 35回复贴,共3页
  • ,跳到 页  
<<返回c语言吧
分享到:
©2026 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示