ispyx 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +183 -2
- package/config.example.json +15 -0
- package/package.json +47 -4
- package/src/core/RESIDENT.md +45 -0
- package/src/core/auth.js +129 -0
- package/src/core/guard.js +287 -0
- package/src/core/image.js +117 -0
- package/src/core/ipc.js +139 -0
- package/src/core/launcher.js +70 -0
- package/src/core/mode.js +17 -0
- package/src/core/motion.js +57 -0
- package/src/core/panel/README.md +70 -0
- package/src/core/panel/index.js +144 -0
- package/src/core/panel/page.html +434 -0
- package/src/core/resident.js +271 -0
- package/src/core/server.js +832 -0
- package/src/effects/appicon.js +46 -0
- package/src/effects/scan.js +850 -0
- package/src/macos-entry.js +16 -0
- package/src/platform/CONTRACT.md +131 -0
- package/src/platform/darwin/PROTOCOL.md +82 -0
- package/src/platform/darwin/hotkey.js +41 -0
- package/src/platform/darwin/index.js +118 -0
- package/src/platform/darwin/keys.js +49 -0
- package/src/platform/darwin/layer.js +87 -0
- package/src/platform/darwin/overlay.js +83 -0
- package/src/platform/darwin/panel.js +25 -0
- package/src/platform/darwin/rpc-worker.js +132 -0
- package/src/platform/darwin/rpc.js +146 -0
- package/src/platform/fake/index.js +162 -0
- package/src/platform/index.js +13 -0
- package/src/platform/win32/auth-dialog.ps1 +140 -0
- package/src/platform/win32/autostart.js +54 -0
- package/src/platform/win32/dialog.js +41 -0
- package/src/platform/win32/hotkey.js +77 -0
- package/src/platform/win32/index.js +31 -0
- package/src/platform/win32/keys.js +31 -0
- package/src/platform/win32/layer.js +120 -0
- package/src/platform/win32/overlay.js +265 -0
- package/src/platform/win32/pump.js +37 -0
- package/src/platform/win32/tray-worker.js +172 -0
- package/src/platform/win32/tray.js +103 -0
- package/src/platform/win32/win32.js +577 -0
- package/src/server.js +14 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// The Ispyx app icon: the eye of the screenshot animation (renderEye in scan.js) on a dark rounded square. One source
|
|
2
|
+
// for the macOS .icns (native/macos/make-icon.mjs) and the Windows tray icon (platform/win32/tray-worker.js).
|
|
3
|
+
import { renderEye } from './scan.js';
|
|
4
|
+
|
|
5
|
+
const clamp = (v) => Math.min(1, Math.max(0, v));
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* RGBA (straight alpha) icon of size s. By default Apple's grid is used: the 824/1024 squircle sits in the middle of
|
|
9
|
+
* the canvas. tight: true fills the whole canvas (small tray icons).
|
|
10
|
+
*/
|
|
11
|
+
export function renderIcon(s, { tight = false } = {}) {
|
|
12
|
+
const rgba = Buffer.alloc(s * s * 4);
|
|
13
|
+
const k = s / 1024;
|
|
14
|
+
const inset = tight ? 0 : 100 * k, side = tight ? s : 824 * k, rad = side * (185 / 824);
|
|
15
|
+
for (let y = 0; y < s; y++) {
|
|
16
|
+
for (let x = 0; x < s; x++) {
|
|
17
|
+
// signed distance to the rounded square
|
|
18
|
+
const qx = Math.abs(x + 0.5 - s / 2) - (side / 2 - rad);
|
|
19
|
+
const qy = Math.abs(y + 0.5 - s / 2) - (side / 2 - rad);
|
|
20
|
+
const sd = Math.hypot(Math.max(qx, 0), Math.max(qy, 0)) + Math.min(Math.max(qx, qy), 0) - rad;
|
|
21
|
+
const a = clamp(0.5 - sd);
|
|
22
|
+
if (a <= 0) continue;
|
|
23
|
+
// dark green-black, a little lighter at the top
|
|
24
|
+
const t = (y - inset) / side;
|
|
25
|
+
const i = (y * s + x) * 4;
|
|
26
|
+
rgba[i] = 18 + 14 * (1 - t); rgba[i + 1] = 30 + 22 * (1 - t); rgba[i + 2] = 26 + 14 * (1 - t); rgba[i + 3] = a * 255;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// the eye (premultiplied BGRA sprite) over the background, looking a little down like it does in the animation
|
|
30
|
+
const e = Math.round(side * 0.78);
|
|
31
|
+
const px = new Uint8Array(e * e * 4);
|
|
32
|
+
renderEye(px, e, 1, 0, 0.35);
|
|
33
|
+
const ox = Math.round((s - e) / 2), oy = Math.round((s - e) / 2);
|
|
34
|
+
for (let y = 0; y < e; y++) {
|
|
35
|
+
for (let x = 0; x < e; x++) {
|
|
36
|
+
const j = (y * e + x) * 4, sa = px[j + 3] / 255;
|
|
37
|
+
if (sa <= 0) continue;
|
|
38
|
+
const i = ((oy + y) * s + ox + x) * 4, da = rgba[i + 3] / 255;
|
|
39
|
+
const oa = sa + da * (1 - sa);
|
|
40
|
+
// premultiplied source over straight-alpha destination, back to straight alpha
|
|
41
|
+
for (const [c, sc] of [[0, 2], [1, 1], [2, 0]]) rgba[i + c] = (px[j + sc] + rgba[i + c] * da * (1 - sa)) / oa;
|
|
42
|
+
rgba[i + 3] = oa * 255;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return rgba;
|
|
46
|
+
}
|