[examples]add clip image's rectangle

This commit is contained in:
JianjunJiang 2021-12-06 18:59:18 +08:00
parent 4302a4faf9
commit e1e7ad0a0b
2 changed files with 2 additions and 0 deletions

View File

@ -403,6 +403,8 @@ static void test_image(const char * filename)
cg_rotate(ctx, 45 * M_PI / 180);
cg_scale(ctx, 256.0 / img->width, 256.0 / img->height);
cg_translate(ctx, -0.5 * img->width, -0.5 * img->height);
cg_rectangle(ctx, 0, 0, img->width, img->height);
cg_clip(ctx);
cg_set_source_surface(ctx, img, 0, 0);
cg_paint(ctx);
cg_surface_destroy(img);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 KiB

After

Width:  |  Height:  |  Size: 258 KiB