Line pattern and style rendering algorithms
This module contains line style pattern rendering and segment drawing algorithms following the Single Responsibility Principle.
SOLID: Single responsibility for line style implementation
Calculate total length of pattern cycle Following KISS principle - simple sum calculation
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | pattern(20) | |||
| integer, | intent(in) | :: | pattern_size |
Determine if line should be drawn at given distance in pattern Following SRP - handles only pattern position logic
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | distance | |||
| real(kind=wp), | intent(in) | :: | pattern(20) | |||
| integer, | intent(in) | :: | pattern_size | |||
| real(kind=wp), | intent(in) | :: | pattern_length |
Get line pattern array for a given style, in points. Single source of truth: the matplotlib default dash sequences. On/off lengths are in points; callers scale by line width (points) and convert to device units (see scale_pattern_to_pixels).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | linestyle | |||
| real(kind=wp), | intent(out) | :: | pattern(20) | |||
| integer, | intent(out) | :: | pattern_size |
Scale a point-based pattern in place to device pixels, matching matplotlib: multiply each on/off length (points) by the line width (points), then convert points to pixels via px = pt * dpi / 72. The solid sentinel is left untouched.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | pattern(20) | |||
| integer, | intent(in) | :: | pattern_size | |||
| real(kind=wp), | intent(in) | :: | dpi | |||
| real(kind=wp), | intent(in) | :: | line_width_pt |
Advance pattern state for continuous rendering Following SRP - handles only state advancement
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | current_distance | |||
| real(kind=wp), | intent(in) | :: | segment_length | |||
| real(kind=wp), | intent(in) | :: | pattern_length | |||
| real(kind=wp), | intent(out) | :: | new_distance |