RectTexture
Since 2.2.1RectTexture draws a rounded rectangle using CPU-side tessellation. It is a fallback alternative to SDFRectTexture for environments where the SDF shader is unavailable. Both classes expose the same properties, plus cornerSegments on RectTexture.
Registry name: rect_texture
LSS function: rect(...)
INFO
Extends TransformTexture — supports rotate(), scale(), transform().
TIP
For most use cases, prefer SDFRectTexture which provides better visual quality at all sizes. Use RectTexture only when you need CPU-side rendering.
Usage
java
// Filled rounded rect
IGuiTexture panel = new RectTexture()
.setColor(0xFF2A2A2A)
.setRadius(new Vector4f(6, 6, 6, 6));
// With stroke
IGuiTexture bordered = new RectTexture()
.setColor(0xFF1A1A1A)
.setRadius(new Vector4f(4, 4, 4, 4))
.setStroke(1f)
.setBorderColor(0xFFFFFFFF);
// Static factory
IGuiTexture simple = RectTexture.of(0xFF3A3A3A);LSS
css
Since 2.2.41/* rect(fillColor) */
background: rect(#2A2A2A);
/* rect(fillColor, radius) */
background: rect(#2A2A2A, 6);
/* rect(fillColor, radius, strokeWidth, borderColor) */
background: rect(#2A2A2A, 4, 1, #FFFFFF);
/* Per-corner radii: top-left top-right bottom-right bottom-left */
background: rect(#2A2A2A, 8 8 0 0);
/* rect(fillColor, radius, strokeWidth, borderColor, cornerSegments) */
background: rect(#2A2A2A, 12, 0, #00000000, 16);The fifth argument, cornerSegments, was added in 2.2.41. Raise it for large radii that look faceted.
WARNING
rect() reads four radii in CSS order (top-left first), while sdf() reads them from bottom-left. See Texture in LSS.
Fields
| Name | Type | Description |
|---|---|---|
color | int | Fill colour (ARGB). Default: 0xFFFFFFFF. |
borderColor | int | Stroke colour (ARGB). Default: 0xFF000000. |
radius | Vector4f | Per-corner radii: x = top-left, y = top-right, z = bottom-right, w = bottom-left. |
stroke | float | Border stroke width. 0 disables the border. |
cornerSegments | int | Number of line segments per corner arc. Higher = smoother but more vertices. Default: 8. |
Methods
| Method | Returns | Description |
|---|---|---|
setColor(int) | RectTexture | Sets the fill colour. |
setBorderColor(int) | RectTexture | Sets the stroke colour. |
setRadius(Vector4f) | RectTexture | Sets per-corner radii. |
setStroke(float) | RectTexture | Sets the stroke width. |
setCornerSegments(int) | RectTexture | Sets the number of arc segments per corner. |
copy() | RectTexture | Returns a deep copy. |
interpolate(IGuiTexture, float) | IGuiTexture | Blends all properties toward another RectTexture. |
RectTexture.of(int) | RectTexture | Static factory — creates a rect with the given fill colour. |