Skip to content

fillGradient

fun GuiGraphics.fillGradient(
    x: Int, 
    y: Int, 
    width: Int, 
    height: Int, 
    topLeftColor: Int, 
    topRightColor: Int, 
    bottomLeftColor: Int, 
    bottomRightColor: Int
)

Draws a four-corner gradient rectangle on the GUI.

Each corner can have an independent ARGB colour, enabling both solid fills (all four colours identical) and arbitrary gradient fills.

Parameters

  • x: X coordinate of the top-left corner.

  • y: Y coordinate of the top-left corner.

  • width: Width of the rectangle in pixels.

  • height: Height of the rectangle in pixels.

  • topLeftColor: ARGB colour of the top-left corner.

  • topRightColor: ARGB colour of the top-right corner.

  • bottomLeftColor: ARGB colour of the bottom-left corner.

  • bottomRightColor: ARGB colour of the bottom-right corner.

fun GuiGraphics.fillGradient(
    type: RenderType, 
    x: Int, 
    y: Int, 
    width: Int, 
    height: Int, 
    topLeftColor: Int, 
    topRightColor: Int, 
    bottomLeftColor: Int, 
    bottomRightColor: Int
)

Draws a four-corner gradient rectangle with an explicit RenderType.

Parameters

  • type: The RenderType to use for rendering (e.g. RenderType.gui).

  • x: X coordinate of the top-left corner.

  • y: Y coordinate of the top-left corner.

  • width: Width of the rectangle in pixels.

  • height: Height of the rectangle in pixels.

  • topLeftColor: ARGB colour of the top-left corner.

  • topRightColor: ARGB colour of the top-right corner.

  • bottomLeftColor: ARGB colour of the bottom-left corner.

  • bottomRightColor: ARGB colour of the bottom-right corner.