11 lines
435 B
Python
11 lines
435 B
Python
"""Resolve a device's visual canvas without coupling rendering to its driver."""
|
|||
|
|
|
||
|
|
|
||
|
|
def frame_canvas(display, orientation=None):
|
||
|
|
width, height = display.width, display.height
|
||
|
|
if orientation == "landscape":
|
||
|
|
return max(width, height), min(width, height)
|
||
|
|
if orientation == "portrait":
|
||
|
|
return min(width, height), max(width, height)
|
||
|
|
return (height, width) if display.rotation % 180 == 90 else (width, height)
|