Back to Devexpress

TdxSmartGlyph Class

vcl-dxgdiplusclasses-614c6d5e.md

latest22.4 KB
Original Source

TdxSmartGlyph Class

A DPI-aware universal image container that can load an image from a DFM file.

Declaration

delphi
TdxSmartGlyph = class(
    TdxSmartImage,
    IdxSourceDPI,
    IdxSourceSize
)

Remarks

The TdxSmartGlyph class is a TGraphic descendant that implements a universal image container with DPI awareness support in DevExpress products. An image container supports multiple formats and implements an extensive API for image import, export, conversion, and draw operations.

In this topic…

How to Use TdxSmartGlyph

Most DevExpress controls use TdxSmartGlyph instances to manage and display UI element icons. You can use any property of the TdxSmartGlyph type directly as demonstrated in the following code example: Load a Custom Button Glyph.

Refer to the following section for a full list of properties that use the TdxSmartGlyph type: Direct TdxSmartGlyph Class References.

Use TdxSmartGlyph Independently

Add the dxGDIPlusClasses unit to the uses clause of your project (in Delphi) or include the dxGDIPlusClasses header to the required source code file (in C++Builder).

Supported Image Formats

All supported formats are implemented as the following codec classes derived from the TdxSmartImageCodec class:

TdxGPImageCodecBMPA Device-Independent Bitmap (BMP/DIB) image format codec.TdxGPImageCodecGIFA Graphics Interchange Format (GIF) codec.TdxGPImageCodecJPEGA Joint Photographic Experts Group (JPEG) image format codec.TdxGPImageCodecPNGA Portable Network Graphics (PNG) image format codec.TdxGPImageCodecTIFFA Tagged Image File Format (TIFF) codec.TdxSVGImageCodecA Scalable Vector Graphics (SVG) image format codec.TdxGPImageCodecWMFA Windows Metafile (WMF) image format codec.

All image format implementations (except for SVG) available in DevExpress VCL products rely on the native image format encoder functionality of the Windows Imaging Component (WIC).

Tip

You can use the ImageCodec property to identify the current image format or convert the stored image to a different bitmap format.

Main API Members

The list below outlines key members of the TdxSmartGlyph class that allow you to load and manage images in all supported formats.

Image Container Creation

This section contains TdxSmartGlyph class constructors and other methods that allow you to create image containers.

CloneCreates a new image container populated with a copy of the stored image.CreateSizeThese overloaded methods create an image container filled with a specific color.CreateFromBitmap | CreateFromHBitmap | CreateFromBits | CreateFromStreamCreate an image container and populate it from the specified source.GetAsBitmapCreates a TBitmap container and populates it with the stored image.

Skin Palette-Related Settings

UseDisabledSkinPaletteForSVG | UseEnabledSkinPaletteForSVGSpecify if the active vector skin palette affects the stored SVG glyph.

DPI-Related Settings

SourceDPISpecifies the target monitor DPI for the stored image.SourceWidth | SourceHeightSpecify the image container’s pixel dimensions regardless of the stored image size.

Data Import and Export

Assign | AssignFromGraphic | AssignFromSmartImageRepopulate the image container with an image from another image container.CopyToClipboard | CutToClipboard | PasteFromClipboardMove image data between the image container and the clipboard.GetBitmapBitsReturns the stored image as an array of pixel data.LoadFromBits | LoadFromFieldValue | LoadFromResource | LoadFromFile | LoadFromStreamRepopulate the image container from the specified source.SaveToStream | SaveToStreamByCodecSave the stored image to a stream.SaveToFileSaves the stored image to a file.

Content and Resource Management

ClearClears the image container.ChangeColorFills all pixels of the stored image with a color.ConvertToBitmapRasterizes the stored vector image.CreateCanvas | StretchDrawDraw the stored image.DefaultImageExifAutoRotation

Specifies the default automatic image rotation setting based on EXIF metadata.

This class property defines the default EXIF image rotation for all image editors[1] and containers in the application.

