def drawVLine(self, x, y, l, color = None): # draw horiontal Line colorvect = self.colorvect if color is None else bytearray(color) if l < 0: # negative length, swap parameters l = -l y -= l self.setXY(x, y, x, y + l - 1) # set display window TFT_io.fillSCR_AS(colorvect, l)
def clrSCR(self, color = None): colorvect = self.BGcolorvect if color is None else bytearray(color) self.clrXY() TFT_io.fillSCR_AS(colorvect, (self.disp_x_size + 1) * (self.disp_y_size + 1)) self.setScrollArea(0, self.disp_y_size + 1, 0) self.setScrollStart(0) self.setTextPos(0,0)
def fillRectangle(self, x1, y1, x2, y2, color=None): if x1 > x2: x1, x2 = x2, x1 if y1 > y2: y1, y2 = y2, y1 self.setXY(x1, y1, x2, y2) # set display window if color: TFT_io.fillSCR_AS(bytearray(color), (x2 - x1 + 1) * (y2 - y1 + 1)) else: TFT_io.fillSCR_AS(self.colorvect, (x2 - x1 + 1) * (y2 - y1 + 1))
def printClrLine(self, mode = 0): # clear to end of line/bol/line if mode == 0: self.setXY(self.text_x, self.text_y, self.text_width - 1, self.text_y + self.text_rows - 1) # set display window TFT_io.fillSCR_AS(self.text_color, (self.text_width - self.text_x + 1) * self.text_rows) elif mode == 1 and self.text_x > 0: self.setXY(0, self.text_y, self.text_x - 1, self.text_y + self.text_rows - 1) # set display window TFT_io.fillSCR_AS(self.text_color, (self.text_x - 1) * self.text_rows) elif mode == 2: self.setXY(0, self.text_y, self.text_width - 1, self.text_y + self.text_rows - 1) # set display window TFT_io.fillSCR_AS(self.text_color, self.text_width * self.text_rows)
def printClrSCR(self): # clear Area set by setScrollArea self.setXY(0, self.scroll_tfa, self.text_width - 1, self.scroll_tfa + self.scroll_vsa) # set display window TFT_io.fillSCR_AS(self.text_color, self.text_width * self.scroll_vsa) self.setScrollStart(self.scroll_tfa) self.setTextPos(0, self.scroll_tfa)