Game Development Reference
In-Depth Information
Figure 3-28. Bob blended is on the left, and Bob in Paint.NET.is on the right. The checkerboard illustrates that the alpha of
the white background pixels is zero, so the background checkerboard shines through
Note The JPEG format does not support storage of alpha values per pixel. Use the PNG format in
that case.
In Practice
With all of this information, we can finally start to design the interfaces for our graphics module.
Let's define the functionality of those interfaces. Note that when we refer to the framebuffer, we
actually mean the virtual framebuffer of the UI component to which we draw. We just pretend
that we directly draw to the real framebuffer. We'll need to be able to perform the following
operations:
ï?®
Load images from disk, and store them in memory for drawing them
later on.
ï?®
Clear the framebuffer with a color so that we can erase what's still there
from the last frame.
ï?®
Set a pixel in the framebuffer at a specific location to a specific color.
ï?®
Draw lines and rectangles to the framebuffer.
ï?®
Draw previously loaded images to the framebuffer. We'd like to be able to draw
either the complete image or portions of it. We also need to be able to
draw images with and without blending.
ï?®
Get the dimensions of the framebuffer.
 
 
Search WWH ::




Custom Search