win32

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit ec2d4e992ae0351e5a149145a380407c17be5f75
parent 5bc8a86084c7a23fa1a5d8dbcb963472f66a2ae6
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Fri, 19 Dec 2025 21:44:58 +0900

create 3 pictures and composite them on the screen

Diffstat:
Mxcb.c | 30++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+), 0 deletions(-)

diff --git a/xcb.c b/xcb.c @@ -61,12 +61,42 @@ int main(void) { visual32.visual_id, XCB_CW_BORDER_PIXEL|XCB_CW_COLORMAP, &attr32); + int width1 = 300, height1 = 300; + xcb_pixmap_t pixmap32_1 = xcb_generate_id(conn); + xcb_create_pixmap(conn, 32, pixmap32_1, window32, width1, height1); + xcb_render_picture_t picture32_1 = xcb_generate_id(conn); + xcb_render_create_picture(conn, picture32_1, pixmap32_1, pictformat32, 0, NULL); + xcb_render_color_t color1 = { .red = 0xffff, .green = 0, .blue = 0, .alpha = 0x3fff }; + xcb_rectangle_t rectangle1 = { .x = 0, .y = 0, .width = width1, height = height1 }; + xcb_render_fill_rectangles(conn, XCB_RENDER_PICT_OP_SRC, picture32_1, color1, 1, &rectangle1); + + int width2 = 300, height2 = 200; + xcb_pixmap_t pixmap32_2 = xcb_generate_id(conn); + xcb_create_pixmap(conn, 32, pixmap32_2, window32, width2, height1); + xcb_render_picture_t picture32_2 = xcb_generate_id(conn); + xcb_render_create_picture(conn, picture32_2, pixmap32_2, pictformat32, 0, NULL); + xcb_render_color_t color2 = { .red = 0, .green = 0xffff, .blue = 0, .alpha = 0x3fff }; + xcb_rectangle_t rectangle2 = { .x = 0, .y = 0, .width = width2, height = height2 }; + xcb_render_fill_rectangles(conn, XCB_RENDER_PICT_OP_SRC, picture32_2, color2, 2, &rectangle1); + + int width3 = 300, height3 = 300; + xcb_pixmap_t pixmap32_3 = xcb_generate_id(conn); + xcb_create_pixmap(conn, 32, pixmap32_3, window32, width3, height1); + xcb_render_picture_t picture32_3 = xcb_generate_id(conn); + xcb_render_create_picture(conn, picture32_3, pixmap32_3, pictformat32, 0, NULL); + xcb_render_color_t color3 = { .red = 0, .green = 0, .blue = 0xffff, .alpha = 0x3fff }; + xcb_rectangle_t rectangle3 = { .x = 0, .y = 0, .width = width3, height = height3 }; + xcb_render_fill_rectangles(conn, XCB_RENDER_PICT_OP_SRC, picture32_3, color3, 3, &rectangle1); + xcb_flush(conn); int quit = 0; xcb_generic_event_t *event; while (!quit) { xcb_render_fill_rectangles(conn, XCB_RENDER_PICT_OP_SRC, picture, color, 1, &rectangle); + xcb_render_composite(conn, XCB_RENDER_PICT_OP_OVER, picture32_1, 0, picture, 0, 0, 0, 0, 100, 100, width1, height1); + xcb_render_composite(conn, XCB_RENDER_PICT_OP_OVER, picture32_2, 0, picture, 0, 0, 0, 0, 200, 150, width2, height2); + xcb_render_composite(conn, XCB_RENDER_PICT_OP_OVER, picture32_3, 0, picture, 0, 0, 0, 0, 150, 200, width3, height3); xcb_flush(conn); event = xcb_wait_for_event(conn);