mindsensorsUI.py 文件源码

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

项目:PiStorms 作者: mindsensors 项目源码 文件源码
def fillImgArray(self, x, y, width, height, image, display = True):
        buff = self.disp.buffer
        actx = self.screenXFromImageCoords(x,y)
        acty = self.screenYFromImageCoords(x,y)

        image = Image.fromarray(image)

        image = image.resize((width,height), Image.ANTIALIAS)

        cr = self.currentRotation
        if(cr == 1):
            actx -= height
            image = image.transpose(Image.ROTATE_270)
        if(cr == 2):
            acty -= height
            actx -= width
            image = image.transpose(Image.ROTATE_180)
        if(cr == 3):
            acty -= width
            image = image.transpose(Image.ROTATE_90)

        buff.paste(image, (actx,acty))
        if(display):
            self.disp.display()

    ## Rotates the screen orientation 90 degrees to the right (-90 degrees)
    #  @param self The object pointer.
    #  @remark
    #  To use this function in your program:
    #  @code
    #  ...
    #  screen.rotateRight()
    #  @endcode
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号