Call Ili9327_setxy_frame(tempx , Tempy , Tempx2 , Tempy)
Do
Read Pixel 'Read the value for the pixel
If Pixel = &HAA Then 'BGC file is lre coded &HAA represents this, the byte after &HAA is the number of times that the byte before &HAA wil be repeated
Read Repeat 'Byte after &HAA contains the number of times to repeat
Repeat = Repeat - 1
For L = 1 To Repeat 'Loop the repeat
Call Ili9327_write_dataw(prevpixel) 'Write the pixel data to the display
Decr Imagesize 'Decrease the bytes still to be processed
Incr Xpos 'Incr the xpos
If Xpos > Xsize Then 'If the xpos is larger then xsize of the image start at a new y line
Xpos = 1 'and set the xpos pos back to the first position on the new line
Incr Ypos 'Start a new y line
Tempx = Xpos + Xoffset 'Pixel position is the image postion + the offset
Tempy = Ypos + Yoffset
Call Ili9327_setxy_frame(tempx , Tempy , Tempx2 , Tempy)
'Print "tempx,tempy,tempx2,tempy " ; Tempx ; " " ; Tempy ; " " ; Tempx2 ; " " ; Tempy
End If
Next L 'Next repeat loop
Else 'It's a regular byte, not LRE encoded
Pixelword = Rgb16(pixel) 'Convert the 8bit pixel to 16bit pixel
Call Ili9327_write_dataw(pixelword) 'Write the pixel data to the display
Prevpixel = Pixelword 'Store the pixel in a temp word, maybe we need it if the next byte is &HAA
Decr Imagesize 'Decrease the bytes still to be processed
Incr Xpos
If Xpos > Xsize Then 'If the xpos is larger then xsize of the image start at a new y line
Xpos = 1 'and set the xpos pos back to the first position on the new line
Incr Ypos
Tempx = Xpos + Xoffset 'Pixel position is the image postion + the offset
Tempy = Ypos + Yoffset
Call Ili9327_setxy_frame(tempx , Tempy , Tempx2 , Tempy) 'Start a new y line, send the xy position to the display
'Print "tempx,tempy,tempx2,tempy " ; Tempx ; " " ; Tempy ; " " ; Tempx2 ; " " ; Tempy
End If
End If
Loop Until Imagesize = 0
|