forked from Blendman974/faceclaw
Port Transcribe to new UI; remove legacy dashboard
This commit is contained in:
1 parent
56d0f8c351
commit
d0c30f9ca9
21 files changed
+392
-1291
No files matched your search
@@ -268,6 +268,31 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
||||
compositor.configureScreen(width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* The current composited screen as a phone-UI preview bitmap, or null
|
||||
* before any surface has been configured. Built from the compositor so
|
||||
* the preview reflects every surface (chrome + whichever app is
|
||||
* foreground), including worker-app frames the TS side never sees.
|
||||
*/
|
||||
public android.graphics.Bitmap getCompositePreviewBitmap(double brightenGamma) {
|
||||
SurfaceCompositor.Composite composite = compositor.previewComposite();
|
||||
if (composite == null) {
|
||||
return null;
|
||||
}
|
||||
return PreviewBitmapUtil.fromGray(
|
||||
java.nio.ByteBuffer.wrap(composite.gray), composite.width, composite.height, brightenGamma);
|
||||
}
|
||||
|
||||
/** Save the current composite as a raw 4bpp screenshot; returns the path or "". */
|
||||
public String saveRawCompositeScreenshot() throws java.io.IOException {
|
||||
SurfaceCompositor.Composite composite = compositor.previewComposite();
|
||||
if (composite == null) {
|
||||
return "";
|
||||
}
|
||||
return ScreenshotUtil.saveRawScreenshot(
|
||||
appContext, java.nio.ByteBuffer.wrap(composite.gray), composite.width, composite.height);
|
||||
}
|
||||
|
||||
/** Show or hide a compositor surface; takes effect at the next composite. */
|
||||
public void setSurfaceVisible(String id, boolean visible) {
|
||||
compositor.setSurfaceVisible(id, visible);
|
||||
|
||||
@@ -217,6 +217,38 @@ public final class SurfaceCompositor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Current composited pixels for the phone-side preview / screenshot, or
|
||||
* null before the screen is configured. Does not consume a sequence
|
||||
* number (it is never stored as the desired frame).
|
||||
*/
|
||||
public Composite previewComposite() {
|
||||
synchronized (lock) {
|
||||
if (screenWidth <= 0 || screenHeight <= 0) {
|
||||
return null;
|
||||
}
|
||||
byte[] gray = buildGrayLocked();
|
||||
return new Composite(gray, screenWidth, screenHeight, "preview", 0);
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] buildGrayLocked() {
|
||||
byte[] gray = new byte[screenWidth * screenHeight];
|
||||
if (blanked) {
|
||||
return gray;
|
||||
}
|
||||
List<Surface> ordered = new ArrayList<>(surfaces.values());
|
||||
ordered.sort(Comparator
|
||||
.comparingInt((Surface s) -> s.zOrder)
|
||||
.thenComparing(s -> s.id));
|
||||
for (Surface surface : ordered) {
|
||||
if (surface.visible) {
|
||||
blendLocked(gray, surface);
|
||||
}
|
||||
}
|
||||
return gray;
|
||||
}
|
||||
|
||||
private Composite compositeLocked() {
|
||||
byte[] gray = new byte[screenWidth * screenHeight];
|
||||
if (blanked) {
|
||||
|
||||
Reference in new issue
Block a user