14 #define MAX(a,b) (a)>(b) ? (a) : (b)
16 int main(int argc
, char **argv
)
18 RContextAttributes attr
;
21 dpy
= XOpenDisplay("");
23 puts("cant open display");
27 attr
.flags
= RC_RenderMode
| RC_ColorsPerChannel
;
28 attr
.render_mode
= RDitheredRendering
;
29 attr
.colors_per_channel
= 4;
30 ctx
= RCreateContext(dpy
, DefaultScreen(dpy
), &attr
);
33 img
= RGetImageFromXPMData(ctx
, image_name
);
35 img
= RLoadImage(ctx
, argv
[1], 0);
38 puts(RMessageForError(RErrorCode
));
41 win
= XCreateSimpleWindow(dpy
, DefaultRootWindow(dpy
), 10, 10,
42 MAX(img
->width
, img
->height
), MAX(img
->height
, img
->width
), 0, 0, 0);
52 tmp
= RRotateImage(img
, a
);
53 if (!RConvertImage(ctx
, tmp
, &pix
)) {
54 puts(RMessageForError(RErrorCode
));
59 XSetWindowBackgroundPixmap(dpy
, win
, pix
);
60 XFreePixmap(dpy
, pix
);
61 XClearWindow(dpy
, win
);