BrushGetDpiScaling

Syntax

IsEnabled.b = BrushGetDpiScaling(Brush)

Description

Retrieves the current DPI scaling setting for the specified brush. This determines whether certain brush properties (like gradient points or image dimensions used in calculations) automatically scale when the associated window's DPI changes.

Parameters

Brush
The handle of the brush whose DPI scaling setting is to be retrieved.

Return Value

Returns #True if DPI scaling is enabled for the brush, or #False if it is disabled or the brush handle is invalid.

Remarks

By default, DPI scaling is typically enabled for brushes. Disabling it via BrushSetDpiScaling() might be necessary if you want the brush pattern (e.g., an image used as a texture) to maintain its physical size regardless of the window's DPI.

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

MyImage = CreateImg(50, 50, RGB(0, 255, 0)) ; Green square
MyBrush = CreateBrushImg(MyImage)

If MyBrush
  ; Check the default setting
  IsEnabled = BrushGetDpiScaling(MyBrush)
  Debug "Default DPI Scaling Enabled: " + Str(IsEnabled) ; Likely #True

  ; Disable DPI scaling
  BrushSetDpiScaling(MyBrush, #False)

  IsEnabled = BrushGetDpiScaling(MyBrush)
  Debug "DPI Scaling Enabled after setting to False: " + Str(IsEnabled) ; Should be #False

  FreeBrush(MyBrush)
EndIf

If MyImage : FreeImg(MyImage) : EndIf

StopProGUI()

See Also

BrushSetDpiScaling, WindowGetDpiScaleX

Supported OS

Windows, Linux