Line Patterns

Graphics32 defines several functions to support non-uniform lines. This includes gradient lines, dashed lines etc.

The idea is pretty simple: TBitmap32 object holds dynamic array of colors, and a counter, which 'crawls' along the array and reads colors from its position. The line drawing algorithm queries color value from the current counter position at each point, then the counter is automatically incremented to get ready to supply the next value to line rasterisation routine.

The counter, accessed through StippleCounter property, wraps itself automatically at the edges of color array. It can move in both directions depending on stipple step, which in turn can be positive or negative. Its malue may even be fractional in this case resulting color is interpolated. The step is accessed with StippleStep property.

GetStippleColor returns color from the current counter position and automatically increments counter position by the counter step, so that next GetStippleColor call will return color value from the next position.

Drawing functions that support line patterns have 'P' in their postfix (as in LineFSP).

Warning: the counter is not thread-aware, it is shared by all threads accessing the bitmap. Additional care should be taken when multiple threads draw stippled lines in the same bitmap.

See Also

Examples, Naming Conventions, TBitmap32, TCustomBitmap32.GetStippleColor, TCustomBitmap32.StippleCounter, TCustomBitmap32.StippleStep