Graphic#

Qualified name: delphivcl.Graphic

class Graphic#

Bases: Persistent

TGraphic is the abstract base class type for objects such as icons, bitmaps, and metafiles that can store and display visual images. TGraphic is an abstract class that cannot be instantiated. Descendant graphics objects override many of the methods of TGraphic to address the needs of their particular file format and graphical characteristics. TGraphic also introduces methods that work with TPicture objects and the Clipboard. Properties of TGraphic provide information about the state and size of the graphic image. When the type of graphic is known, store the graphic in its specific type object. Otherwise, use a TPicture object that can hold any type of TGraphic.

Methods

CanLoadFromStream

CanLoadFromStream returns True when a specified stream contains a streamed image of a specific TGraphic subclass.

Create

Create TGraphic object.

Destroy

Destroys the TPersistent instance and frees its memory.

DisableScaledDrawer

DisableScaledDrawer Disables scaled drawer for a graphic.

EnableScaledDrawer

EnableScaledDrawer Enables scaled drawer for a graphic, which is used to scale the graphic.

Equals

Compare graphic to another TGraphic object and return true if objects contain same graphic.

LoadFromClipboardFormat

Introduces an abstract method that loads the image from a variable in Clipboard format.

LoadFromFile

Loads a graphic image stored in a file.

LoadFromStream

Introduces an abstract method that loads the image from a stream.

SaveToClipboardFormat

Introduces an abstract method that assigns the graphic to a variable in clipboard format.

SaveToFile

Saves a graphics image to a file.

SaveToStream

Introduces an abstract method that saves the graphic image to a stream.

SetSize

Specifies the size of the graphic.

UpdateScaledDrawer

Embarcadero Technologies does not currently have any additional information.

Attributes

ClassName

Returns the TObject.ClassName

Empty

Indicates whether the graphics object contains a graphic.

Height

Specifies the vertical size of the graphic in pixels.

Modified

Indicates whether the graphics object has been changed or edited.

OnChange

<Delphi property OnChange of type TGraphic at 21141225010>

OnProgress

<Delphi property OnProgress of type TGraphic at 211412250E0>

Palette

Indicates the color palette of the graphical image.

PaletteModified

Indicates whether the palette has changed.

ScaledDrawer

Returns the reference to the scaled drawer.

SupportsPartialTransparency

Indicate whether graphic supports partial transparency or an alpha channel.

Transparent

Indicates whether the image covers its rectangular area.

Width

Determines the maximum width of the graphics object in pixels.

CanLoadFromStream(Stream: Stream) Boolean#

CanLoadFromStream returns True when a specified stream contains a streamed image of a specific TGraphic subclass. The method uses current stream position, it does not change current stream position.

Create()#

Create TGraphic object. This method creates and intializes a TGraphic object.

Destroy()#

Destroys the TPersistent instance and frees its memory. Vcl.Graphics.TGraphic.Destroy inherits from System.Classes.TPersistent.Destroy. All content below this line refers to System.Classes.TPersistent.Destroy. Destroys the TPersistent instance and frees its memory. Do not call Destroy directly. Call Free instead. Free checks that the object reference is not nil before calling Destroy.

DisableScaledDrawer()#

DisableScaledDrawer Disables scaled drawer for a graphic.

See also ScaledDrawer EnableScaledDrawer

Empty#

Indicates whether the graphics object contains a graphic. Use Empty to determine whether the graphic is bound to an image. Each descendant graphic object defines its own Get method to access the Empty property.

EnableScaledDrawer(AGraphicScalerClass: ScaledGraphicDrawerClass, AInitialize: Boolean)#

EnableScaledDrawer Enables scaled drawer for a graphic, which is used to scale the graphic. AGraphicScalerClass specifies the scaled drawer class, for example TWICScaledGraphicDrawer.

See also ScaledDrawer DisableScaledDrawer

Equals(Obj: Object) Boolean#

Compare graphic to another TGraphic object and return true if objects contain same graphic. Equals compares the contents of two TGraphic objects. Equals returns false if the TGraphic are different classes or if they contain different graphical data.

Code Examples TGraphic (Delphi) TGraphic (C++) Compare graphic to another TGraphic object and return true if objects contain same graphic. Equals compares the contents of two TGraphic objects. Equals returns false if the TGraphic are different classes or if they contain different graphical data.

Code Examples TGraphic (Delphi) TGraphic (C++)

Height#

Specifies the vertical size of the graphic in pixels. Use Height to determine the height of the graphic image. Each descendant graphic object defines its own Get and Set methods to access the Height property.

