BorderImgSetSlices

Syntax

Success = BorderImgSetSlices(Border, LeftEdgeOffset, TopEdgeOffset, RightEdgeOffset, BottomEdgeOffset)

Description

Sets the edge offsets (slices) for an image border object. These offsets define the lines that divide the source image into nine regions (four corners, four edges, one center) used for rendering the scalable border. This command is only applicable to borders created with CreateBorderImg().

Parameters

Border
The handle of the image border object.

LeftEdgeOffset
The offset from the left edge of the source image (in pixels) defining the width of the left column (left corners and edge).

TopEdgeOffset
The offset from the top edge of the source image (in pixels) defining the height of the top row (top corners and edge).

RightEdgeOffset
The offset from the right edge of the source image (in pixels) defining the width of the right column (right corners and edge).

BottomEdgeOffset
The offset from the bottom edge of the source image (in pixels) defining the height of the bottom row (bottom corners and edge).

Return Value

Returns #True if the slice offsets were successfully set, or #False if the border handle is invalid, not an image border, or if the specified offsets are invalid (e.g., less than 1, or overlap).

Remarks

The offsets must be at least 1 pixel. The sum of the left and right offsets must be less than the image width minus 1, and the sum of the top and bottom offsets must be less than the image height minus 1, to ensure a valid center region exists. Changing the slices invalidates any internal rendering cache for the border.

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

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

If MyImage
  ; Create border with initial slices
  MyBorder = CreateBorderImg(MyImage, 0, 10, 10, 10, 10)

  If MyBorder
    ; Change the slices
    If BorderImgSetSlices(MyBorder, 15, 15, 12, 12)
      Debug "Border image slices updated."
    Else
      Debug "Failed to update border image slices."
    EndIf
    FreeBorder(MyBorder)
  EndIf
  FreeImg(MyImage)
EndIf

StopProGUI()

See Also

CreateBorderImg, BorderImgGetSlices, BorderImgSetFlags

Supported OS

Windows, Linux