Syntax
Mode = BrushGetInterpolationMode(Brush)
Description
Retrieves the current interpolation mode used by the specified image or gradient brush when it is scaled or transformed.
Parameters
Brush
The handle of the brush whose interpolation mode is to be retrieved.
Return Value
Returns an integer corresponding to one of the #PG_InterpolationMode_... constants,
indicating the current interpolation mode. Returns #False or a default value (like
#PG_InterpolationMode_Linear) if the brush handle is invalid.
Possible return values include:
#PG_InterpolationMode_Linear : (Default) Uses linear interpolation. Good balance of quality and performance.
#PG_InterpolationMode_Nearest : Uses nearest-neighbor interpolation. Fast but can look blocky when scaled up.
#PG_InterpolationMode_Cubic : Uses cubic interpolation. Higher quality than linear, slightly slower.
#PG_InterpolationMode_MultiSampleLinear : Uses multiple linear samples. Can improve quality on some GPUs.
#PG_InterpolationMode_Anisotropic : Uses anisotropic filtering. Best quality for textures viewed at sharp angles, potentially slower.
#PG_InterpolationMode_HighQualityCubic: A higher-quality cubic interpolation.
Remarks
The interpolation mode affects the visual quality when an image brush is scaled or a gradient brush is
rendered. Higher quality modes generally require more processing power. The default is typically
#PG_InterpolationMode_Linear.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
MyImage = CreateImg(10, 10) ; Small image
MyBrush = CreateBrushImg(MyImage)
If MyBrush
; Check default mode
DefaultMode = BrushGetInterpolationMode(MyBrush)
Debug "Default Interpolation Mode: " + Str(DefaultMode) ; Likely 0 (#PG_InterpolationMode_Linear)
; Set to nearest neighbor
BrushSetInterpolationMode(MyBrush, #PG_InterpolationMode_Nearest)
CurrentMode = BrushGetInterpolationMode(MyBrush)
Debug "Current Interpolation Mode: " + Str(CurrentMode) ; Should be 1
FreeBrush(MyBrush)
EndIf
If MyImage : FreeImg(MyImage) : EndIf
StopProGUI()
See Also
BrushSetInterpolationMode, CreateBrushImg, CreateBrushGradientLinear, CreateBrushGradientRadial
Supported OS
Windows, Linux