Sign in Join
FPDoc Onlineexperiment

TCustomIcon class

In unit Graphics

TCustomIcon - base class for TIcon.

Declaration

pascal
TCustomIcon = class(TRasterImage)

Inheritance

  1. TCustomIcon
  2. TRasterImage
  3. TGraphic
  4. TPersistent
  5. TObject

Descends from it: TCursorImage TIcnsIcon TIcon

Description

TCustomIcon is a TRasterImage descendant which implements the base class for TIcon. TIcon supports image files using the .ICO file format. An .ICO file typically contains several images with different sizes and/or color depths.

TCustomIcon extends the ancestor class to include an internal list of images, and provides overridden methods which use the list of images in their implementations. This includes the ReadData method used during LCL component streaming. ReadStream is overridden to handle not only multiple images but PNG and DIB image formats used in some Icon files.

When loading an icon file, the largest/most colorful image is selected as the current image. Other sizes and/or color depths are accessed by setting the value in the Current property, or using Size when Current is not already set, or by setting Current to the value from the GetBestIndexForSize method.

Use the Count, Add, Delete, Remove, Clear, and AssignImage methods to maintain the images in the internal list.

Please note that writing to an icon file is not currently implemented in TCustomIcon (or descendent classes).

See also

Properties

CurrentpublicOrdinal position for the current image displayed for the icon.
CountpublicNumber of images in the image list for the shared icon.

Methods

MaskHandleNeededprotectedEnsures that a handle for the mask in the icon is valid.
PaletteNeededprotectedAn empty implementation in TCustomIcon.
CanShareImageprotectedIndicates whether the image class type has a shared handle.
CheckRequestedSizeprotectedCheckRequestedSize - method to ensure correct size requested.
GetIndexprotectedGetIndex - returns the Index value of the Icon with specified format and size (.icn files can contain several versions of image).
GetBitmapHandleprotectedGets the value for the BitmapHandle property.
GetDefaultSizeprotectedGetDefaultSize - returns default size for Icon.
GetMaskHandleprotectedGets the value for the MaskHandle property.
GetPaletteprotectedGets the value for the Palette property.
GetPixelFormatprotectedGets the value for the PixelFormat property.
GetRawImagePtrprotectedGets a pointer to the raw image data for the icon.
GetRawImageDescriptionPtrprotectedGets a pointer to the metadata for the raw image data.
GetTransparentprotectedGets the value for the Transparent property.
GetSharedImageClassprotectedGets the class reference used to create new shared image instances in the class.
GetStreamSignatureprotectedGets the stream signature used for icon data.
GetTypeIDprotectedGets the icon type identifier used in the image list header.
HandleNeededprotectedEnsures that a handle for the image has been allocated.
InternalReleaseBitmapHandleprotectedInternalReleaseBitmapHandle - releases Bitmap Handle and returns its value.
InternalReleaseMaskHandleprotectedInternalReleaseMaskHandle - releases Mask Handle and returns its value.
InternalReleasePaletteprotectedInternalReleasePalette - releases Palette Handle and returns its value.
IsStreamFormatSupportedprotectedIndicates whether the specified stream contains image data with a format supported for use in derived TCustomIcon classes.
ReadDataprotectedReads data for the class instance from a stream.
ReadStreamprotectedReads the content for the icon from the specified stream.
SetPixelFormatprotectedSets the value for the PixelFormat property.
SetTransparentprotectedSets the value for the Transparent property.
UnshareImageprotectedUnshares the shared image when the content in the icon is changed.
UpdateCurrentViewprotectedUpdateCurrentView - updates the current appearance of the Icon.
SetHandleprotectedUnshares an existing shared image handle and set the new value.
UpdateHandleprotectedUpdates the handle in the shared icon image top the specified value.
UpdateHandlesprotectedSets the Bitmap and Mask handles for the current image in the icon.
WriteStreamprotectedWrites the content for the multi-image icon to the specified stream.
CreatepublicConstructor for the class instance.
AddpublicAdd - an Icon formatted as AFormat, with specified Height and Width.
AssignpublicCopies values from the specified persistent object into the current class instance.
AssignImagepublicCopies image data from the source image to the current icon image.
ClearpublicRemoves the image content for the icon.
DeletepublicDeletes the image at the specified position in the list of images for the icon.
RemovepublicRemoves an icon image with the specified attributes.
GetDescriptionpublicGets metadata which describes the icon image at the specified position in the image list.
SetSizepublicSets the size (width, height) for the image in the Icon.
GetFileExtensionspublicGets a delimited list of file extensions supported for the image type.
LazarusResourceTypeValidpublicDetermines if the specified resource type is valid for the image format.
LoadFromResourceNamepublicLoads the icon with the specified resource name from the instance handle.
LoadFromResourceIDpublicLoad icon data from a resource with the specified integer resource identifier.
LoadFromResourceHandlepublicLoads icon data from the specified instance and resource handles.
BitmapHandleAllocatedpublicIndicates if a handle for the icon image has been allocated.
MaskHandleAllocatedpublicTrue if a handle has been allocated for the mask in the image.
PaletteAllocatedpublicDetermine if a handle has been allocated for the Palette in the icon.
SetHandlespublicNot implemented in TCustomIcon.
SortpublicSorts the images for the icon.
GetBestIndexForSizepublicGets the ordinal position for the image closest to the requested size.
ExportImagepublicExports the image for the icon at the specified index to another TFPImageBitmap class instance.

Fields

FCurrentprotectedLocal member variable used to hold the current sequence number.
FRequestedSizeprotectedMember used for the requested icon size.

Inherited

From TRasterImage (49)

ApplyTransparent BeginUpdate BitmapHandle BitmapHandleNeeded Canvas Changed CreateDefaultBitmapHandle CreateIntfImage Destroy Draw EndUpdate FreeImage FreeSaveStream GetEmpty GetHandle GetHeight GetMasked GetMimeType GetSize GetSupportedSourceMimeTypes GetWidth HandleAllocated LoadFromBitmapHandles LoadFromDevice LoadFromIntfImage LoadFromMimeStream LoadFromRawImage LoadFromStream Mask Masked MaskHandle PixelFormat RawImage ReleaseBitmapHandle ReleaseMaskHandle ReleasePalette RequestTransparentColor SaveStreamNeeded SaveToStream ScanLine SetBitmapHandle SetHeight SetMasked SetMaskHandle SetTransparentMode SetWidth TransparentColor TransparentMode WriteData

From TGraphic (23)

DefineProperties Empty Equals GetResourceType Height LoadFromClipboardFormat LoadFromClipboardFormatID LoadFromFile LoadFromLazarusResource MimeType Modified OnChange OnProgress Palette PaletteModified Progress SaveToClipboardFormat SaveToClipboardFormatID SaveToFile SetModified SetPalette Transparent Width

From TPersistent (6)

AssignTo FPOAttachObserver FPODetachObserver FPONotifyObservers GetNamePath GetOwner

From TObject (39)

AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName SafeCallException StringMessageTable SystemHasExtendedRTTI ToString UnitName

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.