Syntax
ImgSetInterpolationMode(Img, InterpolationMode)Description
Sets the default interpolation mode used when the specified ProGUI image is drawn scaled (e.g., via DrawImg() with dimensions different from the source).
Parameters
Img
The handle of the ProGUI image object whose interpolation mode is to be
set.
InterpolationMode
The desired interpolation mode constant.
#PG_InterpolationMode_Linear : Default. Good balance of speed and quality. Bilinear filtering.
#PG_InterpolationMode_Nearest : Fastest, pixelated result. Good for pixel art. Nearest neighbor filtering.
#PG_InterpolationMode_Cubic : Smoother results than linear, slower. Bicubic filtering.
#PG_InterpolationMode_MultiSampleLinear : Uses multiple samples, potentially smoother edges.
#PG_InterpolationMode_Anisotropic : High quality, good for textures viewed at angles.
#PG_InterpolationMode_HighQualityCubic : Highest quality cubic filtering, slowest.
Return Value
This function does not return a value.
Remarks
The interpolation mode affects the visual quality when an image is
scaled up or down during drawing. The default is
#PG_InterpolationMode_Linear. For pixel art,
#PG_InterpolationMode_Nearest is often preferred. Setting
the mode on the image sets the default for subsequent draw operations
involving that image; the mode can sometimes be overridden temporarily
(e.g., via brush settings).
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
PixelArtImage = LoadImg("pixel_art.png") ; Assume pixel_art.png exists
If PixelArtImage
Debug "Default Interpolation Mode: " + ImgGetInterpolationMode(PixelArtImage)
; Set mode to nearest neighbor for crisp pixel art scaling
ImgSetInterpolationMode(PixelArtImage, #PG_InterpolationMode_Nearest)
Debug "New Interpolation Mode: " + ImgGetInterpolationMode(PixelArtImage)
; Now drawing this image scaled will use nearest neighbor by default
; ... DrawImg(PixelArtImage, 0, 0, ImgGetWidth(PixelArtImage)*4, ImgGetHeight(PixelArtImage)*4) ...
FreeImg(PixelArtImage)
EndIf
StopProGUI()See Also
ImgGetInterpolationMode, DrawImg, BrushSetInterpolationMode
Supported OS
Windows, Linux