rvico TRichView Reference | Classes

TRVThumbnailMaker

Top  Previous  Next

This class creates smooth scaled copies of images.

Unit RVThumbMaker;

Syntax

TRVThumbnailMaker = class;

(introduced in version 15)

Using

A single variable of this class is created: RVThumbnailMaker. You can change properties and call methods of the object returned in this variable.

Properties

MaxThumbnailSize: Integer. Maximal possible width and height of scaled images.

Methods

procedure AllowThumbnailsFor(Cls: TGraphicClass);

procedure DisallowThumbnailsFor(Cls: TGraphicClass);

function IsAllowedFor(Gr: TGraphic): Boolean;

function MakeThumbnail(Gr: TGraphic; Width, Height: Integer): TBitmap;

AllowThumbnailsFor allows making scaled images for the specified graphic class. 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). Thumbnails are not created for transparent images.

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

See also:

smooth image scaling


TRichView © trichview.com