C# Class Serenity.Web.ThumbnailGenerator

Static class that contains thumbnail generator methods
Exibir arquivo Open project: volkanceylan/Serenity Class Usage Examples

Public Methods

Method Description
Generate ( Image image, int thumbWidth, int thumbHeight, ImageScaleMode mode, Color backgroundColor, float xDPI, float yDPI ) : Image

Generates a thumbnail of the source image based on parameters.

Thumbnail width or height must be greater than 0. Otherwise an empty image is generated.

When ImageScaleMode.PreserveRatioNoFill used and both dimensions are set, if aspect ratio of source image and thumbnail doesn't match, thumbnail's horizontal or vertical size may be different than requested one. In, PreserveRatioWithFill mode thumbnail size will be at requested size but empty parts are filled with a solid color.

GenerateEmptyBitmap ( int width, int height, Color color ) : Image

Generates an empty bitmap

Method Details

Generate() public static method

Generates a thumbnail of the source image based on parameters.

Thumbnail width or height must be greater than 0. Otherwise an empty image is generated.

When ImageScaleMode.PreserveRatioNoFill used and both dimensions are set, if aspect ratio of source image and thumbnail doesn't match, thumbnail's horizontal or vertical size may be different than requested one. In, PreserveRatioWithFill mode thumbnail size will be at requested size but empty parts are filled with a solid color.

public static Generate ( Image image, int thumbWidth, int thumbHeight, ImageScaleMode mode, Color backgroundColor, float xDPI, float yDPI ) : Image
image Image /// Image object to generate thumbnail for (required)
thumbWidth int /// Thumbnail width. If 0, width is calculated by source aspect ratio. Only one of /// width or height can be zero.
thumbHeight int /// Thumbnail height. If 0, height is calculated by source aspect ratio. Only one of /// width or height can be zero.
mode ImageScaleMode /// Thumbnail generation mode. It is only important when both dimensions are specified and /// source aspect ratio is different than thumbnail (see ).
backgroundColor Color /// Specifies fill color for PreserveRatioWithFill mode.
xDPI float
yDPI float
return Image

GenerateEmptyBitmap() public static method

Generates an empty bitmap
public static GenerateEmptyBitmap ( int width, int height, Color color ) : Image
width int /// Width.
height int /// Height.
color Color /// Color that empty bitmap will be filled with. If Color.Empty, it is not filled.
return Image