Drawing Win32 GDI API Programming: Using Windows APIs to Draw on the Screen without DirectX or OpenGL

This Win32 GDI API programming tutorial is aimed at programmers who need to be able to draw on the screen using native Win32 GDI API calls, without learning the ins and outs of third party drawing libraries such as OpenGL or DirectX. While support for these is excellent under Win32, they are only really applicable where performance is paramount:

  • games programming
  • high-end CAD programming
  • video / photo manipulation
  • etc.

For most tasks, the Win32 GDI and GDI+ APIs are perfectly adequate, if a little slow when processing large amounts of drawing commands. The advantage, however outweighs this small deficit : if the programmer can draw on the screem, they can draw anywhere that the OS knows about:

  • the screen
  • a printer
  • a plotter
  • a metafile or enhanced metafile
  • an offscreen bitmap
  • etc.

This makes the Win32 GDI API very useful for a wide variety of applications.

Win32 Drawing WM_PAINT Processing

Most drawing is done in response to a request from Windows to repaint the client area of the screen. The programmer is informed of this necessity by the reception of a WM_PAINT message in their Windows message processing loop.

For more about processing this message, the reader should consult the Win32 Drawing WM_PAINT Processing article. Once painting has begun, the programmer must direct all output to a device context (or DC).

Getting a Device Context

The Device Context handle points to a specific definition of a device that has been selected via a device driver. Luckily for the programmer, the default DCs – screen, printer, etc. – are easily selected. For more information about how to choose and select a DC, the reader should read the Win32 CreateDC and GDI Functions article.

The DC abstracts the actual capabilities of the device into the Windows API, so that it can be manipulated using standard GDI commands, which usually operate on objects.

The Role of GDI and GDI Objects

GDI stands for Graphics Device Interface, and provides a consistent interface to graphics programming, no matter the target DC (device context).

It is important to remember that manipulation of the GDI is mainly performed through the selection of dedicated objects. The two primary objects are the Brush and Pen.

Brushes and Pens in the Win32 GDI API

A GDI Brush is used to paint the interior of a shape, while a Pen is used to draw the outside, or plot lines. They can …

Astonishing Astone Gadgets: Review

Astone Xinc FM: Small wonder – Nope, this isn’t a reincarnation of – the Tamagochi of the 90s. This is – the Astone Xinc FM digital audio player. It boasts of a decent 1.8 260K OLED display, MP3, WMA and WAV audio support, MPEG4, DiVX and AVI video playback, e-book compatibility, voice recording, and FM radio functionality as well as an FM transmitter so that you can blast your tunes on the car radio or your home component system. It doesn’t have an expansion slot, but the 2GB of memory is more than enough to fulfill all your music and video fantasies.

Ready to go

It also comes equipped with a car charger so that you always have juice while you’re on the road. Add that to FM transmitter functionality, then the Astone Xinc is a very reliable companion especially when you’re stuck in heavy traffic. You can either listen to your favorite tunes or watch your encoded videos on its LCD display-though it does get very tiring on the eyes after several minutes,

Bottom line

It could use a bigger and better screen resolution so that you can take better advantage of its other features, but for its size, price and functionality, this is a pretty decent buy for any music freak.

PROS

Ton of features in a small package.

Useful accessories for someone who’s always on the road.

Compatible with a variety of audio and video formats.

CONS

No regular outlet charger.

Astone Niva: Dress up your tunes

Simplicity with a twist

Despite its plain black square exterior, this MP3 player is anything but ordinary. Running on a single AAA battery, this tiny gizmo can sure pack in the tunes with its 512MB internal memory and expansion slot that supports up to 2GB of additional storage. It’s capable of playing MP3 and WMA files, has voice recording, lyric display support and FM radio functionality

Just the way you like it

What really sets the Niva apart from the rest is the inclusion of eight interchangeable covers that will make it fit whatever mood you’re in. However, we highly doubt that these covers are reusable since they’re nothing more than just stickers that have been designed specifically for the Niva to fit just right on the bare face of this digital audio player.

Back to basics

It’s equipped with a control button, which at first glance is deceptively similar …

Time Travel Wallpaper

Going back to a time, when nothing seemed possible

While nothing was impossible.

Could not dream or see past the things I could see,

Soul not open yet to my endless potential.

Learning to maximize the dreams within,

Listening to the loud, silent guides which

Dictate my footsteps.

Keeping me safe

Scaring me in the same instance,

Soul built on faith

Spirit led by inner light

That shines constantly,

Even in despair.

Going back to a time,

Becoming what I didn’t see, I could be

Loving, simply being me.

Existence of love,

Matter consistent with adoration

Of the most supreme being

That exists eternally

Lighting the external, internally.

Breaking through walls,

Of stubborn depression

To my breakthrough,

Embracing the time

That built my grittiness,

That showed me flowers can bloom

In the harshest conditions

True dreams’ beauty,

Is just as insistent

On becoming real

Going back to a time,

To release and heal.…