15 lines
303 B
Python
15 lines
303 B
Python
import math
|
|
|
|
|
|
def align_to(value, alignment):
|
|
"""align height, width according to alignment
|
|
|
|
Args:
|
|
value (int): height or width
|
|
alignment (int): target alignment factor
|
|
|
|
Returns:
|
|
int: the aligned value
|
|
"""
|
|
return int(math.ceil(value / alignment) * alignment)
|