<< Click to display table of contents >> TRVThumbnailMaker |
This class creates smooth scaled copies of images.
Unit [VCL/FMX]: RVThumbMaker / fmxRVThumbMaker;
Syntax
TRVThumbnailMaker = class;
(introduced in version 15)
A single variable of this class is created: RVThumbnailMaker. You can change properties and call methods of the object returned in this variable.
MaxThumbnailSize: Integer. Maximal possible width and height of scaled images.
For VCL and LCL:
procedure AllowThumbnailsFor(Cls: TGraphicClass);
procedure DisallowThumbnailsFor(Cls: TGraphicClass);
For all frameworks:
function IsAllowedFor(Gr: TRVGraphic): Boolean;
function MakeThumbnail(Gr: TRVGraphic; Width, Height: Integer): TBitmap;
AllowThumbnailsFor allows making scaled images for the specified graphic class.
Delphi: By default, scaling is allowed for TBitmap, TPngImage and TJPEGImage. For Delphi 2010 or newer, scaling is allowed for TWicImage as well (used for TIFF images). For old versions of Delphi (Delphi 2007 and older), thumbnails are not created for transparent images.
Lazarus: By default, scaling is allowed for all images of classes inherited from TFPImageBitmap (that includes all Lazarus raster graphic formats).
AllowThumbnailsFor disallows scaling for the specified graphic class.
IsAllowedFor tests if scaling allowed for the specified graphic.
MakeThumbnail creates and returns a bitmap made from Gr and scaled to Width x Height. If Width or Height exceeds MaxThumbnailSize, they are reduced proportionally. The method returns nil in the following cases:
▪making scaled images is not allowed for Gr;
▪Gr is empty (0 x 0);
▪Gr.Width=Width and Gr.Height=Height;
▪both max(Gr.Width, Gr.Height) and max(Width, Height) exceed MaxThumbnailSize, and Gr is smaller than Width x Height (because we want to enlarge the image, but it would be shrunken instead)
See also: