Line stippling masks out certain fragments produced by rasterization; those fragments will not be drawn. The masking is achieved by using three parameters: the repeat count (1st element of the lineStipple pair, clamped to the range [ 1 .. 256 ]), the 16-bit line stipple pattern (2nd element), and an integer stipple counter s.
The counter s is reset to 0 at before the first action during renderPrimitive is called and before each line segment during renderPrimitive is generated. It is incremented after each fragment of a unit width aliased line segment is generated or after each i fragments of an i width line segment are generated. The i fragments associated with count s are masked out if testBit pattern (( s / factor ) mod 16) is False, otherwise these fragments are sent to the frame buffer. Bit zero of the pattern is the least significant bit, i.e. it is used first.
Antialiased lines are treated as a sequence of rectangles of height 1 for purposes of stippling. Whether rectangle s is rasterized or not depends on the fragment rule described for aliased lines, counting rectangles rather than groups of fragments.
The initial value of lineStipple is Nothing, i.e. line stippling is disabled.
An InvalidOperation is generated if lineStipple is set during renderPrimitive.