12 int main(int argc, char **argv)
14 RContextAttributes attr;
16 dpy = XOpenDisplay("");
18 puts("cant open display");
22 attr.flags = RC_RenderMode | RC_ColorsPerChannel;
23 attr.render_mode = RDitheredRendering;
24 attr.colors_per_channel = 4;
25 ctx = RCreateContext(dpy, DefaultScreen(dpy), &attr);
28 img = RGetImageFromXPMData(ctx, image_name);
30 img = RLoadImage(ctx, argv[1], 0);
33 puts(RMessageForError(RErrorCode));
40 img = RScaleImage(tmp, tmp->width * atol(argv[2]), tmp->height * atol(argv[2]));
41 /*img = RSmoothScaleImage(tmp, tmp->width*atol(argv[2]),
42 tmp->height*atol(argv[2]));
49 img = RScaleImage(img, img->width * atof(argv[2]), img->height * atof(argv[2]));
53 RImage *tmp = RCreateImage(200, 200, True);
54 RColor col = { 0, 0, 255, 255 };
56 if (img->format == RRGBAFormat)
61 RClearImage(tmp, &col);
63 RCombineArea(tmp, img, 0, 0, 20, 20, 10, 10);
68 if (!RConvertImage(ctx, img, &pix)) {
69 puts(RMessageForError(RErrorCode));
73 printf("%ix%i\n", img->width, img->height);
75 win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 10, 10, img->width, img->height, 0, 0, 0);
76 XSetWindowBackgroundPixmap(dpy, win, pix);
77 XClearWindow(dpy, win);