MCPcopy Create free account
hub / github.com/kiibohd/controller / preview

Method preview

Scan/Devices/STLcd/bitmap2Struct.py:80–110  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

78
79 # Prints out what the image will look like on the display
80 def preview( self ):
81 # Top border first
82 display = "+"
83 for pixel in range( 0, self.width ):
84 display += "-"
85 display += "+\n"
86
87 # Each Page
88 for page in range( self.page_count - 1, -1, -1 ):
89 # Each Bit (Line)
90 for line in range( 7, -1, -1 ):
91 # Border
92 display += "|"
93
94 # Each Byte (Column/Pixel)
95 for byte in range( 0, self.width ):
96 if self.page_data[ page ][ byte ] & (1 << line):
97 display += "*"
98 else:
99 display += " "
100
101 # Border
102 display += "|\n"
103
104 # Bottom border
105 display += "+"
106 for pixel in range( 0, self.width ):
107 display += "-"
108 display += "+\n"
109
110 return display
111
112
113class StandardError(ValueError):

Callers 2

output_image_fnMethod · 0.45
bitmap2Struct.pyFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected