Skip to content

ColorRectTexture

自 2.2.1

ColorRectTexture 绘制一个纯色的 ARGB 填充矩形。它是最简单的纹理类型——无圆角、无边框,仅仅是平坦的颜色。

注册名:color_rect_texture

INFO

继承自 TransformTexture —— 支持 rotate()scale()transform()


用法

java
// 不透明深色背景
IGuiTexture bg = new ColorRectTexture(0xFF1A1A1A);

// 半透明覆盖层
IGuiTexture overlay = new ColorRectTexture(0x80FFFFFF);

// 从 java.awt.Color 创建
IGuiTexture red = new ColorRectTexture(java.awt.Color.RED);

LSS

css
/* 十六进制颜色字面量 —— 自动创建 ColorRectTexture */
background: #1A1A1AFF;   /* #AARRGGBB */
background: #1A1A1A;     /* #RRGGBB(完全不透明) */
background: #FFF;        /* 简写 */
background: rgba(26, 26, 26, 255);
background: rgb(26, 26, 26);

/* 显式 color() 函数 */
background: color(#80FFFFFF);

字段

名称类型描述
colorint打包的 ARGB 颜色值。

方法

方法返回描述
setColor(int)ColorRectTexture设置打包的 ARGB 颜色。
copy()ColorRectTexture返回深拷贝。
interpolate(IGuiTexture, float)IGuiTexture使用 OkLab 颜色空间向另一个 ColorRectTexture 混合。

Released under the MIT License.