Microchip Technology AC164127-9 Data Sheet

Page of 34
 2011 Microchip Technology Inc.
DS01368A-page 31
AN1368
APPENDIX C:
ADVANCED USAGE 
OF RCCGPU
The RCCGPU can be used to achieve different kinds of
graphical effects, for instance, animations and scrolling
screens. These effects are achieved using a buffer of
memory, that is separate from the frame buffer, which
contains the final image to be displayed on the screen
.
The image from this buffer is then transferred to the
frame buffer in special ways which forms the various
visual effects on the screen. For example, transferring
the image vertically, line by line to the frame buffer,
gives the effect of peeling, whereas moving the existing
frame buffer, line by line, and filling the moved part with
the final image, gives the effect of scrolling the screen. 
Some of the effects and their algorithm are as follows:
1.
Move from Left to Right:
 
This effect shows the
new screen sliding from left to right.
FIGURE C-1:
MOVE FROM LEFT TO RIGHT
Algorithm:
Step i:
 The new screen is completely created in the
draw buffer.
Step ii:
 Move one right line (Height = Screen Height,
Width = One Pixel) from the draw buffer to the left side
of the frame buffer using the RCCGPU rectangle copy
command.
Step iii:
 Move two right lines (Height = Screen Height,
Width = 2 Pixels) from the draw buffer to the left side of
the frame buffer using the RCCGPU rectangle copy
command.
Repeat the above steps until the whole screen is
transferred to the frame buffer, as shown in 
2.
Expanding Rectangle: This effect shows a
rectangle expanding from the middle to the
periphery of the screen.
FIGURE C-2:
EXPANDING RECTANGLE
Algorithm:
Step i:
 The new screen is completely created in the
draw buffer.
Step ii: 
Move a rectangle of 2x2 from the middle of the
draw buffer to the middle of the frame buffer using the
RCCGPU rectangle copy command.
Step iii: 
Move a rectangle of 3x3 from the middle of the
draw buffer to the middle of the frame buffer using the
RCCGPU rectangle copy command.
Repeat the above steps until the whole screen is
transferred to the frame buffer, as shown in 
3.
Expanding Line: This effect shows a vertical line
expanding from the middle to the end in a
horizontal direction.
FIGURE C-3:
EXPANDING LINE
Algorithm:
Step i
: The new screen to be shown is completely
created in the draw buffer.
Step ii: 
Move two middle lines (Height = Screen Height,
Width = 2 Pixels) from the draw buffer to the middle of
the frame buffer using the RCCGPU rectangle copy
command.
Step iii:
 Move four middle lines (Height = Screen Height,
Width = 4 Pixels) from the draw buffer to the middle of
the frame buffer using the RCCGPU rectangle copy
command.
Repeat the above steps until the whole screen is
transferred to the frame buffer, as shown in 
Similarly, many screen transition effects can be
achieved easily.
Draw Buffer
Frame Buffer
1
2
Frame 
Buffer
Draw 
Buffer
1
2
Draw Buffer
Frame Buffer
1
2