Add EvenHub icon to phone preview screen

This commit is contained in:
James Babcock committed 2026-10-12 02:33:22 -07:00
1 parent 14d1f7f509
commit ccbf523e9a
8 files changed
+100 -8

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
import { type ImageSource } from '@nativescript/core'
import { type GrayImage } from '../graphics/image'
import { previewPixels, whiteIconPixels } from './ios-graphics'
/** Build the phone-UI preview for a frame (brightened like Android's). */
export function grayImageToPreviewSource(image: GrayImage): ImageSource | null {
const baked = image.withDrawsBaked()
return previewPixels(baked.pixels, baked.width, baked.height)
}
/**
* A glasses icon as a white-on-transparent phone image (gray becomes alpha),
* for the dark header.
*/
export function grayImageToWhiteIconSource(image: GrayImage): ImageSource | null {
const baked = image.withDrawsBaked()
return whiteIconPixels(baked.pixels, baked.width, baked.height)
}
+9
View File
@@ -12,6 +12,15 @@ export function previewPixels(pixels: Uint8Array, width: number, height: number,
return new ImageSource(native)
}
/** Gray pixels as a white-on-transparent image (gray becomes alpha). */
export function whiteIconPixels(pixels: Uint8Array, width: number, height: number): ImageSource {
const copy = new Uint8Array(pixels)
const data = NSData.dataWithBytesLength(interop.handleof(copy.buffer), copy.byteLength)
const native = FaceclawGraphics.whiteIconWidthHeight(data, width, height)
if (!native) throw new Error('Could not create icon image')
return new ImageSource(native)
}
export function rasterizeSvg(svg: string, size: number): GrayImage | null {
const data = FaceclawGraphics.renderSVGSize(svg, size)
if (!data) return null