9 RImage
*img
, *tile
, *new, *mini
, *tiled
;
12 void main(int argc
, char **argv
)
14 RContextAttributes attr
;
18 puts("You must supply t,p or x as the file type to load");
19 puts("t is tiff, p is png and x is xpm");
26 else if (argv
[1][0]=='p')
31 dpy
= XOpenDisplay("");
33 puts("cant open display");
36 win
= XCreateSimpleWindow(dpy
, DefaultRootWindow(dpy
), 10, 10, 250, 250,
40 attr
.flags
= RC_RenderMode
| RC_ColorsPerChannel
| RC_DefaultVisual
;
42 attr
.render_mode
= RM_DITHER
;
43 attr
.colors_per_channel
= 4;
44 ctx
= RCreateContext(dpy
, DefaultScreen(dpy
), &attr
);
47 img
= RLoadImage(ctx
, "ballot_box.tiff", 0);
51 img
= RLoadImage(ctx
, "test.png", 0);
55 img
= RLoadImage(ctx
, "ballot_box.xpm", 0);
59 puts(RMessageForError(RErrorCode
));
62 new = RLoadImage(ctx
, "tile.xpm", 0);
64 puts(RMessageForError(RErrorCode
));
67 RCombineArea(new, img
, 0, 0, img
->width
, img
->height
, 8, 8);
68 RConvertImage(ctx
, new, &pix
);
69 XCopyArea(dpy
, pix
, win
, ctx
->copy_gc
, 0, 0, new->width
, new->height
,
72 mini
= RScaleImage(new, 20, 20);
73 RConvertImage(ctx
, mini
, &pix
);
74 XCopyArea(dpy
, pix
, win
, ctx
->copy_gc
, 0, 0, 20, 20,
75 new->width
, new->height
);
77 tiled
= RMakeTiledImage(img
, 160, 160);
78 RConvertImage(ctx
, tiled
, &pix
);
79 XCopyArea(dpy
, pix
, win
, ctx
->copy_gc
, 0, 0, 160, 160,
80 new->width
+mini
->width
, new->height
+mini
->height
);