I am trying to learn GapiDraw. However, after reading the docs I still have questions.
Let me make sure I understand.
1) Is Blitting the process of putting an image on the background permanently (until the background is erased)?
2) What is the difference between Rectangles and Surfaces? Do Rectangles have images in them? Are the similar to sprites? Could someone explain the differences?
I have more questions but need to get these answered first.
PS. You see, I come from a world of background and adding sprites.
Bltting is the process of drawing an image to a surface (not necessarily the backbuffer). A rectangle is simply a defined area (typically defined in a RECT structure). It usually defines an area to Blt to or from.
Thanks for posting. I am still confused though. Is it best to use a Rectangle as a sprite, or a Surface image? What would be the easiest way to create a sprite? Thanks
Ok a surface is an area of memory that you can draw to, so like a bit of paper
The back buffer is a surface , but you would make another surface to load the image of your sprite into to store in memory.
A rect is just a measurement, imagine a frame over your bit of paper
edit: to add, You can then blit the sprite surface on to the back buffer which effectively copies the data on the sprite surface to a position on the back buffer.
You could use a rect to store the size of a surface , or define an area to copy to
Blt (block transfer) means copying data in memory, in this case, image data.
Image data is stored in surfaces. Think of the surface as memory containing the values for the pixels at each x/y of the surface.
So an image for a sprite might be in one surface. You blt that data (src) to a particular location of another surface (dest) to draw into the second surface.
In this case, the backbuffer is a special surface that represents the screen. Drawing to this surface does not draw onto the physical screen. Rather, once per frame, this backbuffer is copied (blt again) to the buffer which represents the physical screen.
Once you've drawn something to the backbuffer, it will stay there (repeatedly drawn to the physical screen every frame) until you change it (e.g. by erasing the backbuffer). One style is to redraw the entire backbuffer each frame, but there are other styles of handling this also.
A rect is just a math type storing numbers representing a rectangle.
To make sprites, which might have images, location, velocity, etc., you would build them using these tools. They aren't built into GapiDraw. However, you may find others have made libraries using GapiDraw that provide sprites.