EvenHub compativility fixes: Z-order changes, different text color distribution, text containers scroll

This commit is contained in:
James Babcock committed 2026-11-07 22:28:49 -08:00
1 parent c713815694
commit 10a9c85f27
22 files changed
+1545 -610

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
import { toData, fromData } from './kotlin-data'
import { rgbaFromPacket } from './image-rgba'
declare const FaceclawGraphics: any
/** Decoded RGBA of encoded image bytes, or null when undecodable (transparent pixels come out black). */
export function decodeImageRgba(bytes: Uint8Array): { width: number; height: number; rgba: Uint8Array } | null {
const data = FaceclawGraphics.rgbaPacketFromImageData(toData(bytes))
return data ? rgbaFromPacket(fromData(data)) : null
}
+22
View File
@@ -0,0 +1,22 @@
import { toUint8Array } from '../util/array-util'
import { copyToJavaByteBuffer } from './java-direct-buffer'
declare const com: any
/** Decoded RGBA (not premultiplied) of encoded image bytes, or null when undecodable. */
export function decodeImageRgba(bytes: Uint8Array): { width: number; height: number; rgba: Uint8Array } | null {
try {
return rgbaFromPacket(toUint8Array(com.faceclaw.app.ImageFileLoader.decodeRgbaFromBytes(copyToJavaByteBuffer(bytes))))
} catch (error) {
console.warn(`decodeImageRgba failed: ${error}`)
return null
}
}
/** [widthLo, widthHi, heightLo, heightHi, RGBA...] as an image, or null when short. */
export function rgbaFromPacket(packet: Uint8Array): { width: number; height: number; rgba: Uint8Array } | null {
if (packet.length < 4) return null
const width = packet[0]! | (packet[1]! << 8)
const height = packet[2]! | (packet[3]! << 8)
if (width <= 0 || height <= 0 || packet.length < 4 + width * height * 4) return null
return { width, height, rgba: packet.slice(4, 4 + width * height * 4) }
}