BorderImgSetFlags

Syntax

Success = BorderImgSetFlags(Border, Flags)

Description

Sets the rendering flags for an image border object, controlling how the edge and center slices are rendered (e.g., stretched, repeated). This command is only applicable to borders created with CreateBorderImg().

Parameters

Border
The handle of the image border object.

Flags
A combination of flags specifying the rendering behavior. These flags override the default behavior (stretch). You can combine general flags (which apply to all four edges unless overridden) with side-specific flags.

; General Flags (apply to all sides unless overridden)
#PG_BorderImg_Stretch ; (Default) Stretch edges to fill space.
#PG_BorderImg_Repeat ; Tile edges to fill space.
#PG_BorderImg_RepeatRound ; Tile edges, scaling the last tile to fit an integer number of tiles.
#PG_BorderImg_Round ; Tile edges, stretching tiles to fit an integer number.
#PG_BorderImg_Space ; Tile edges, distributing extra space evenly between tiles.

; Side-Specific Flags (override general flags for a specific side)
#PG_BorderImg_StretchLeft, #PG_BorderImg_StretchTop, #PG_BorderImg_StretchRight, #PG_BorderImg_StretchBottom
#PG_BorderImg_RepeatLeft, #PG_BorderImg_RepeatTop, #PG_BorderImg_RepeatRight, #PG_BorderImg_RepeatBottom
#PG_BorderImg_RepeatRoundLeft, #PG_BorderImg_RepeatRoundTop, #PG_BorderImg_RepeatRoundRight, #PG_BorderImg_RepeatRoundBottom
#PG_BorderImg_RoundLeft, #PG_BorderImg_RoundTop, #PG_BorderImg_RoundRight, #PG_BorderImg_RoundBottom
#PG_BorderImg_SpaceLeft, #PG_BorderImg_SpaceTop, #PG_BorderImg_SpaceRight, #PG_BorderImg_SpaceBottom

; Center Area Flags
#PG_BorderImg_CenterStretch ; Stretch the center slice to fill the middle area.
#PG_BorderImg_CenterTile ; Tile the center slice to fill the middle area.

; Other Flags
#PG_BorderImg_NoMask ; Disables the mask (if one was provided). Border becomes simple.
#PG_BorderImg_MaskOnly ; Only uses the mask for rendering (border image itself is ignored).
#PG_BorderImg_MinSizeShrink ; Allows border edges to shrink below their natural size if the drawing area is too small.

Return Value

Returns #True if the flags were successfully set, or #False if the border handle is invalid or not an image border.

Remarks

The rendering flags determine how the non-corner edge slices and the center slice are drawn when the border needs to cover an area larger than the source image slices. Setting #PG_BorderImg_NoMask can potentially optimize rendering if the border doesn't require complex masking.

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

MyImage = CreateImg(60, 60, RGB(200, 200, 200)) ; Placeholder

If MyImage
  MyBorder = CreateBorderImg(MyImage, 0, 20, 20, 20, 20) ; Default is stretch

  ; Change to repeat horizontally, space vertically, tile center
  Flags = #PG_BorderImg_RepeatLeft | #PG_BorderImg_RepeatRight | #PG_BorderImg_SpaceTop | #PG_BorderImg_SpaceBottom | #PG_BorderImg_CenterTile

  If BorderImgSetFlags(MyBorder, Flags)
    Debug "Border image flags set successfully."
  EndIf

  FreeBorder(MyBorder)
  FreeImg(MyImage)
EndIf

StopProGUI()

See Also

CreateBorderImg, BorderImgGetFlags, BorderImgSetSlices, BorderImgSetWidth

Supported OS

Windows, Linux