Graphics

From IndieGuide

Jump to: navigation, search

Common terminology

  • Blit: from 'bit-blit'. Fancy name for copying image data from one place to another. Example;Put an image over another, e.g. putting the image of a little man over a background image.
  • Clip: cut out parts of an image to create a new smaller image. For instance, clip data that would otherwise be drawn outside the visible window area.
  • Colour keying: define the transparent colour in an image, i.e. the color that will not be drawn when blitting.
  • Onion skinning: Show previous and/or next frame with partial transparency; useful when drawing animations by hand.
  • Double buffering: Instead of using only one "screen", a second buffer is used to draw things while the user is seeing the first one. These are then swapped and the process continues.

Drawing lines

Straight lines

Drawing a straight line with pixels is best done with the Bresenham algorithm. The benefit is that it draws a line only one pixel wide.

Sources for the algorithm:

  • The algorithm is explained with sample C++ source code in the book "AI for Game Developers", by David M. Bourg & Glenn Seemann, page 12.
  • Wikipedia has also an explanation with some source code. The German entry has even more source code for different languages.
Personal tools
Advertisement