Table of Contents

Method RescalePixelsInt

Namespace
PaintDotNet
Assembly
PaintDotNet.Core.dll

RescalePixelsInt(int, UIScaleFactor, UIScaleFactor)

Converts pixels to DIPs using the source scale, then converts from DIPs to pixels using the target scale.

The result is rounded to the nearest whole integer.

public static int RescalePixelsInt(int px, UIScaleFactor sourceScale, UIScaleFactor targetScale)

Parameters

px int
sourceScale UIScaleFactor
targetScale UIScaleFactor

Returns

int

Remarks

This is useful for scaling a bitmap from its DPI setting to the DPI setting for the display.

RescalePixelsInt(int, int, UIScaleFactor, UIScaleFactor)

Converts pixels to DIPs using the source scale, then converts from DIPs to pixels using the target scale.

The result is rounded to the nearest whole integer.

public static SizeInt32 RescalePixelsInt(int widthPx, int heightPx, UIScaleFactor sourceScale, UIScaleFactor targetScale)

Parameters

widthPx int
heightPx int
sourceScale UIScaleFactor
targetScale UIScaleFactor

Returns

SizeInt32

Remarks

This is useful for scaling a bitmap from its DPI setting to the DPI setting for the display.

RescalePixelsInt(SizeInt32, UIScaleFactor, UIScaleFactor)

Converts pixels to DIPs using the source scale, then converts from DIPs to pixels using the target scale.

The result is rounded to the nearest whole integer.

public static SizeInt32 RescalePixelsInt(SizeInt32 sizePx, UIScaleFactor sourceScale, UIScaleFactor targetScale)

Parameters

sizePx SizeInt32
sourceScale UIScaleFactor
targetScale UIScaleFactor

Returns

SizeInt32

Remarks

This is useful for scaling a bitmap from its DPI setting to the DPI setting for the display.