BitmapDataExtensionsResize Method
Resizes the specified source.
Namespace: KGySoft.Drawing.ImagingAssembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 8.0.0-preview.1
public static IReadWriteBitmapData Resize(
this IReadableBitmapData source,
Size newSize,
ScalingMode scalingMode = ScalingMode.Auto,
bool keepAspectRatio = false
)
<ExtensionAttribute>
Public Shared Function Resize (
source As IReadableBitmapData,
newSize As Size,
Optional scalingMode As ScalingMode = ScalingMode.Auto,
Optional keepAspectRatio As Boolean = false
) As IReadWriteBitmapData
public:
[ExtensionAttribute]
static IReadWriteBitmapData^ Resize(
IReadableBitmapData^ source,
Size newSize,
ScalingMode scalingMode = ScalingMode::Auto,
bool keepAspectRatio = false
)
[<ExtensionAttribute>]
static member Resize :
source : IReadableBitmapData *
newSize : Size *
?scalingMode : ScalingMode *
?keepAspectRatio : bool
(* Defaults:
let _scalingMode = defaultArg scalingMode ScalingMode.Auto
let _keepAspectRatio = defaultArg keepAspectRatio false
*)
-> IReadWriteBitmapData
- source IReadableBitmapData
- The source IReadableBitmapData to resize.
- newSize Size
- The requested new size.
- scalingMode ScalingMode (Optional)
- A ScalingMode value, which determines the quality of the result as well as the processing time. This parameter is optional.
Default value: Auto. - keepAspectRatio Boolean (Optional)
- to keep aspect ratio of the specified source; otherwise, . This parameter is optional.
Default value: .
IReadWriteBitmapDataA new
IReadWriteBitmapData, which is the resized version of the specified
source.In Visual Basic and C#, you can call this method as an instance method on any object of type
IReadableBitmapData. 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).
This method adjusts the degree of parallelization automatically, blocks the caller, and does not support cancellation or reporting progress.
Use the
BeginResize or
ResizeAsync
(in .NET Framework 4.0 and above) methods for asynchronous call and to adjust parallelization, set up cancellation and for reporting progress.
The result PixelFormat depends on the WorkingColorSpace of the source
bitmap data but is always at least a 32 BPP format. To resize a bitmap data with a custom pixel format you can create a
new IReadWriteBitmapData instance by the CreateBitmapData(Size, KnownPixelFormat, Color32, Byte) method
and use the DrawInto extension methods, which has several overloads that also allow quantizing and dithering.