MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _apply_web_rotation

Function _apply_web_rotation

display.py:68–79  ·  view source on GitHub ↗

Apply rotation for the web preview PNG. The web preview should match what the user physically sees on the display. * 0° – landscape, show as-is * 90° – portrait, show as-is (getbuffer + physical mount cancel) * 180° – landscape upside-down * 270° – portrait upside-down (getbu

(image, rotation)

Source from the content-addressed store, hash-verified

66
67
68# Map rotation angle → PIL transpose operation
69_ROTATION_TRANSPOSE = {
70 90: Image.Transpose.ROTATE_90,
71 180: Image.Transpose.ROTATE_180,
72 270: Image.Transpose.ROTATE_270,
73}
74
75
76def _render_dimensions(width, height, rotation):
77 """Return (render_w, render_h) for the given rotation.
78
79 For 90°/270° the render canvas is portrait (swapped) so that the
80 e-paper getbuffer 'Vertical' path maps it correctly to the landscape
81 display buffer. For 0°/180° dimensions stay as-is.
82 """

Callers 1

runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected