openglscalexlib

how to scale a window with Xlib?


How to scale a window with Xlib ? I have search it in search engines. And almost all answer is to resize window. chatgpt answer me that scale with opengl. but its demo not work at all.


Solution

  • Assuming you mean draw at other than 1:1 pixel scale, you can't in plain Xlib. XCopyArea and XPutImage have no parameters that allow the destination width and height to be different from the source.

    The XRender extension can rescale images by assigning a transformation matrix to a destination. There's an example at https://www.talisman.org/~erlkonig/misc/x11-composite-tutorial/

    Much easier if you use a 2D drawing library such as Qt Painter or Cairo instead.