XDefaultDepth 和 XDisplayPlanes——有什么区别?

XDefaultDepth and XDisplayPlanes – what's the difference?

对于 XDefaultDepthXlib 文档说:

Returns the depth (number of planes) of the default root window for the specified screen.
Other depths may also be supported on this screen.

对于XDisplayPlanes,它表示:

Returns the depth of the root window of the specified screen.

所以基本上,return 桌面的深度(根 window)。
两者也具有相同数量和类型的参数。这令人困惑:/
那这两者有什么区别呢?
因为从这个描述来看,他们似乎做的完全一样 :q

虽然它们在实现上可能相同(参见 grep root_depth /usr/include/X11/Xlib.h),但 "depth" 和 "planes"、

之间存在语义差异
  • The depth of a window or pixmap is the number of bits per pixel it has. The depth of a graphics context is the depth of the drawables it can be used in conjunction with graphicsoutput.

  • When a pixmap or window is thought of as a stack of [1-bit] bitmaps, each bitmap is called a plane or bit plane.

(来自 https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html

我认为这就是他们提供单独接口的原因。

追溯 X11 历史,

https://www.hpl.hp.com/techreports/Compaq-DEC/CRL-90-8.pdf

Since backing store memory available for a window can be very precious, particularly on a deep display, there are also window attributes that inform the server which planes of the screen need to be saved in backing store, along with a pixel value base so that the window can be re-generated when exposed.

https://www.student.cs.uwaterloo.ca/~cs349/f18/resources/X/TheXWindowSystem.pdf

Overlay graphics can then be drawn by restricting output (see the next section) to the single bit plane specified in the mask returned by the color allocation. Turning bits in this plane on (to l’s) changes the image to the fifth color, and turning them off reverts the image to its original color.

有一些像 XCopyPlane 这样的 Xlib 函数可以在单个 飞机。如果我正在处理飞机并且想知道我必须处理多少架飞机,那么调用 XDisplayPlanes() 比调用 XDefaultDepth().

更有意义