在透明XCB窗口绘图出现伪影,如何解决该技术问题?
XCB透明窗口绘图伪影问题

我尝试创建由合成器提供透明度信息的XCB透明窗口。已成功创建透明窗口并使用Cairo进行绘图,但遇到了附图所示的问题:第二个窗口出现了来自第一个窗口的绘图伪影,不清楚具体解决方法。
以下是我使用的Lua代码(实际C代码的简化版本):
local init_x = 80 local init_y = 280 local init_width = 300 local init_height = 200 local win_id = swin.create(init_x, init_y, init_width, init_height) local pix_id = spixmap.create(init_width, init_height) local surf = scairo.create_from_pixmap(pix_id, init_width, init_height) local lsurf = lgi.cairo.Surface(surf, true) local cr = lgi.cairo.Context(lsurf) -- the source operator should use data from the compositor cr:set_operator(lgi.cairo.Operator.SOURCE) -- paint the window transparent. cr:paint_with_alpha(0.0) cr:rectangle(0, 0, 40, 40) cr:set_source_rgb(0.8, 0.1, 0.8) cr:fill() swin.map(win_id) spixmap.draw_portion_to_window(pix_id, win_id, 0, 0, init_width, init_height)
我认为代码逻辑并无问题,若需更多细节可告知,我会补充内容。
内容的提问来源于stack exchange,提问作者DesertCarMechanic
相关产品推荐
相关产品推荐

