Garry's Mod Wiki

surface.GetPanelPaintState

  table surface.GetPanelPaintState()

Recently Added

This was recently added in version (2024.09.13). It might only be available on the Dev Branch right now.

Description

Retrieves the position and ScissorRect information for the Panel that is currently being drawn.

When using the surface library (and, by extension, the draw library) inside of the PANEL:Paint function, the origin (The on-screen position of (0,0)) is automatically shifted to the top-left corner of the panel to make it easier to draw the panel's contents. Additionally, render.SetScissorRect is used to clip (or "mask") all drawn content to within the boundaries of the panel. This function returns the information used by the surface library about the current panel's origin and ScissorRect.

Returns

1 table
A table containing the position and ScissorRect boundaries for the Panel currently being drawn.

For the table's format and available options see the PanelPaintState structure page.