Dormant | HandleNeededAllow you to suspend and restore the image container to optimize GDI resource usage.ExifAutoRotationAllows you to explicitly enable or disable automatic image rotation based on EXIF metadata.FlipFlips the stored image horizontally or vertically.ImageCodecSpecifies the format of the stored image. You can use this property to convert the stored image to any supported format, except for SVG.MakeCompositionThese overloaded functions blend two images from two image containers using the alpha channel.Resize | ScaleScale the source image.

Animation and Multi-Frame Image Settings

ActiveFrameSpecifies the currently displayed frame in a multi-frame image.AnimationFrameCountReturns the number of frames in a multi-frame image.Animation | AnimationLoop | AnimationLoopCount | AnimationLoopIndex | StartAnimation | StopAnimationAllow you to track and manage animation playback for the stored animated image.

General-Purpose API Members

ClientRect | SizeReturn stored image dimensions.CompareCompares two image containers.GetHashCodeCalculates a CRC32 hash code from stored image data.IsAlphaUsedAllows you to identify if the stored image has transparent pixels.

Code Example: Load a Custom Button Glyph

The following code example displays a custom glyph instead of an ellipsis in a button editor:

delphi
var
  AEditButton: TcxEditButton;
begin
  AEditButton := cxButtonEdit1.Buttons[0];
  AEditButton.Kind := bkGlyph; // Changes the button content type to "Glyph"
  AEditButton.Glyph.LoadFromFile('Search.svg'); // Loads a custom glyph
end;
cpp
TcxEditButton *AEditButton;
  // ...
  AEditButton = cxButtonEdit->Buttons[0];
  AEditButton->Kind = bkGlyph; // Changes the button content type to "Glyph"
  AEditButton->Glyph->LoadFromFile("Search.svg"); // Loads a custom glyph

Direct TdxSmartGlyph Class References

The following list groups public API members that reference a TdxSmartGlyph object by DevExpress product.

ExpressQuantumGrid

TcxCustomGridColumn.HeaderGlyphSpecifies the column header glyph.

ExpressEditors

TcxButtonImageOptions.GlyphSpecifies one or more glyphs that the button can display.TcxCustomButton.Glyph Deprecated. This property exists for backward compatibility only. Use the OptionsImage.Glyph property instead.TcxCustomCheckBoxProperties.GlyphProvides custom images for check boxes.TcxCustomCheckComboBoxProperties.GlyphProvides custom images for check boxes.TcxCustomCheckGroupProperties.GlyphSpecifies one or more glyphs the check group editor can display as check box states.TcxCustomCheckListBox.GlyphProvides custom images for check boxes.TcxCustomDropDownEditProperties.ButtonGlyphSpecifies the custom glyph for the drop-down button.TcxCustomEditButton.GlyphSpecifies the custom glyph for the editor button.TcxCustomLabelProperties.GlyphSpecifies the image used to draw the label’s caption.TcxHintStyle.IconThe custom icon displayed in a hint window.TdxCustomRatingControlProperties.CheckedGlyphSpecifies an image depicting a checked element within the rating control.TdxCustomRatingControlProperties.GlyphSpecifies an image depicting an unchecked element within the rating control.TdxCustomRatingControlProperties.HoverGlyphSpecifies an image depicting a hot-tracked element within the rating control.TdxToggleSwitchStateIndicator.OffGlyphSpecifies the image for the unchecked state (also called the Off state).TdxToggleSwitchStateIndicator.OnGlyphSpecifies the image for the checked state (also called the On state).TdxTokenEditToken.GlyphSpecifies the image associated with the token.TdxBadgeBackground.GlyphSpecifies the image used as the badge UI adorner‘s background.TdxGuideViewInfo.BorderGlyphReturns the bitmap mask used to paint the guide UI adorner‘s outlines.dxBadgeDefaultGlyphReturns a Smart Glyph containing the default glyph for badge UI adorners.dxGuideNormalBorderGlyphReturns a Smart Glyph containing the bitmap mask for the normal guide UI adorner borders.dxGuideSelectedBorderGlyphReturns a Smart Glyph containing the bitmap mask for the borders of the selected guide UI adorner.TdxWheelPickerItem.GlyphSpecifies the image to be displayed by the wheel item.

