10 RImage
*img
, *tile
, *new, *mini
, *tiled
;
13 void main(int argc
, char **argv
)
15 RContextAttributes attr
;
19 puts("You must supply t,p or x as the file type to load");
20 puts("t is tiff, p is png and x is xpm");
27 else if (argv
[1][0]=='p')
32 dpy
= XOpenDisplay("");
34 puts("cant open display");
37 win
= XCreateSimpleWindow(dpy
, DefaultRootWindow(dpy
), 10, 10, 250, 250,
41 attr
.flags
= RC_RenderMode
| RC_ColorsPerChannel
| RC_DefaultVisual
;
43 attr
.render_mode
= RM_DITHER
;
44 attr
.colors_per_channel
= 4;
45 ctx
= RCreateContext(dpy
, DefaultScreen(dpy
), &attr
);
48 img
= RLoadImage(ctx
, "ballot_box.tiff", 0);
52 img
= RLoadImage(ctx
, "test.png", 0);
56 img
= RLoadImage(ctx
, "ballot_box.xpm", 0);
63 new = RLoadImage(ctx
, "tile.xpm", 0);
68 RCombineArea(new, img
, 0, 0, img
->width
, img
->height
, 8, 8);
69 RConvertImage(ctx
, new, &pix
);
70 XCopyArea(dpy
, pix
, win
, ctx
->copy_gc
, 0, 0, new->width
, new->height
,
73 mini
= RScaleImage(new, 20, 20);
74 RConvertImage(ctx
, mini
, &pix
);
75 XCopyArea(dpy
, pix
, win
, ctx
->copy_gc
, 0, 0, 20, 20,
76 new->width
, new->height
);
78 tiled
= RMakeTiledImage(img
, 160, 160);
79 RConvertImage(ctx
, tiled
, &pix
);
80 XCopyArea(dpy
, pix
, win
, ctx
->copy_gc
, 0, 0, 160, 160,
81 new->width
+mini
->width
, new->height
+mini
->height
);