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 printf("using default image as none was provided\n");
29 img
= RGetImageFromXPMData(ctx
, image_name
);
32 img
= RLoadImage(ctx
, argv
[1], 0);
35 puts(RMessageForError(RErrorCode
));
42 img
= RScaleImage(tmp
, tmp
->width
* atol(argv
[2]), tmp
->height
* atol(argv
[2]));
43 /*img = RSmoothScaleImage(tmp, tmp->width*atol(argv[2]),
44 tmp->height*atol(argv[2]));
51 img
= RScaleImage(img
, img
->width
* atof(argv
[2]), img
->height
* atof(argv
[2]));
55 RImage
*tmp
= RCreateImage(200, 200, True
);
56 RColor col
= { 0, 0, 255, 255 };
58 if (img
->format
== RRGBAFormat
)
63 RClearImage(tmp
, &col
);
65 RCombineArea(tmp
, img
, 0, 0, 20, 20, 10, 10);
70 if (!RConvertImage(ctx
, img
, &pix
)) {
71 puts(RMessageForError(RErrorCode
));
75 printf("size is %ix%i\n", img
->width
, img
->height
);
77 win
= XCreateSimpleWindow(dpy
, DefaultRootWindow(dpy
), 10, 10, img
->width
, img
->height
, 0, 0, 0);
78 XSetWindowBackgroundPixmap(dpy
, win
, pix
);
79 XClearWindow(dpy
, win
);