ExpressBars

TdxBarManager.HelpButtonGlyphSpecifies a bitmap which appears on the Help button in the Customization Form.TdxBar.GlyphSpecifies the icon that is displayed within a collapsed Ribbon tab group bound to the current toolbar.TdxBarItem.GlyphSpecifies the glyph that is displayed when this item’s link represents a standard size ( 16 by 16 pixels) item control.TdxBarItem.LargeGlyphSpecifies the glyph that is displayed when this item’s link represents a large button, enlarged standard size button, or large size menu item.TdxBarItemControl.GlyphReturns the item control’s glyph.TdxBarItemLink.GlyphProvides access to the glyph of the item control, which corresponds to the current item link.TdxBarItemLink.UserGlyphSpecifies an alternative (user-defined, for example) bar item glyph.TdxBarLargeButton.HotGlyphSpecifies the glyph that is drawn on the button when the button is selected.TdxBarLargeButtonControl.HotGlyphReturns the hot image associated with an item.TdxOfficeSearchBoxProperties.GlyphSpecifies a glyph for the Office Search Box editor.TdxRibbonCustomButtonPersistent.GlyphSpecifies the button’s glyph.TdxRibbonBackstageViewTabSheet.GlyphSpecifies a glyph for a tab.TdxRibbonGalleryGroupItem.GlyphSpecifies an explanatory image for a gallery item.TdxRibbonGalleryGroupItem.GlyphInDropDownTdxRibbonCustomRadialMenu.GlyphSpecifies the icon for the radial menu’s central button.TdxCustomRibbon.BackgroundImageSpecifies the background image for the Ribbon tab area and the Ribbon Form’s non-client area painted using the Ribbon.

ExpressLibrary

TdxCustomGalleryItem.GlyphSpecifies the glyph displayed.TdxCustomScreenTipBand.GlyphSpecifies the explanatory image for the ScreenTip section.

ExpressQuantumTreeList

TcxTreeListCaption.GlyphDefines the image displayed within the caption.

ExpressPDFViewer

TdxPDFViewerOptionsNavigationPage.GlyphSpecifies the glyph displayed within the page’s tab on the PDF Viewer control’s Navigation pane.

ExpressLayoutControl

TdxCustomLayoutGroupButton.GlyphSpecifies a glyph for the layout group button.TdxCustomLayoutItemCaptionOptions.GlyphSpecifies the caption’s glyph.TdxCustomLayoutItemImageOptions.GlyphSpecifies the caption’s glyph.TdxLayoutCheckBoxItemCheckBoxOptions.GlyphSpecifies one or more custom glyphs for a check box.

ExpressMapControl

TdxMapPointer.ImageSpecifies the map point item image.

ExpressTileControl

TdxTileControlActionBarItem.GlyphSpecifies the action bar item’s image.TdxTileControlTitle.GlyphSpecifies the title’s glyph.

ExpressWizardControl

TdxWizardControlCustomButton.GlyphSpecifies the button image.TdxWizardControlCustomButtonCollectionItem.GlyphSpecifies the button image.TdxWizardControlHeader.GlyphSpecifies the header image.TdxWizardControlTitle.GlyphSpecifies the wizard title image.

Other Image Container Classes

DevExpress products also use the following image container classes:

TdxSmartImageA universal image container used for image import, export, conversion, and draw operations.TdxOfficeImage

A bitmap image container that can store and manage inline and floating images in rich text documents.

Document management APIs in Rich Edit and Document Server components use this image container to work with images.

Implements

IdxSourceDPI

IdxSourceSize

Inheritance

TObject TPersistent TInterfacedPersistent TGraphic TdxCustomSmartImage TdxGPImage TdxSmartImage TdxSmartGlyph

Footnotes

  1. The TcxImage editor supports EXIF image rotation when used as a standalone editor or as an in-place editor in Data Grid, Tree List, Vertical Grid, and Pivot Grid controls.

See Also

TdxGPImage Class

TdxSmartGlyph Members

dxGDIPlusClasses Unit