mindsensorsUI.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:PiStorms 作者: mindsensors 项目源码 文件源码
def draw_rotated_text(self, image, text, position, angle, font, fill=(255,255,255), display = True):
        draw = ImageDraw.Draw(image)
        width, height = draw.textsize(text, font=font)
        textimage = Image.new('RGBA', (width, height), (0,0,0,0))
        textdraw = ImageDraw.Draw(textimage)
        textdraw.text((0,0), text, font=font, fill=fill)
        if angle == - 90: textimage = textimage.transpose(Image.ROTATE_270)
        if angle == -180: textimage = textimage.transpose(Image.ROTATE_180)
        if angle == -270: textimage = textimage.transpose(Image.ROTATE_90)
        image.paste(textimage, position, textimage)
        if(display):
            self.disp.display()

    ## Determines the width of the screen based on rotation (Experienced users)
    #  @param self The object pointer.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号