Unit contains definitions for many fundamental classes and types used in graphic applications Style of Brush to be used The Data associated with the current Pen The Operating System Handle associated with the current Pen The Colour of the curent Pen The Width in pixels of the current Pen The Style asociated with the current Pen The Style asociated with the current Pen
Can take any of the values: psSolid, psDash, psDot, psDashDot, psDashDotDot, psinsideFrame, psPattern,psClear
The current Pen for drawing on the current Canvas Pen Constructor Most of its properties are inherited from the parent class Pen Destructor Most of its properties are inherited from the parent class Copies the SourcePen to itself the Operating System Handle for the current Pen Reads or writes a flag to determine the handle The Colour of th ecurrent Pen Reads or Writes a flag to determine the colour. Default is black The Mode for the current Pen Can take any of the values:
pmBlack, pmWhite, pmNop, pmNot, pmCopy, pmNotCopy,
pmMergePenNot, pmMaskPenNot, pmMergeNotPen, pmMaskNotPen, pmMerge,
pmNotMerge, pmMask, pmNotMask, pmXor, pmNotXor
Default is pmCopy
The Style of the current Pen Can be one of the following:
psSolid, psDash, psDot, psDashDot, psDashDotDot, psinsideFrame, psPattern,psClear
Default is psSolid
The Width in pixels of the current Pen The Data associated with the current Brush The Operating System Handle associated with the current Brush The Colour to be used by the current Brush The Bitmap on which the current Brush is working The Style to be used by the current Brush Enumerated type defined in TBrushStyle The Brush to be used to Paint on the current Canvas Assign - copies a SourceBrush to itself Method: TBrush.Assign
Params: Source: Another brush
Returns: nothing
Copies the source brush to itself
Source - another Brush Brush constructor Inherits most of its properties from ancestor Classes Brush destructor Inherits properties to remove Brush and frees Handle The BitMap associated with the current Brush Reads or writes a flag to determine the current BitMap Operating System Handle for this Brush Reads or writes flag to determine system Handle The Colour of the current Brush Reads or writes a flag to determine the Colour. Default is White Style of the Brush Enumerated type - default Solid Base class for dealing with Graphic images The TGraphic class is an abstract base class for dealing with graphic images such as bitmaps, pixmaps, icons, and other image formats. It does not contain an actual area for displaying the image; this is provided by the descendant classes eg BitMap, Icon etc which have a Canvas element defined
LoadFromFile - Read the graphic from the file system. The old contents of the graphic are lost. If the file is not of the right format, an exception will be generated.
SaveToFile - Writes the graphic to disk in the file provided.
LoadFromStream - Like LoadFromFile except source is a stream (e.g. TBlobStream ).
SaveToStream - stream analogue of SaveToFile .
LoadFromClipboardFormat - Replaces the current image with the data provided. If the TGraphic does not support that format it will generate an exception.
SaveToClipboardFormats - Converts the image to a clipboard format. If the image does not support being translated into a clipboard format it will generate an exception.
Height - The native, unstretched, height of the graphic.
Palette - Color palette of image. Zero if graphic doesn't need/use palettes.
Transparent - Some parts of the image are not opaque, ie the background can be seen through.
Width - The native, unstretched, width of the graphic.
OnChange - Called whenever the graphic changes
PaletteModified - Indicates in OnChange whether color palette has changed. Stays true until whoever is responsible for realizing this new palette (ex: TImage) sets it to False.
OnProgress - Generic progress indicator event. Propagates out to TPicture and TImage OnProgress events.

As many of the methods and properties are virtual and/or abstract, it is the responsibility of the application programmer to supply suitable methods when implementing any descendant classes
TGraphic constructor Virtual method, so recommend that a constructor be supplied to override this method in descendant classes LoadFromFile - Read the graphic from the file system. LoadFromFile - Read the graphic from the file system.
The old contents of the graphic are lost.
If the file is not of the right format, an exception will be generated.
Incorrect file format generates an exception
The name of the file containing the graphic, held as a string SaveToFile - Writes the graphic to disk in the file provided. SaveToFile - Writes the graphic to disk in the file whose name is provided. The name of the file to which the graphic will be written LoadFromStream -reads graphic data from a stream (e.g. TBlobStream ) LoadFromStream - Like LoadFromFile except source is a stream (e.g. TBlobStream) Identity of the stream from which the graphic data are to be read SaveToStream - write graphic data to a stream SaveToStream - write graphic data to a stream Identity of the stream to which the graphic data are to be written LoadFromClipboardFormat - Replace the current image with the contents of the clipboard LoadFromClipboardFormat - Replaces the current image with the data provided from the clipboard. If the TGraphic does not support that format it will generate an exception. SaveToClipboardFormats - Converts the image to a clipboard format SaveToClipboardFormats - Converts the image to a clipboard format If the image does not support being translated into a clipboard format it will generate an exception Identity of the clipboard format Height - The native, unstretched, height of the graphic. Palette - Color palette of image Palette - Color palette of image. Zero if graphic doesn't need/use palettes Transparent - Some parts of the image are not opaque. ie the background can be seen through Width - The native, unstretched, width of the graphic. TPicture is a TGraphic container, used in place of a TGraphic if the graphic can be of any TGraphic class. TPicture is a TGraphic container. It is used in place of a TGraphic if the graphic can be of any TGraphic class.
It is not a direct descendant of TGraphic , so you will not see TGraphic listed in the Inheritance chart, but it contains a property Graphic , of type TGraphic , so can contain all the properties of a TGraphic

