commit d62afb6f23a6e22c3a3293c6b24756ba8ba08f0f
parent 82d0689a7959e25611d5dfcc0d894e4fdb231212
Author: Matsuda Kenji <info@mtkn.jp>
Date: Wed, 17 Dec 2025 13:41:06 +0900
composite
Diffstat:
| M | win32.c | | | 22 | +++++++++++++++++++--- |
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/win32.c b/win32.c
@@ -48,8 +48,8 @@ int main(void) {
Picture picture = XRenderCreatePicture(display, window, &pictformat, 0, NULL);
XRenderColor color = { .red = 0xffff, .green = 0xffff, .blue = 0xeaea, .alpha = 0xffff };
XRectangle rectangle = { .x = 0, .y = 0, .width = 800, .height = 600 };
+ XRenderFillRectangles(display, PictOpSrc, picture, &color, &rectangle, 1);
-/*
XVisualInfo vi32;
if (findVisual32(display, &vi32) < 0) {
fatal("32bit-deep visual info not found");
@@ -66,18 +66,34 @@ int main(void) {
vi32.visual,
CWBorderPixel|CWColormap,
&attr32);
-*/
+ Pixmap pixmap32 = XCreatePixmap(display, window32, 800, 600, 32);
+ Picture picture32 = XRenderCreatePicture(display, pixmap32, &pictformat32, 0, NULL);
+ XRenderColor colors[2] = {
+ { .red = 0xffff, .alpha = 0x0fff },
+ { .green = 0xffff, .alpha = 0x0fff },
+ };
+ XRectangle rectangles[2] = {
+ { .x = 100, .y = 100, .width = 300, .height = 400 },
+ { .x = 200, .y = 200, .width = 300, .height = 200 },
+ };
+ XRenderFillRectangles(display, PictOpSrc, picture32, &color, &rectangle, 1);
+ XRenderFillRectangles(display, PictOpOver, picture32, &colors[0], &rectangles[0], 1);
+ XRenderFillRectangles(display, PictOpOver, picture32, &colors[1], &rectangles[1], 1);
+
XSync(display, 0);
int quit = 0;
XEvent event;
while (!quit) {
+ XRenderFillRectangles(display, PictOpSrc, picture, &color, &rectangle, 1);
+ XRenderComposite(display, PictOpOver, picture32, 0, picture, 0, 0, 0, 0, 0, 0, 800, 600);
XNextEvent(display, &event);
if (event.type == KeyPress && event.xkey.keycode == 49) {
quit = 1;
}
- XRenderFillRectangles(display, PictOpSrc, picture, &color, &rectangle, 1);
}
+ XFreePixmap(display, pixmap32);
+ XRenderFreePicture(display, picture);
XCloseDisplay(display);
}