15 #define MAX(a,b) (a)>(b) ? (a) : (b)
17 int main(int argc
, char **argv
)
19 RContextAttributes attr
;
22 dpy
= XOpenDisplay("");
24 puts("cant open display");
28 attr
.flags
= RC_RenderMode
| RC_ColorsPerChannel
;
29 attr
.render_mode
= RDitheredRendering
;
30 attr
.colors_per_channel
= 4;
31 ctx
= RCreateContext(dpy
, DefaultScreen(dpy
), &attr
);
34 img
= RGetImageFromXPMData(ctx
, image_name
);
36 img
= RLoadImage(ctx
, argv
[1], 0);
39 puts(RMessageForError(RErrorCode
));
42 win
= XCreateSimpleWindow(dpy
, DefaultRootWindow(dpy
), 10, 10,
43 MAX(img
->width
, img
->height
),
44 MAX(img
->height
, img
->width
), 0, 0, 0);
54 tmp
= RRotateImage(img
, a
);
55 if (!RConvertImage(ctx
, tmp
, &pix
)) {
56 puts(RMessageForError(RErrorCode
));
61 XSetWindowBackgroundPixmap(dpy
, win
, pix
);
62 XFreePixmap(dpy
, pix
);
63 XClearWindow(dpy
, win
);