scistag.shapestag.checkerboard.Checkerboard¶
- class Checkerboard(bounding=None, col_row_count=None, tile_size=16.0, color_a=Color(r=0.0, g=0.0, b=0.0, a=1.0, _rgba=(0.0, 0.0, 0.0, 1.0), _int_rgba=(0, 0, 0, 255)), color_b=Color(r=1.0, g=1.0, b=1.0, a=1.0, _rgba=(1.0, 1.0, 1.0, 1.0), _int_rgba=(255, 255, 255, 255)), offset=None)[source]¶
Bases:
ShapeA checkerboard either defined by a count of columns and rows or an area it shall cover.
Draws a grid of rectangles using two different colors, for example to draw a checkerboard for calibration purposes or to use it as background, e.g. for transparent images to be better able to distinguish transparent and non-transparent areas as seen in common photo editing apps.
- Parameters
bounding (Bounding2DTypes) – The region to be covered in pixels
col_row_count (Size2DTypes | None) – The count of columns and rows (alternative to region)
tile_size (float) – The size per tile
color_a (ColorTypes) – The first color (used for all uneven fields (col+row))
color_b (ColorTypes) – The second color (used for all even fields (col+row))
offset (Pos2DTypes | None) – The offset in pixels by which the grid shall be moved
Methods
Draws the shape into the defined canvas
A unique hash of the data in this shape.
Renders the shape to an image.
Attributes
HASHABLE_PROPERTIES__annotations____dataclass_fields____dataclass_params____dict____doc____hash____module____weakref__list of weak references to the object (if defined)
The region to be covered overall
The first color (used for all uneven fields)
The first color (used for all even fields)
The column count (horizontal grid width)
The row count (vertical grid height)
The shape's class
The tile size in pixels
- get_hash()¶
A unique hash of the data in this shape. Is used to cache the shape’s renderings when it has not been modified.
- Return type
- Returns
The hash value
- to_image(background_color=Color(r=0.0, g=0.0, b=0.0, a=0.0, _rgba=(0.0, 0.0, 0.0, 0.0), _int_rgba=(0, 0, 0, 0)))¶
Renders the shape to an image.
The shape needs to either specify it’s bounding or it’s size as member variable to be convertible.
- Parameters
background_color – The background color
- Return type
- bounding: Bounding2D = Bounding2D(0.0,0.0,0.0,0.0)¶
The region to be covered overall
- color_a: Color = Color(r=0.0, g=0.0, b=0.0, a=1.0, _rgba=(0.0, 0.0, 0.0, 1.0), _int_rgba=(0, 0, 0, 255))¶
The first color (used for all uneven fields)