forked from Blendman974/faceclaw
Files app: Gamma correct and dither images when viewing
This commit is contained in:
1 parent
a72e29a04f
commit
c364099a8c
6 files changed
+85
-28
No files matched your search
@@ -1,17 +1,9 @@
|
||||
import { Utils } from "@nativescript/core";
|
||||
import { GrayImage } from "../graphics/image";
|
||||
import { grayImageFromPacket } from "./image-files";
|
||||
import { grayImageFromPacket, PHOTO_TONE } from "./image-files";
|
||||
|
||||
declare const com: any;
|
||||
|
||||
/**
|
||||
* Tone curve applied to album art before it is dithered down to the display's
|
||||
* 16 gray levels (out = in^gamma, in 0..1). Cover art is sRGB-encoded but the
|
||||
* G2 drives its levels roughly linearly, so untouched art reads washed out;
|
||||
* 2.2 undoes the sRGB encoding. Lower it toward ~1.8 if shadows crush.
|
||||
*/
|
||||
const ALBUM_ART_GAMMA = 2.2;
|
||||
|
||||
export type MediaQueueItem = {
|
||||
id: number;
|
||||
title: string;
|
||||
@@ -141,16 +133,16 @@ export class FaceclawMediaControllerBridge {
|
||||
}
|
||||
|
||||
/**
|
||||
* Album art for the current item, grayscale (gamma-corrected and dithered
|
||||
* onto the display's 16 levels), scaled to fit maxSize; null when the
|
||||
* player provides none.
|
||||
* Album art for the current item, grayscale with the shared photo tone
|
||||
* (gamma-corrected and dithered onto the display's 16 levels), scaled to
|
||||
* fit maxSize; null when the player provides none.
|
||||
*/
|
||||
getAlbumArt(maxSize: number): GrayImage | null {
|
||||
if (!global.isAndroid) return null;
|
||||
this.ensureController();
|
||||
if (!this.controller) return null;
|
||||
return grayImageFromPacket(
|
||||
this.controller.getAlbumArtGray(Math.round(maxSize), ALBUM_ART_GAMMA),
|
||||
this.controller.getAlbumArtGray(Math.round(maxSize), PHOTO_TONE.gamma, PHOTO_TONE.dither),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user