TBitmap32

Graphics32

TBitmap32

Hierarchy

TPersistent

   |

TNotifiablePersistent

   |

TThreadPersistent

   |

TCustomMap

Description

TBitmap32 is the central class in the Graphics32 library. It manages a single 32-bit device-independent bitmap (DIB) and provides methods for drawing on it and combining it with other DIBs or other objects with device context (DC).

TBitmap32 overrides Assign and AssignTo methods (inherited from TPersistent) to provide compatibility with standard objects: TBitmap, TPicture and TClipboard in both directions. The design-time streaming to and from *.dfm files, inherited from TPersistent, is supported, but its realization is different from streaming with other stream types (See the source code for details).

TBitmap32 does not implement its own low-level streaming or low-level file loading/saving. Instead, it uses streaming methods of temporal TBitmap or TPicture objects. This is an obvious performance penalty, however such approach allows using third-party libraries, which extend TGraphic class for various image formats support (JPEG, TGA, TIFF, GIF, PNG, etc.). When you install them, TBitmap32 will automatically obtain support for new image file formats in design time and in run time.

Since TBitmap32 is a descendant of TThreadPersistent, it inherits its locking mechanism and it may be used in multi-threaded applications.

Change Notification

Change notification events (OnCange, OnResize), inherited from TThreadPersistent and TCustomMap are generated by most drawing/resizing etc. functions with a few exceptions. Due to performance considerations the following functions are not accompanied with event generation:

  • Pixel-based operations (SetPixelT, SetPixelF...);
  • HorzLine* and VertLine* functions;

If necessary, the OnCange event may be generated explicitly by calling the Changed methods.

Normally, if the bitmap is a part of some container (TImage32, TBitmapLayer, etc.), its change notification events are linked to the container, causing repaint operations. When making several simultaneous changes, it may be beneficial to enclose them in BeginUpdateEndUpdate block followed by the Changed call to reduce the amount of repaintings of the container.

Reference

Properties Methods Events
In TBitmap32:
BitmapHandle BeginMeasuring OnAreaChanged
BitmapInfo CanvasAllocated OnHandleChanged
Bits Clear OnPixelCombine
Canvas Create
Clipping DeleteCanvas
ClipRect Destroy
CombineMode Draw
DrawMode DrawTo
Font Empty
Handle EndMeasuring
MasterAlpha FillRect
MeasuringMode FlipHorz
OuterColor FlipVert
PenColor FrameRect
Pixel GetStippleColor
PixelPtr HandleChanged
Pixmap HorzLine
PixmapChanged Line
Resampler LineTo
ResamplerClassName LoadFromFile
ScanLine LoadFromResourceID
StippleCounter LoadFromResourceName
StippleStep LoadFromStream
StretchFilter MoveTo
WrapMode RaiseRectTS
RenderText
ResetAlpha
ResetClipRect
Roll
Rotate
SaveToFile
SaveToStream
SetPixel
SetSize
SetStipple
TextExtent
TextHeight
TextOut
TextWidth
UpdateFont
VertLine
In TCustomMap:
Height Delete OnResize
Width Resized
In TThreadPersistent:
LockCount Lock
Unlock
In TNotifiablePersistent:
UpdateCount BeginUpdate OnChange
Changed
EndUpdate

See Also

BeginUpdate, Changed, EndUpdate, OnChange, TBitmapLayer, TCustomMap, TImage32, TThreadPersistent