NinePatchRect

package
v0.0.0-...-fe0704e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Also known as 9-slice panels, NinePatchRect produces clean panels of any size based on a small texture. To do so, it splits the texture in a 3×3 grid. When you scale the node, it tiles the texture's edges horizontally or vertically, tiles the center on both axes, and leaves the corners unchanged.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsNinePatchRect() Instance
}

type AxisStretchMode

type AxisStretchMode int //gd:NinePatchRect.AxisStretchMode
const (
	// Stretches the center texture across the NinePatchRect. This may cause the texture to be distorted.
	AxisStretchModeStretch AxisStretchMode = 0
	// Repeats the center texture across the NinePatchRect. This won't cause any visible distortion. The texture must be seamless for this to work without displaying artifacts between edges.
	AxisStretchModeTile AxisStretchMode = 1
	// Repeats the center texture across the NinePatchRect, but will also stretch the texture to make sure each tile is visible in full. This may cause the texture to be distorted, but less than [AxisStretchModeStretch]. The texture must be seamless for this to work without displaying artifacts between edges.
	AxisStretchModeTileFit AxisStretchMode = 2
)

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsCanvasItem

func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance

func (*Extension[T]) AsControl

func (self *Extension[T]) AsControl() Control.Instance

func (*Extension[T]) AsNinePatchRect

func (self *Extension[T]) AsNinePatchRect() Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.NinePatchRect

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsCanvasItem

func (self Instance) AsCanvasItem() CanvasItem.Instance

func (Instance) AsControl

func (self Instance) AsControl() Control.Instance

func (Instance) AsNinePatchRect

func (self Instance) AsNinePatchRect() Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AxisStretchHorizontal

func (self Instance) AxisStretchHorizontal() AxisStretchMode

The stretch mode to use for horizontal stretching/tiling.

func (Instance) AxisStretchVertical

func (self Instance) AxisStretchVertical() AxisStretchMode

The stretch mode to use for vertical stretching/tiling.

func (Instance) DrawCenter

func (self Instance) DrawCenter() bool

If true, draw the panel's center. Else, only draw the 9-slice's borders.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) OnTextureChanged

func (self Instance) OnTextureChanged(cb func(), flags ...Signal.Flags)

Emitted when the node's texture changes.

func (Instance) PatchMarginBottom

func (self Instance) PatchMarginBottom() int

The height of the 9-slice's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.

func (Instance) PatchMarginLeft

func (self Instance) PatchMarginLeft() int

The width of the 9-slice's left column. A margin of 16 means the 9-slice's left corners and side will have a width of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.

func (Instance) PatchMarginRight

func (self Instance) PatchMarginRight() int

The width of the 9-slice's right column. A margin of 16 means the 9-slice's right corners and side will have a width of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.

func (Instance) PatchMarginTop

func (self Instance) PatchMarginTop() int

The height of the 9-slice's top row. A margin of 16 means the 9-slice's top corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.

func (Instance) RegionRect

func (self Instance) RegionRect() Rect2.PositionSize

Rectangular region of the texture to sample from. If you're working with an atlas, use this property to define the area the 9-slice should use. All other properties are relative to this one. If the rect is empty, NinePatchRect will use the whole texture.

func (Instance) SetAxisStretchHorizontal

func (self Instance) SetAxisStretchHorizontal(value AxisStretchMode)

SetAxisStretchHorizontal sets the property returned by [GetHAxisStretchMode].

func (Instance) SetAxisStretchVertical

func (self Instance) SetAxisStretchVertical(value AxisStretchMode)

SetAxisStretchVertical sets the property returned by [GetVAxisStretchMode].

func (Instance) SetDrawCenter

func (self Instance) SetDrawCenter(value bool)

SetDrawCenter sets the property returned by [IsDrawCenterEnabled].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetPatchMarginBottom

func (self Instance) SetPatchMarginBottom(value int)

SetPatchMarginBottom sets the property returned by [GetPatchMargin].

func (Instance) SetPatchMarginLeft

func (self Instance) SetPatchMarginLeft(value int)

SetPatchMarginLeft sets the property returned by [GetPatchMargin].

func (Instance) SetPatchMarginRight

func (self Instance) SetPatchMarginRight(value int)

SetPatchMarginRight sets the property returned by [GetPatchMargin].

func (Instance) SetPatchMarginTop

func (self Instance) SetPatchMarginTop(value int)

SetPatchMarginTop sets the property returned by [GetPatchMargin].

func (Instance) SetRegionRect

func (self Instance) SetRegionRect(value Rect2.PositionSize)

SetRegionRect sets the property returned by [GetRegionRect].

func (Instance) SetTexture

func (self Instance) SetTexture(value Texture2D.Instance)

SetTexture sets the property returned by [GetTexture].

func (Instance) Texture

func (self Instance) Texture() Texture2D.Instance

The node's texture resource.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL