The Effect of GC Settings

Volume One, Xlib Programming Manual, Page 116)

The 4 Stages of the Drawing Process

EnglischDeutsch
To predict the effect of particular GC settings on a particular graphics primitive, it is useful to visualize the drawing in a number of stages, even though in reality the drawing of each bit of each pixel is performed by the server in a single equation. Um den Einfluß von einem bestimmten GC auf ein primitives graghisches Element zu bestimmen ist es hilfreich wenn man sich das Zeichnen in ein paar Stufen vorstellt, obwohl der Server jedes Bit von jedem Pixel mit einer einzigen Gleichung realisiert.
  1. The first stage is pixel selection. As we just described, pixel selection is specified by the graphics primitive, in some cases along with the line_width, clip_mask, and other elements in the GC. The result of the first stage is a bitmap - a single rectangle of bits, with the pixels to be drawn set to one and the pixels not to be drawn set to zero.
  2. The second stage applies one or two colors or a pattern to the results of the first stage, resulting in a pixmap which has the same depth (number of bits per pixel) as the drawable. The output of the second stage is referred to later in this chapter as the source.
  3. In the third stage, a plane mask may be applied to select which planes of the drawable can be affected by the graphics request. This is done to play tricks with color, such as to draw temporary graphics that can be erased without erasing other things already drawn in a window, as demonstrated in Chapter 7, Color, By default, the plane mask is all ones and therefore has no effect on what is drawn.
  4. In the fourth stage, the pixel values resulting from stage three can be combined with what is already on the screen using so-called logical functions. Most graphics are drawn by simply overwriting the existing graphics using a logical function of GXcopy, but there are useful tricks that can be played by using certain other logical functions. One such effect is called rubber-banding; the window manager uses this technique to show you the outline of a window you are moving or resizing.
  1. Der erste Schritt ist die Auswahl der Pixel. Die Auswahl der Pixel wird, wie wir schon beschrieben haben, von den primitiven graphischen Elementen bestimmt. In eingen Fällen auch zusammen mit line_width, clip_mask und anderen Elementen des GC's. Das Ergebnis des ersten Schrittes ist ein Bitmap, d.h. nur ein mit Bits gefülltes Rechteck, in dem die Pixel die gemahlt werden auf Eins gesetzt sind und die anderen auf Null.
  2. Der zweite Schritt wendet eine oder zwei Farben oder ein Muster auf des Ergebnis aus dem ersten Schritt an. Das Ergebnis ist eine Pixeltabelle mit derselben Farbtiefe (Anzahl der Bits pro Pixel) wie das Ziel. Später beziehen wir uns wieder auf die Ausgabe des zweiten Schrittes als Quelle.
  3. Im dritte Schritt wird eine Ebenenmaske verwendet um die Ebenen auszuwählen die von der Malroutine betroffen sind. Das wird so gemacht um mit den Farben spielen zu können. Wie zum Beispiel das Malen vorübergehender Graphiken die wieder gelöscht werden können ohne andere bereits gemalte Dinge zu löschen, so wie in Kapitel 7, Color gezeigt. In der Standardeinstellung für die Ebenenmaske ist alles Eins. Sie hat deshalb keinen Einfluß darauf was gemalt wird.
  4. Im vierten Schritt können die Pixelwerte aus Schritt drei mit den sogenannten logischen Funktionen, mit dem bereits gemalten kombiniert werden.Die meisten Graphiken werden mit einer logischen Funktion von GXcopy, durch einfaches übermalen der bereits existierenden Grafik, gezeichnet. Es gibt aber auch hilfreiche Tricks wenn man andere logische Funktionen verwendet. Ein Trick wird Gummiband gennant. Der Fensterverwalter benutzt diese Technik wenn er den Umriss eines Fensters beim Bewegen oder beim verändern der Größe zeigt.