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

# TSharedImage

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Specifies the base class for reference-counted shared images.

## Declaration

Source position: graphics.pp line 1189

`type TSharedImage = class`
`protected`
`procedure Reference;` |  | Increases the reference count.
`procedure Release;` |  | Decreases the reference count.
`procedure FreeHandle; virtual; abstract;` |  | Release the handle for this image and free its resources.
`property RefCount: Integer; [r]` |  | The number of references to this shared image.
`public`
`function HandleAllocated; virtual; abstract;` |  | Indicates whether a handle been allocated for the image.
`end;`

## Inheritance

`TSharedImage` |  | Specifies the base class for reference-counted shared images.
`TObject`

## Description

TSharedImage is a class which specifies the base class for reference-counted shared images. TSharedImage defines properties and methods which are used to track and maintain the reference count for a shared image.

Use the RefCount property to determine the number of references acquired for a shared image.

Use Reference to increment the value in RefCount. Use Release to decrement the value in RefCount.

TSharedImage includes abstract virtual methods, like HandleAllocated and FreeHandle, which must be implemented in a descendent class to perform actions needed for the handle in a specific image type.

TSharedImage is the ancestor for the TSharedRasterImage class.

## See also

TSharedRasterImage |  | Implements a reference counted raster image that may be shared between controls.