IconExtensionsResize(Icon, Size, ScalingMode) Method
Resizes the specified
Icon instance to the specified
size using the specified
scalingMode.
Namespace: KGySoft.DrawingAssembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 10.0.0-rc.1
public static Icon Resize(
this Icon icon,
Size size,
ScalingMode scalingMode
)
<ExtensionAttribute>
Public Shared Function Resize (
icon As Icon,
size As Size,
scalingMode As ScalingMode
) As Icon
public:
[ExtensionAttribute]
static Icon^ Resize(
Icon^ icon,
Size size,
ScalingMode scalingMode
)
[<ExtensionAttribute>]
static member Resize :
icon : Icon *
size : Size *
scalingMode : ScalingMode -> Icon
- icon Icon
- The icon to resize.
- size Size
- The required size of the result.
- scalingMode ScalingMode
- A ScalingMode value, which determines the quality of the result as well as the processing time.
IconAn
Icon instance that contains exactly one image with the specified
size.In Visual Basic and C#, you can call this method as an instance method on any object of type
Icon. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
If the icon contains images with the specified size,
then this method just extracts the highest bit-per-pixel image of the requested size.
If the icon does not contain an image exactly with the specified size, then this method takes a
close image in size and resizes that to the requested size. If resizing happens, the result will always contain a 32 bpp image.
This method adjusts the degree of parallelization automatically, blocks the caller, and does not support cancellation or reporting progress.
Use the
BitmapDataExtensions.BeginResize
or
BitmapDataExtensions.ResizeAsync
(in .NET Framework 4.0 and above) methods for asynchronous call and to adjust parallelization, set up cancellation and for reporting progress.
This method always performs resizing in the linear color space. It helps preserve the original brightness, especially for low color depth icons.