class

PointClickEngine::Graphics::UI::NinePatch

Inherits Reference < Object

Nine-patch sprite for scalable UI elements

A nine-patch divides an image into 9 sections:

+---+-------+---+
| 1 |   2   | 3 |
+---+-------+---+
| 4 |   5   | 6 |
+---+-------+---+
| 7 |   8   | 9 |
+---+-------+---+

Corners (1,3,7,9) are drawn at original size Edges (2,4,6,8) are stretched in one dimension Center (5) is stretched in both dimensions

Constructors

new(texture_path : String | Nil = nil)
Source
new(texture : RL::Texture2D, left : Int32 = 8, right : Int32 = 8, top : Int32 = 8, bottom : Int32 = 8)
Source

Instance methods

border=(size : Int32)

Set uniform border size

Source
border_bottom
Source
border_bottom=(border_bottom : Int32)
Source
border_left

Border sizes (distance from edge to stretchable area)

Source
border_left=(border_left : Int32)

Border sizes (distance from edge to stretchable area)

Source
border_right
Source
border_right=(border_right : Int32)
Source
border_top
Source
border_top=(border_top : Int32)
Source
cleanup

Cleanup

Source
create_scaled_texture(width : Int32, height : Int32) : RL::RenderTexture2D | Nil

Create a render target with nine-patch at specific size (for caching)

Source
draw(x : Float32, y : Float32, width : Float32, height : Float32)

Draw the nine-patch at specified position and size

Source
draw_centered(center_x : Float32, center_y : Float32, width : Float32, height : Float32)

Draw centered at position

Source
draw_with_context(context : PointClickEngine::Graphics::RenderContext, x : Float32, y : Float32, width : Float32, height : Float32)

Draw with render context

Source
load_texture(path : String)

Load texture from file

Source
min_height
Source
min_width

Minimum size (must be at least border_left + border_right, etc)

Source
set_borders(left : Int32, right : Int32, top : Int32, bottom : Int32)

Set all borders at once

Source
texture

Source texture

Source
texture_path
Source
tint

Tint color

Source
tint=(tint : RL::Color)

Tint color

Source