Defines many private methods for getting and storing various sorts of images such as bitmaps, pixmaps, icons, PNGs etc
It does not itself contain a defined area for displaying the image, but this is supplied by the descendant classes such as BitMap, PixMap, PNG or Icon, which define a Canvas property.

LoadFromFile and SaveToFile are polymorphic. For example, if the TPicture is holding an Icon, you can LoadFromFile a bitmap file, where if the class is TIcon you could only read .ICO files.

LoadFromFile - Reads a picture from disk. The TGraphic class created is determined by the file extension of the file. If the file extension is not recognized an exception is generated.
SaveToFile - Writes the picture to disk.
LoadFromClipboardFormat - ToDo: Reads the picture from the handle provided in the given clipboard format. If the format is not supported, an exception is generated.
SaveToClipboardFormats - ToDo: Allocates a global handle and writes the picture in its native clipboard format (CF_BITMAP for bitmaps, CF_METAFILE for metafiles, etc.). Formats will contain the formats written. Returns the number of clipboard items written to the array pointed to by Formats and Datas or would be written if either Formats or Datas are nil.
SupportsClipboardFormat - Returns true if the given clipboard format is supported by LoadFromClipboardFormat .
Assign - Copies the contents of the given TPicture. Used most often in the implementation of TPicture properties.
RegisterFileFormat - Register a new TGraphic class for use in LoadFromFile.
RegisterClipboardFormat - Registers a new TGraphic class for use in LoadFromClipboardFormat.
UnRegisterGraphicClass - Removes all references to the specified TGraphic class and all its descendants from the file format and clipboard format internal lists.
Height - The native, unstretched, height of the picture.
Width - The native, unstretched, width of the picture.
Graphic - The TGraphic object contained by the TPicture
Bitmap - Returns a bitmap. If the contents is not already a bitmap, the contents are thrown away and a blank bitmap is returned.
Pixmap - Returns a pixmap. If the contents is not already a pixmap, the contents are thrown away and a blank pixmap is returned.
PNG - Returns a png. If the contents is not already a png, the contents are thrown away and a blank png (TPortableNetworkGraphic) is returned.
PNM - Returns a pnm. If the contents is not already a pnm, the contents are thrown away and a blank pnm (TPortableAnyMapGraphic) is returned.
TPicture constructor TPicture destructor Any destructor method defined here will override destructors defined in ancestor classes LoadFromFile - Reads a picture from disk LoadFromFile - Reads a picture from disk. The TGraphic class created is determined by the file extension of the file. If the file extension is not recognized an exception is generated The name of the file containing the picture, stored as a string SaveToFile - Writes the picture to disk The name of the file to save the picture, stored as a string LoadFromClipboardFormat LoadFromClipboardFormat - ToDo: Reads the picture from the handle provided in the given clipboard format. If the format is not supported, an exception is generated The identifier for the clipboard format SaveToClipboardFormats - Allocates a global handle and writes the picture in its native clipboard format SaveToClipboardFormats - ToDo: Allocates a global handle and writes the picture in its native clipboard format (CF_BITMAP for bitmaps, CF_METAFILE for metafiles, etc.). Formats will contain the formats written. Returns the number of clipboard items written to the array pointed to by Formats and Datas or would be written if either Formats or Datas are nil. Identity of the clipboard format SupportsClipboardFormat - Returns true if the given clipboard format is supported by LoadFromClipboardFormat Boolean - returns true if format supported Identity of the clipboard format Assign - Copies the contents of the given TPicture Assign - Copies the contents of the given TPicture. Used most often in the implementation of TPicture properties. RegisterFileFormat - Register a new TGraphic class for use in LoadFromFile RegisterClipboardFormat - Registers a new TGraphic class for use in LoadFromClipboardFormat UnRegisterGraphicClass - Removes all references to the specified TGraphic UnRegisterGraphicClass - Removes all references to the specified TGraphic class and all its descendants from the file format and clipboard format internal lists Clear - removes the graphic Bitmap - Returns a bitmap Bitmap - Returns a bitmap. If the contents is not already a bitmap, the contents are thrown away and a blank bitmap is returned Pixmap - Returns a pixmap Pixmap - Returns a pixmap. If the contents is not already a pixmap, the contents are thrown away and a blank pixmap is returned PNG - Returns a png PNG - Returns a png. If the contents is not already a png, the contents are thrown away and a blank png (TPortableNetworkGraphic) is returned Icon contained within the picture Graphic - The TGraphic object contained by the TPicture Height - The native, unstretched, height of the picture Width - The native, unstretched, width of the picture TCanvas - where most of the drawing is performed TCanvas is a class that defines a very large number of drawing methods including methods for pen and colour selection, producing shapes and filling them, setting or clearing individual pixels, and producing graphic text. Canvas constructor Canvas constructor: creates a new instance of the class TCanvas Canvas destructor Canvas destructor: removes this instance of TCanvas and makes its resources available Use Arc to draw an elliptically curved line with the current Pen Method: TCanvas.Arc
Params: ALeft, ATop, ARight, ABottom, sx, sy, ex, ey
Returns: Nothing

