Math
- retrofont.math.add_tuples(t1, t2)
Add two 2-tuples.
- Parameters:
t1 (
tuple[int,int]) – A 2-tuple.t2 (
tuple[int,int]) – A 2-tuple.
- Return type:
tuple[int,int]- Returns:
Result of t1 + t2.
- retrofont.math.flatten_matrix(m)
Make a flat list from an n-dimensional matrix.
- Parameters:
m (
list[...]) – Matrix.- Return type:
list- Returns:
List.
- retrofont.math.make_matrix(l, dim)
Make an n-dimensional matrix from a flat list.
- Parameters:
l (
list) – List.dim (
tuple[int,...]) – Dimensions of the matrix.
- Return type:
list[...]- Returns:
Matrix.
- retrofont.math.pad_block(size, block_size)
Calculate number of padding bytes.
- Parameters:
size (
int) – Number of bytes.block_size (
int) – Block size.
- Return type:
int- Returns:
Number of padding bytes.
- retrofont.math.reverse_byte(byte)
Reverse the bit order in a byte.
- Parameters:
byte (
int) – Byte.- Return type:
int- Returns:
Reversed byte.
- retrofont.math.rotate_tuple_ccw(t)
Rotate a 2-tuple 90 degrees counterclockwise.
- Parameters:
t (
tuple[int,int]) – A 2-tuple.- Return type:
tuple[int,int]- Returns:
Rotation of t.
- retrofont.math.rotate_tuple_cw(t)
Rotate a 2-tuple 90 degrees clockwise.
- Parameters:
t (
tuple[int,int]) – A 2-tuple.- Return type:
tuple[int,int]- Returns:
Rotation of t.