CachedBitmap::CachedBitmap(Bitmap*,Graphics*) method (gdiplusheaders.h)

Creates a CachedBitmap::CachedBitmap object based on a Bitmap object and a Graphics object. The cached bitmap takes the pixel data from the Bitmap object and stores it in a format that is optimized for the display device associated with the Graphics object.

Syntax

void CachedBitmap(
  Bitmap   *bitmap,
  Graphics *graphics
);

Parameters

bitmap

Type: [in] Bitmap*

Pointer to a Bitmap object that contains the pixel data to be optimized.

graphics

Type: [in] Graphics*

Pointer to a Graphics object that is associated with a display device for which the image will be optimized.

Return value

None

Remarks

You can display a cached bitmap by passing the address of a CachedBitmap::CachedBitmap object to the DrawCachedBitmap method of a Graphics object. Use the Graphics object that was passed to the CachedBitmap::CachedBitmap constructor or another Graphics object that represents the same device.

Examples

The following example creates a CachedBitmap::CachedBitmap object based on a Bitmap object and a Graphics object. The code calls the DrawCachedBitmap method of that Graphics object to display the cached bitmap.

VOID Example_CachedBitmap(HDC hdc)
{
   Graphics graphics(hdc);
   Bitmap bitmap(L"Grapes.jpg");
   CachedBitmap cachedBitmap(&bitmap, &graphics);

   graphics.DrawCachedBitmap(&cachedBitmap, 10, 10);  
}

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplusheaders.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Bitmap

CachedBitmap

Graphics

Image

Using a Cached Bitmap to Improve Performance