16 #define MAX(a,b) (a)>(b) ? (a) : (b)
18 int main(int argc
, char **argv
)
20 RContextAttributes attr
;
23 dpy
= XOpenDisplay("");
25 puts("cant open display");
29 attr
.flags
= RC_RenderMode
| RC_ColorsPerChannel
;
30 attr
.render_mode
= RDitheredRendering
;
31 attr
.colors_per_channel
= 4;
32 ctx
= RCreateContext(dpy
, DefaultScreen(dpy
), &attr
);
35 img
= RGetImageFromXPMData(ctx
, image_name
);
37 img
= RLoadImage(ctx
, argv
[1], 0);
40 puts(RMessageForError(RErrorCode
));
43 win
= XCreateSimpleWindow(dpy
, DefaultRootWindow(dpy
), 10, 10,
44 MAX(img
->width
, img
->height
),
45 MAX(img
->height
, img
->width
), 0, 0, 0);
55 tmp
= RRotateImage(img
, a
);
56 if (!RConvertImage(ctx
, tmp
, &pix
)) {
57 puts(RMessageForError(RErrorCode
));
62 XSetWindowBackgroundPixmap(dpy
, win
, pix
);
63 XFreePixmap(dpy
, pix
);
64 XClearWindow(dpy
, win
);