12 int main(int argc
, char **argv
)
14 RContextAttributes attr
;
16 dpy
= XOpenDisplay("");
18 puts("cant open display");
21 attr
.flags
= RC_RenderMode
| RC_ColorsPerChannel
;
22 attr
.render_mode
= RM_DITHER
;
23 attr
.colors_per_channel
= 4;
24 ctx
= RCreateContext(dpy
, DefaultScreen(dpy
), &attr
);
26 img
= RGetImageFromXPMData(ctx
, image_name
);
28 img
= RLoadImage(ctx
, argv
[1], argc
>2 ? atol(argv
[2]) : 0);
31 puts(RMessageForError(RErrorCode
));
34 if (!RConvertImage(ctx
, img
, &pix
)) {
35 puts(RMessageForError(RErrorCode
));
39 win
= XCreateSimpleWindow(dpy
, DefaultRootWindow(dpy
), 10, 10, img
->width
,
40 img
->height
, 0, 0, 0);
41 XSelectInput(dpy
, win
, ExposureMask
);
44 XCopyArea(dpy
, pix
, win
, ctx
->copy_gc
, 0, 0, img
->width
, img
->height
,
52 XCopyArea(dpy
, pix
, win
, ctx
->copy_gc
, 0, 0, img
->width
, img
->height
,