poly line issue

Sam Varshavchik sam.varshavchik at gmail.com
Tue Nov 10 00:43:41 UTC 2020


On Mon, Nov 9, 2020 at 4:30 PM Per Dalgas Jakobsen <pdj at knaldgas.dk> wrote:
>
> Hi,
>
> I'm trying to learn coding with XCB and found an issue the XCB people
> think should be placed her.
> Drawing a diamond seems to render correctly only if started (end ended)
> at the right-most corner, drawing from any other corner causes the
> right-most pixel not to be rendered.

libxcb has no involvement with actual drawing or rendering. It's sole
function is to transmit requests, and all their parameters, to the X
server which then executes them. libxcb is really just a very thin
mapping layer between a functional API and X protocol messages.

What you want to do is investigate the formal X protocol
specification, which defines how various coordinates and parameters
get interpreted.

>     xcb_poly_line (connection, XCB_COORD_MODE_ORIGIN, window,
> foreground, 5, diamond);

This would be the PolyLine request:

https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:PolyLine

Note the nuanced detail of how various coordinates get interpreted and
the meticulous detail in defining the actual drawn pixels.

Elsewhere in this specification you will find the formal definition of
the low level data points. For example, in general, line
drawing-related requests specify the coordinates for the center of the
drawn line. A question then arises, if the line's width is given as an
even number of pixels, what actual pixels get drawn? If the line's
width is given as 1, 3 or 5 pixels, for example, and it's a vertical
line, which pixels get drawn is not such a big mystery. But what if
it's 2 or 4 pixels, then what?

You're going to have to sift through the specification, to get the
details of what happens. That's just one example (whose answer I don't
recall off the top of my head), you'll have to decipher what's
happening in your case similarly.


More information about the xorg mailing list