Use Arc to draw an elliptically curved line with the current Pen. The values sx,sy, and ex,ey represent the starting and ending radial-points between which the Arc is drawn.
Use Arc to draw an elliptically curved line with the current Pen Method: TCanvas.Arc
Params: ALeft, ATop, ARight, ABottom, angle1, angle2
Returns: Nothing

Use Arc to draw an elliptically curved line with the current Pen.
The angles angle1 and angle2 are 1/16th of a degree.
For example, a full circle equals 5760 (16*360).
Positive values of Angle and AngleLength mean counter-clockwise while negative values mean clockwise direction.
Zero degrees is at the 3 o'clock position.
Chord draws a filled Chord-shape on the canvas Method: TCanvas.Chord
Params: x1, y1, x2, y2, StartAngle16Deg, EndAngle16Deg
Returns: Nothing

Use Chord to draw a filled Chord-shape on the canvas. The angles angle1 and angle2 are 1/16th of a degree. For example, a full circle equals 5760(16*360).
Positive values of Angle and AngleLength mean counter-clockwise while negative values mean clockwise direction.
Zero degrees is at the 3 o'clock position.
Ellipse draws a filled circle or ellipse on the canvas Method: TCanvas.Ellipse
Params: X1, Y1, X2, Y2
Returns: Nothing

Use Ellipse to draw a filled circle or ellipse on the canvas.
Draws a Line from X1, Y1 to X2, Y2 LineTo draws a line from the current pen position to the new position: X1, Y1 Moves cursor to new position X1, Y1 without drawing anything RadialPie uses Pie to draw a filled pie-shaped wedge on the canvas Method: TCanvas.RadialPie
Params: x1, y1, x2, y2, StartAngle16Deg, EndAngle16Deg: Integer
Returns: Nothing

Uses Pie to draw a filled pie-shaped wedge on the canvas.
The angles StartAngle16Deg and EndAngle16Deg are 1/16th of a degree.
For example, a full circle equals 5760 (16*360).
Positive values of Angle and AngleLength mean counter-clockwise while negative values mean clockwise direction.
Zero degrees is at the 3 o'clock position
Pie draws a filled Pie-shaped wedge on the canvas Method: TCanvas.Pie
Params: EllipseX1, EllipseY1, EllipseX2, EllipseY2, StartX, StartY, EndX, EndY
Returns: Nothing

Use Pie to draw a filled Pie-shaped wedge on the canvas. The pie is part of an ellipse between the points EllipseX1, EllipseY1, EllipseX2, EllipseY2. The values StartX, StartY and EndX, EndY represent the starting and ending radial-points between which the Bounding-Arc is drawn.
Polybezier draws cubic Bezier curves Method: TCanvas.PolyBezier
Params: Points, Filled, Continous
Returns: Boolean

Use Polybezier to draw cubic Bezier curves.
The first curve is drawn from the first point to the fourth point with the second and third points being the control points.
If the Continuous flag is TRUE then each subsequent curve requires three more points, using the end-point of the previous Curve as its starting point, the first and second points being used as its control points, and the third point its end-point.

If the continous flag is set to FALSE, then each subsequent Curve requires 4 additional points, which are used exactly as in the first curve.

Any additonal points which do not add up to a full bezier(4 for Continuous, 3 otherwise) are ingored. There must be at least 4 points for an drawing to occur.

