Code Samples

The WinG development kit contains a variety of code samples to help you develop fast applications quickly using WinG.

Snippets

The following code samples appear in this help file:

Setting up an off-screen buffer with WinG.

Calculating the memory address of a scanline in a WinGBitmap.

Creating an Identity Palette.

Clearing the System Palette.

Maximizing palette availability using the SYSPAL_NOSTATIC setting.

Copying a logical palette to a WinGBitmap color table.

Matching an RGB color to a halftone palette entry.

Sample Applications

The WinG Development Kit also contains source code for several sample applications, installed in the \SAMPLES subdirectory. The following applications are available:

DOGGIE allows the user to drag a sprite around the screen with the mouse, demonstrating off-screen composition, dirty rectangle animation, and custom blt routines. Includes source code for a sample 8-bit DIB to 8-bit DIB blt with one transparent color.

CUBE displays a halftoned rotating cube in a window that the user can manipulate with the mouse. It demonstrates off-screen composition, double-buffering, and using the halftone palette and halftone brushes with GDI to draw into a WinGDC.

TIMEWING tests and compares blt speeds of existing GDI functions with the WinGStretchBlt function. This sample will give you an idea of how WinG will compare to standard GDI blts.

HALFTONE converts 24-bit RGB DIBs to 8-bit DIBs by dithering them to the WinG Halftone Palette. The source code implements a standard 8x8 dither and color matching to the halftone palette.

PALANIM performs simple palette animation with an identity palette using WinG. This application uses all of the sample code appearing in this help file.