Viewport
Viewport
¶
A viewport is a rectangular two-dimensional surface from a canvas, located at (x, y) coordinates (bottom left corner) with size equal to width×height pixels and a background color.
Notes
Future implementation will allows viewports to have an arbitrary rotation.
Example
A viewport is a rectangular two-dimensional surface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
canvas |
Canvas
|
Canvas where to create the viewport |
required |
x |
int
|
X coordinate of the viewport bottom left corner |
required |
y |
int
|
Y coordinate of the viewport bottom left corner |
required |
width |
int
|
Width of the viewport in pixels. |
required |
height |
int
|
Height of the viewport in pixels. |
required |
color |
Color | list | tuple
|
Background color of the viewport |
required |
render
¶
Render the viewport to the specified target. If no target is specified, return a raw image as bytes.
Example
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target |
str
|
Filename of the target |
required |