If the Filled Flag is set to TRUE then the resulting Poly-Bezier will be drawn as a Polygon.
Polygon draws a closed, many-sided shape on the canvas, using the value of Pen Method: TCanvas.Polygon
Params: Points: array of TPoint; Winding: Boolean = False; StartIndex: Integer = 0; NumPts: Integer = -1
Returns: Nothing

Use Polygon to draw a closed, many-sided shape on the canvas, using the value of Pen . After drawing the complete shape, Polygon fills the shape using the value of Brush .

The Points parameter is an array of points that give the vertices of the polygon.
Winding determines how the polygon is filled. When Winding is True, Polygon fills the shape using the Winding fill algorithm.
When Winding is False, Polygon uses the even-odd (alternative) fill algorithm.
StartIndex gives the index of the first point in the array to use. All points before this are ignored.
NumPts indicates the number of points to use, starting at StartIndex .
If NumPts is -1 (the default), Polygon uses all points from StartIndex to the end of the array.
The first point is always connected to the last point.
To draw a polygon on the canvas, without filling it, use the Polyline method, specifying the first point a second time at the end.
Polyline connects a set of points on the canvas Method: TCanvas.Polyline
Params: Points: array of TPoint; StartIndex: Integer = 0; NumPts: Integer = -1
Returns: Nothing

Use Polyline to connect a set of points on the Canvas . If you specify only two points, Polyline draws a single line.
The Points parameter is an array of points to be connected.
StartIndex identifies the first point in the array to use.
NumPts indicates the number of points to use. If NumPts is -1 (the default), PolyLine uses all the points from StartIndex to the end of the array.
Calling the MoveTo function with the value of the first point, and then repeatedly calling LineTo with all subsequent points will draw the same image on the canvas. However, unlike LineTo , Polyline does not change the value of PenPos .
Writes the Text string at the position X, Y on the canvas and leaves the pen at the end of the text Writes Text string within a specified rectangle, according to predefined Style Writes Text string within a specified rectangle, according to predefined Style
The boundaries of the rectangle are specified in ARect
X, Y specify the starting point for writing the Text within the rectangle
TextStyle determines whether the text is justified, centered, word-wrapped etc. If the Style argument is omitted, defaults are assumed
TBitmap is the data of an image, and can be loaded from a file, stream or resource in .bmp or .xpm format TBitmap is the data of an image. The image can be loaded from a file, stream or resource in .bmp (windows bitmap format) or .xpm (XPixMap format)
The loading routine automatically recognizes the format, so it is also used to load the images from Delphi form streams (e.g. .dfm files).
When the handle is created, it is up to the interface (gtk, win32, ...) to convert it automatically to the best internal format. That is why the Handle is interface dependent.
To access the raw data, see TLazIntfImage in IntfGraphics.pas
BitMap constructor BitMap constructor. The supplied code can override the definition from ancestor classes BitMap destructor BitMap destructor. The supplied code can override the method defined for ancestor classes Assign: find out about the Source of the call. Assign: find out about the Source of the call. If the BitMap data are already in use, the data are shared; if not, a new BitMap is produced LoadFromDevice: obtain BitMap data from a device with Handle DC LoadFromStream: obtains BitMap data from a Stream LoadFromLazarusResource: obtain data from a valid Lazarus Resource Stream LoadFromLazarusResource: obtain data from a valid Lazarus Resource Stream
Checks for the presence of a valid Lazarus Resource, then uses LoadFromStream to acquire the data
ToDo ToDo LoadFromXPMFile: obtain data from file in native PixMap format PixMap - a class derived from TBitMap , with wrapper to deal specifically with PixMaps (ie using 'XPM' format) PixMap - Checks that specified resources (PixMap image, File for storage, Stream for writing) are of correct type and format, organises saving and writing LazarusResourceTypeValid - checks that specified resource has correct format Returns True if resource type is 'XPM' WriteStream - writes PixMap data to specified stream True if size of data in stream has been specified GetDefaultFPReader - obtains the correct tool Returns the correct tool for reading GetDefaultFPWriter - obtains the correct tool Returns the correct tool for writing TIcon - icons, small images typically associated with applications, controls, etc. Stored in files with .ico extension TIcon reads and writes .ICO file format.
A .ico file typically contains several versions of the same image.
When loading, the largest/most colourful image is loaded as the TBitmap and so can be handled as any other bitmap. Any other versions of the images are available via the Bitmaps property
Writing is not (yet) implemented.
Bitmaps - the list of alternative bitmaps (of various sizes) TIcon destructor TIcon destructor. Method can override the destructor defined in ancestor classes Add a bitmap to the current list Note that Ownership passes to TIcon