@slidevideo/cli 0.2.0 → 0.2.2
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/CHANGELOG.md +11 -0
- package/README.md +2 -2
- package/addons/slidevideo/geometry.ts +63 -30
- package/addons/slidevideo/global-top.vue +41 -9
- package/addons/slidevideo/playback-entries.ts +16 -5
- package/addons/slidevideo/preview.ts +26 -14
- package/dist/adapters/powerpoint.d.ts +7 -4
- package/dist/adapters/powerpoint.js +146 -40
- package/dist/adapters/slidev-inspection.d.ts +5 -2
- package/dist/adapters/slidev-inspection.js +3 -2
- package/dist/adapters/slidev.d.ts +3 -4
- package/dist/adapters/slidev.js +20 -19
- package/dist/annotation-paint.d.ts +65 -11
- package/dist/annotation-paint.js +290 -10
- package/dist/annotations.d.ts +13 -8
- package/dist/annotations.js +619 -88
- package/dist/assembly.d.ts +4 -2
- package/dist/assembly.js +23 -18
- package/dist/cli.js +102 -16
- package/dist/compositor.d.ts +10 -5
- package/dist/compositor.js +215 -128
- package/dist/contracts.d.ts +93 -30
- package/dist/contracts.js +2 -1
- package/dist/media.d.ts +5 -0
- package/dist/media.js +30 -0
- package/dist/pipeline.d.ts +37 -9
- package/dist/pipeline.js +62 -10
- package/dist/preview/contracts.d.ts +3 -3
- package/dist/preview/player.js +20 -15
- package/dist/preview/server.d.ts +2 -1
- package/dist/preview/server.js +6 -5
- package/dist/setup.d.ts +3 -0
- package/dist/setup.js +16 -1
- package/dist/skill-install.d.ts +35 -0
- package/dist/skill-install.js +132 -0
- package/dist/storyboard.js +9 -0
- package/package.json +4 -1
- package/schemas/annotation-geometry.v1.json +260 -28
- package/schemas/run-manifest.v1.json +31 -0
- package/schemas/schedule.v1.json +448 -182
- package/schemas/storyboard.v1.json +358 -174
- package/skills/slidevideo/SKILL.md +11 -9
- package/skills/slidevideo/references/decks.md +228 -0
- package/skills/slidevideo/references/production.md +14 -10
- package/skills/slidevideo/references/storyboard.md +69 -37
- package/tools/powerpoint/Native.cs +85 -1
- package/tools/powerpoint/powerpoint.ps1 +188 -101
- package/tools/powerpoint/preview.ps1 +10 -9
|
@@ -35,12 +35,20 @@ namespace SlideVideo {
|
|
|
35
35
|
private delegate bool EnumProc(IntPtr window, IntPtr parameter);
|
|
36
36
|
[StructLayout(LayoutKind.Sequential)] private struct Rect { public int Left, Top, Right, Bottom; }
|
|
37
37
|
[StructLayout(LayoutKind.Sequential)] private struct Point { public int X, Y; }
|
|
38
|
+
[StructLayout(LayoutKind.Sequential)] private struct MonitorInfo { public int cbSize; public Rect rcMonitor; public Rect rcWork; public uint dwFlags; }
|
|
38
39
|
[DllImport("user32.dll")] private static extern bool ClientToScreen(IntPtr window, ref Point point);
|
|
39
40
|
[DllImport("user32.dll")] private static extern bool EnumWindows(EnumProc callback, IntPtr parameter);
|
|
40
41
|
[DllImport("user32.dll")] private static extern bool EnumChildWindows(IntPtr window, EnumProc callback, IntPtr parameter);
|
|
41
42
|
[DllImport("user32.dll")] private static extern bool PrintWindow(IntPtr window, IntPtr dc, uint flags);
|
|
42
43
|
[DllImport("user32.dll")] private static extern bool IsWindowVisible(IntPtr window);
|
|
43
44
|
[DllImport("user32.dll")] private static extern bool GetClientRect(IntPtr window, out Rect rectangle);
|
|
45
|
+
[DllImport("user32.dll")] private static extern bool GetWindowRect(IntPtr window, out Rect rectangle);
|
|
46
|
+
[DllImport("user32.dll")] private static extern IntPtr MonitorFromWindow(IntPtr window, uint flags);
|
|
47
|
+
[DllImport("user32.dll")] private static extern bool GetMonitorInfo(IntPtr monitor, ref MonitorInfo info);
|
|
48
|
+
[DllImport("user32.dll", EntryPoint = "GetWindowLong")] private static extern int GetWindowLong32(IntPtr window, int index);
|
|
49
|
+
[DllImport("user32.dll", EntryPoint = "SetWindowLong")] private static extern int SetWindowLong32(IntPtr window, int index, int newLong);
|
|
50
|
+
[DllImport("user32.dll", EntryPoint = "GetWindowLongPtr")] private static extern IntPtr GetWindowLongPtr64(IntPtr window, int index);
|
|
51
|
+
[DllImport("user32.dll", EntryPoint = "SetWindowLongPtr")] private static extern IntPtr SetWindowLongPtr64(IntPtr window, int index, IntPtr newLong);
|
|
44
52
|
[DllImport("user32.dll", CharSet = CharSet.Unicode)] private static extern int GetWindowText(IntPtr window, StringBuilder text, int length);
|
|
45
53
|
[DllImport("user32.dll", CharSet = CharSet.Unicode)] private static extern int GetClassName(IntPtr window, StringBuilder text, int length);
|
|
46
54
|
[DllImport("user32.dll")] private static extern uint GetWindowThreadProcessId(IntPtr window, out uint process);
|
|
@@ -99,6 +107,80 @@ namespace SlideVideo {
|
|
|
99
107
|
return type.ToString() + " | " + title.ToString();
|
|
100
108
|
}
|
|
101
109
|
|
|
110
|
+
private static long GetWindowStyle(IntPtr window) {
|
|
111
|
+
return IntPtr.Size == 8 ? GetWindowLongPtr64(window, -16).ToInt64() : (long)GetWindowLong32(window, -16);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private static void SetWindowStyle(IntPtr window, long style) {
|
|
115
|
+
if (IntPtr.Size == 8) SetWindowLongPtr64(window, -16, new IntPtr(style));
|
|
116
|
+
else SetWindowLong32(window, -16, unchecked((int)style));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
public static string PlaceForAudience(long handle, int outputWidth, int outputHeight, double deckAspect, bool topmost, bool allowBorderless) {
|
|
120
|
+
var window = new IntPtr(handle);
|
|
121
|
+
var monitor = MonitorFromWindow(window, 2);
|
|
122
|
+
var info = new MonitorInfo();
|
|
123
|
+
info.cbSize = Marshal.SizeOf(typeof(MonitorInfo));
|
|
124
|
+
int workLeft = 0, workTop = 0, workWidth = 1600, workHeight = 900;
|
|
125
|
+
int monLeft = 0, monTop = 0, monWidth = 1600, monHeight = 900;
|
|
126
|
+
if (monitor != IntPtr.Zero && GetMonitorInfo(monitor, ref info)) {
|
|
127
|
+
workLeft = info.rcWork.Left;
|
|
128
|
+
workTop = info.rcWork.Top;
|
|
129
|
+
workWidth = Math.Max(320, info.rcWork.Right - info.rcWork.Left);
|
|
130
|
+
workHeight = Math.Max(180, info.rcWork.Bottom - info.rcWork.Top);
|
|
131
|
+
monLeft = info.rcMonitor.Left;
|
|
132
|
+
monTop = info.rcMonitor.Top;
|
|
133
|
+
monWidth = Math.Max(320, info.rcMonitor.Right - info.rcMonitor.Left);
|
|
134
|
+
monHeight = Math.Max(180, info.rcMonitor.Bottom - info.rcMonitor.Top);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
double minScale = Math.Max(320.0 / deckAspect, 180.0);
|
|
138
|
+
double contentScale = Math.Max(minScale, Math.Min((double)outputWidth / deckAspect, (double)outputHeight));
|
|
139
|
+
int targetContentWidth = (int)Math.Round(deckAspect * contentScale, MidpointRounding.AwayFromZero);
|
|
140
|
+
int targetContentHeight = (int)Math.Round(contentScale, MidpointRounding.AwayFromZero);
|
|
141
|
+
|
|
142
|
+
int chromeWidth = 0, chromeHeight = 0;
|
|
143
|
+
Rect outerRect, clientRect;
|
|
144
|
+
if (GetWindowRect(window, out outerRect) && GetClientRect(window, out clientRect)) {
|
|
145
|
+
chromeWidth = Math.Max(0, (outerRect.Right - outerRect.Left) - clientRect.Right);
|
|
146
|
+
chromeHeight = Math.Max(0, (outerRect.Bottom - outerRect.Top) - clientRect.Bottom);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
IntPtr insertAfter = topmost ? new IntPtr(-1) : new IntPtr(-2);
|
|
150
|
+
uint baseFlags = topmost ? 0x0040u : 0x0050u;
|
|
151
|
+
|
|
152
|
+
int desiredOuterWidth = targetContentWidth + chromeWidth;
|
|
153
|
+
int desiredOuterHeight = targetContentHeight + chromeHeight;
|
|
154
|
+
if (desiredOuterWidth <= workWidth && desiredOuterHeight <= workHeight) {
|
|
155
|
+
if (!SetWindowPos(window, insertAfter, workLeft, workTop, desiredOuterWidth, desiredOuterHeight, baseFlags)) throw new InvalidOperationException("Cannot position the audience window.");
|
|
156
|
+
if (topmost) SetForegroundWindow(window);
|
|
157
|
+
DwmFlush();
|
|
158
|
+
return "windowed";
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (allowBorderless) {
|
|
162
|
+
long style = GetWindowStyle(window);
|
|
163
|
+
SetWindowStyle(window, style & ~0x00CF0000L);
|
|
164
|
+
double monScale = Math.Min((double)monWidth / targetContentWidth, (double)monHeight / targetContentHeight);
|
|
165
|
+
int borderlessWidth = monScale >= 1.0 ? targetContentWidth : (int)Math.Round(targetContentWidth * monScale, MidpointRounding.AwayFromZero);
|
|
166
|
+
int borderlessHeight = monScale >= 1.0 ? targetContentHeight : (int)Math.Round(targetContentHeight * monScale, MidpointRounding.AwayFromZero);
|
|
167
|
+
if (!SetWindowPos(window, insertAfter, monLeft, monTop, borderlessWidth, borderlessHeight, baseFlags | 0x0020u)) throw new InvalidOperationException("Cannot position the borderless audience window.");
|
|
168
|
+
if (topmost) SetForegroundWindow(window);
|
|
169
|
+
DwmFlush();
|
|
170
|
+
return "borderless";
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
int availContentWidth = Math.Max(1, workWidth - chromeWidth);
|
|
174
|
+
int availContentHeight = Math.Max(1, workHeight - chromeHeight);
|
|
175
|
+
double fitScale = Math.Min((double)availContentWidth / targetContentWidth, (double)availContentHeight / targetContentHeight);
|
|
176
|
+
int fitOuterWidth = Math.Min(workWidth, (int)Math.Round(targetContentWidth * fitScale, MidpointRounding.AwayFromZero) + chromeWidth);
|
|
177
|
+
int fitOuterHeight = Math.Min(workHeight, (int)Math.Round(targetContentHeight * fitScale, MidpointRounding.AwayFromZero) + chromeHeight);
|
|
178
|
+
if (!SetWindowPos(window, insertAfter, workLeft, workTop, fitOuterWidth, fitOuterHeight, baseFlags)) throw new InvalidOperationException("Cannot position the fitted audience window.");
|
|
179
|
+
if (topmost) SetForegroundWindow(window);
|
|
180
|
+
DwmFlush();
|
|
181
|
+
return "windowed";
|
|
182
|
+
}
|
|
183
|
+
|
|
102
184
|
public static void Place(long handle, int width, int height) {
|
|
103
185
|
var window = new IntPtr(handle);
|
|
104
186
|
if (!SetWindowPos(window, new IntPtr(-1), 0, 0, width, height, 0x40)) throw new InvalidOperationException("Cannot position the audience window.");
|
|
@@ -143,10 +225,12 @@ namespace SlideVideo {
|
|
|
143
225
|
if (!PrintWindow(new IntPtr(handle), dc, 3)) throw new InvalidOperationException("PowerPoint did not render the live preview window.");
|
|
144
226
|
} finally { graphics.ReleaseHdc(dc); }
|
|
145
227
|
}
|
|
228
|
+
var content = OutputContent(rectangle, width, height);
|
|
146
229
|
using (var output = new Bitmap(width, height)) {
|
|
147
230
|
using (var graphics = Graphics.FromImage(output)) {
|
|
231
|
+
graphics.Clear(Color.Black);
|
|
148
232
|
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
|
149
|
-
graphics.DrawImage(image, new Rectangle(
|
|
233
|
+
graphics.DrawImage(image, new Rectangle(content.x, content.y, content.width, content.height), new Rectangle(rectangle.left, rectangle.top, rectangle.width, rectangle.height), GraphicsUnit.Pixel);
|
|
150
234
|
}
|
|
151
235
|
using (var stream = new System.IO.MemoryStream()) {
|
|
152
236
|
output.Save(stream, ImageFormat.Jpeg);
|