MCPcopy Create free account
hub / github.com/esengine/esengine / readColor

Method readColor

packages/fairygui/src/utils/ByteBuffer.ts:250–256  ·  view source on GitHub ↗

* Read color as packed u32 (0xRRGGBBAA format) * 读取颜色为打包的 u32(0xRRGGBBAA 格式)

(bHasAlpha: boolean = false)

Source from the content-addressed store, hash-verified

248 * 读取颜色为打包的 u32(0xRRGGBBAA 格式)
249 */
250 public readColor(bHasAlpha: boolean = false): number {
251 const r = this.getUint8();
252 const g = this.getUint8();
253 const b = this.getUint8();
254 const a = this.getUint8();
255 return ((r << 24) | (g << 16) | (b << 8) | (bHasAlpha ? a : 0xFF)) >>> 0;
256 }
257
258 /**
259 * Read color as CSS string (always reads 4 bytes: r, g, b, a)

Callers 1

decodeValueMethod · 0.80

Calls 1

getUint8Method · 0.95

Tested by

no test coverage detected