Code Examples SaveToFile (Delphi) ScanLine (Delphi) SaveToFile (C++) ScanLine (C++)

LoadFromClipboardFormat(AFormat: Word, AData: NativeUInt, APalette: HPALETE)#

Introduces an abstract method that loads the image from a variable in Clipboard format. Each descendant graphic object defines a LoadFromClipboardFormat method that replaces the current graphic image with the graphic indicated by AData, which it loads from the Clipboard. The format for the new graphic object must be registered with the Clipboard in the RegisterClipboardFormat method, or an exception is raised.

LoadFromFile(Filename: string)#

Loads a graphic image stored in a file. LoadFromFile reads the file specified in FileName and loads the data into the graphics object.

LoadFromStream(Stream: Stream)#

Introduces an abstract method that loads the image from a stream. Each descendant graphic object defines a LoadFromStream method that loads a graphics object from Stream.

Modified#

Indicates whether the graphics object has been changed or edited. If Modified is true, the graphic object has changed. If Modified is false, the graphics object is in the same state as when the object was loaded. The Modified property indicates only if bitmap objects have been modified. Modified is not true if the graphics object contains an icon or metafile graphic, even if they have been modified. If the graphics object was modified, save the changes to a file with the SaveToFile method. The next time the application runs, it can load the graphic from the file with the LoadFromFile method.

OnChange#

<Delphi property OnChange of type TGraphic at 21141225010>

OnProgress#

<Delphi property OnProgress of type TGraphic at 211412250E0>

Palette#

Indicates the color palette of the graphical image. Use Palette to get the color palette of a graphical image. If the graphic does not need or does not use a palette, the Palette property is zero.

Code Examples GetDeviceContext (Delphi) GetDeviceContext (C++)

PaletteModified#

Indicates whether the palette has changed. Use PaletteModified to determine if the palette used for a graphical image has changed. PaletteModified is used in the OnChange event. PaletteModified remains true until whoever is responsible for realizing this new palette (for example, TImage) sets it to false.

SaveToClipboardFormat(AFormat: Word, AData: NativeUInt, APalette: HPALETE)#

Introduces an abstract method that assigns the graphic to a variable in clipboard format. Each descendant graphic object defines a SaveToClipboardFormat method that saves that particular graphic image type to a Clipboard format. An application must have registered the format with the TGraphic object using the RegisterClipboardFormat method.

SaveToFile(Filename: string)#

Saves a graphics image to a file. SaveToFile writes the graphic to a file, specified by Filename.

Code Examples TJPEGImageAssign (Delphi) TJPEGImageAssign (C++) ImageProc Sample

SaveToStream(Stream: Stream)#

Introduces an abstract method that saves the graphic image to a stream. Each descendant graphic object defines a SaveToStream method that saves the object to a Stream.

ScaledDrawer#

Returns the reference to the scaled drawer. When the scaled drawer is enabled for graphic, then the ScaledDrawer property returns the reference to it.

See also EnableScaledDrawer

SetSize(AWidth: Integer, AHeight: Integer)#

Specifies the size of the graphic. Use the SetSize method to set both the height and width of the graphic. This results in better performance than setting the height and width separately.

SupportsPartialTransparency#

Indicate whether graphic supports partial transparency or an alpha channel. SupportsPartialTransparency indicates whether the graphic supports partial transparency or an alpha channel. Some TGraphic descendants, such as TBitmap and TPngImage, can support partial transparency or an alpha channel. When a graphic that supports partial transparency is drawn on a canvas using DrawTransparent, it should be blended with the pixels on the canvas based on the value of the alpha channel.

Transparent#

Indicates whether the image covers its rectangular area. Use Transparent to specify that the graphic be drawn transparently. Some descendants of TGraphic such as TIcon and TMetafile are always transparent, so setting the property for those objects does not change their behavior. However, the TBitmap graphic’s drawing is affected by this property. The TImage component sets this property to be the same as its Transparent property to achieve transparent painting. When the Transparent property is set to True, you can either specify a color as the transparent color or you can use the default color, which is the pixel in the lower left. The specified color is not displayed in the graphic, which lets the background show through. This can be useful in layering and for non-rectangular graphics.

Code Examples FileSelectBtnEdit (Delphi) TransparentColor (Delphi) FileSelectBtnEdit (C++) TransparentColor (C++)

UpdateScaledDrawer()#

Embarcadero Technologies does not currently have any additional information.

Width#

Determines the maximum width of the graphics object in pixels. Each descendant graphic object defines its own Get and Set methods to access the Width property.

Code Examples SaveToFile (Delphi) ScanLine (Delphi) SaveToFile (C++) ScanLine (C++)