forked from Blendman974/faceclaw
Port navigate and weather
This commit is contained in:
1 parent
2b3e068a23
commit
9e18745e53
33 files changed
+630
-60
No files matched your search
@@ -0,0 +1,12 @@
|
||||
import { GrayImage } from '../graphics/image'
|
||||
import { toData, fromData } from './kotlin-data'
|
||||
declare const FaceclawGraphics: any
|
||||
|
||||
/** Native image decoding and grayscale conversion, safe on a rendering worker. */
|
||||
export function decodeImageBytes(bytes: ArrayBuffer, width: number, height: number): GrayImage | null {
|
||||
const data = FaceclawGraphics.decodeImageWidthHeight(toData(new Uint8Array(bytes)), width, height)
|
||||
if (!data) return null
|
||||
const image = new GrayImage(width, height, 0)
|
||||
image.pixels.set(fromData(data))
|
||||
return image
|
||||
}
|
||||
Reference in new issue
Block a user