[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Graphics' (#lcl)

# AllocPatternBitmap

Ensures that a Pattern Bitmap with the specified colors exists in the Pattern cache.

## Declaration

Source position: graphics.pp line 2011

`function AllocPatternBitmap(`
`colorBG: TColor;`
`colorFG: TColor`
`):TBitmap;`

## Arguments

`colorBG` |  | Background color for the Bitmap.
`colorFG` |  | Foreground color for the Bitmap.

## Function result

Bitmap retrieved or created with the specified colors.

## Description

AllocPatternBitmap is a TBitmap function used to ensure that a bitmap with the specified colors exists in the internal pattern cache.

AllocPatternBitmap tries to locate a TPatternBitmap instance with the colors specified in colorBG and colorFG. If the requested Pattern Bitmap does not already exist, it is created and added to the pattern cache.

The return value is the TBitmap instance stored in the Bitmap property for the cached TPatternBitmap instance. No actions are performed if the Pattern cache has not been assigned; the return value is Nil in this situation.

## See also

TBitmap |  | Implements a FCL-compatible reader/writer for a Bitmap image.