0
# Drawing and Colors
1
2
Low-level drawing utilities and color management for creating custom visualizations and annotations.
3
4
## Capabilities
5
6
### Color Management
7
8
```python { .api }
9
class Color:
10
"""RGB color representation with predefined colors."""
11
WHITE: Color
12
BLACK: Color
13
RED: Color
14
GREEN: Color
15
BLUE: Color
16
# Additional predefined colors...
17
18
class ColorPalette:
19
"""Collection of colors for consistent theming."""
20
DEFAULT: ColorPalette
21
22
@classmethod
23
def from_hex(cls, colors: list[str]) -> ColorPalette: ...
24
```
25
26
### Drawing Functions
27
28
```python { .api }
29
def draw_polygon(image: np.ndarray, polygon: np.ndarray, color: Color, thickness: int = 2) -> np.ndarray:
30
"""Draw polygon outline on image."""
31
32
def draw_filled_polygon(image: np.ndarray, polygon: np.ndarray, color: Color) -> np.ndarray:
33
"""Draw filled polygon on image."""
34
35
def draw_rectangle(image: np.ndarray, rect: Rect, color: Color, thickness: int = 2) -> np.ndarray:
36
"""Draw rectangle outline."""
37
38
def draw_filled_rectangle(image: np.ndarray, rect: Rect, color: Color) -> np.ndarray:
39
"""Draw filled rectangle."""
40
41
def draw_text(image: np.ndarray, text: str, anchor: Point, color: Color, scale: float = 0.5) -> np.ndarray:
42
"""Draw text on image."""
43
```