13 void main(int argc
, char **argv
)
15 RContextAttributes attr
;
17 dpy
= XOpenDisplay("");
19 puts("cant open display");
23 attr
.flags
= RC_RenderMode
| RC_ColorsPerChannel
;
24 attr
.render_mode
= RM_DITHER
;
25 attr
.colors_per_channel
= 4;
26 ctx
= RCreateContext(dpy
, DefaultScreen(dpy
), &attr
);
29 img
= RGetImageFromXPMData(ctx
, image_name
);
31 img
= RLoadImage(ctx
, argv
[1], argc
>2 ? atol(argv
[2]) : 0);
34 puts(RMessageForError(RErrorCode
));
37 if (!RConvertImage(ctx
, img
, &pix
)) {
38 puts(RMessageForError(RErrorCode
));
42 win
= XCreateSimpleWindow(dpy
, DefaultRootWindow(dpy
), 10, 10, img
->width
,
43 img
->height
, 0, 0, 0);
44 XSelectInput(dpy
, win
, ExposureMask
);
47 XCopyArea(dpy
, pix
, win
, ctx
->copy_gc
, 0, 0, img
->width
, img
->height
,
55 XCopyArea(dpy
, pix
, win
, ctx
->copy_gc
, 0, 0, img
->width
, img
->height
,