@slidevideo/cli 0.2.1 → 0.3.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/CHANGELOG.md +10 -0
- package/addons/slidevideo/global-top.vue +254 -18
- package/dist/adapters/browser-runtime.d.ts +13 -1
- package/dist/adapters/capture-compression.d.ts +15 -0
- package/dist/adapters/capture-compression.js +69 -0
- package/dist/adapters/powerpoint.d.ts +1 -1
- package/dist/adapters/powerpoint.js +63 -32
- package/dist/adapters/slidev.js +362 -3
- package/dist/contracts.d.ts +2 -0
- package/dist/pipeline.d.ts +2 -0
- package/dist/speech.js +1 -1
- package/package.json +3 -1
- package/skills/slidevideo/references/decks.md +6 -6
- package/skills/slidevideo/references/production.md +1 -1
- package/skills/slidevideo/references/storyboard.md +6 -6
- package/tools/powerpoint/Native.cs +85 -1
- package/tools/powerpoint/powerpoint.ps1 +254 -89
- package/tools/powerpoint/preview.ps1 +7 -5
package/dist/speech.js
CHANGED
|
@@ -118,7 +118,7 @@ export async function generateSpeech(story, directory, adapters, cache, progress
|
|
|
118
118
|
const cachedAudio = speechPath(resolve(cache), key, asset.format);
|
|
119
119
|
await mkdir(resolve(cache), { recursive: true });
|
|
120
120
|
await copyFile(asset.audio, cachedAudio);
|
|
121
|
-
await saveJson(cached, { ...asset, audio:
|
|
121
|
+
await saveJson(cached, { ...asset, audio: `${key}.${asset.format}` });
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
assets.push(asset);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidevideo/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Turn a slide deck into a narrated video.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE-TERMS.md",
|
|
6
6
|
"type": "module",
|
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
"addons/slidevideo/preview.ts",
|
|
34
34
|
"dist/adapters/browser-runtime.d.ts",
|
|
35
35
|
"dist/adapters/browser-runtime.js",
|
|
36
|
+
"dist/adapters/capture-compression.d.ts",
|
|
37
|
+
"dist/adapters/capture-compression.js",
|
|
36
38
|
"dist/adapters/edge.d.ts",
|
|
37
39
|
"dist/adapters/edge.js",
|
|
38
40
|
"dist/adapters/elevenlabs.d.ts",
|
|
@@ -17,7 +17,7 @@ Every storyboard `scene.slide` and `slide.target` value must match `^[a-zA-Z][a-
|
|
|
17
17
|
### PowerPoint
|
|
18
18
|
|
|
19
19
|
- Set a unique native `Slide.Name` matching `^[a-zA-Z][a-zA-Z0-9_-]*$`, or use the unambiguous `slide-<SlideID>` alias returned by `slidevideo inspect --deck <file> --json`. `SlideID` is PowerPoint's internal identifier, not the one-based slide index.
|
|
20
|
-
- Every slide must use
|
|
20
|
+
- Every slide must use manual advancement and visible slides, with either cut transitions or finite native slide transitions. Timed `AdvanceOnTime` settings, hidden slides, and interactive trigger sequences fail `POWERPOINT_CAPABILITY`. Explicit `slide` actions must reserve at least `transition_duration_ms + entry_duration_ms` as reported by `slidevideo inspect --deck <file> --json`.
|
|
21
21
|
|
|
22
22
|
## Click reveals
|
|
23
23
|
|
|
@@ -29,8 +29,8 @@ Every storyboard `scene.slide` and `slide.target` value must match `^[a-zA-Z][a-
|
|
|
29
29
|
|
|
30
30
|
### PowerPoint
|
|
31
31
|
|
|
32
|
-
- Use
|
|
33
|
-
-
|
|
32
|
+
- Use finite `MainSequence` animations (automatic pre-click `WithPrevious`/`AfterPrevious` entry effects and sequential click groups across entrance, emphasis, exit, and motion presets).
|
|
33
|
+
- Unbounded repeats (`Until Next Click` / `Until End of Slide`), interactive triggers, speed transforms, and animations on embedded video shapes fail `POWERPOINT_CAPABILITY`.
|
|
34
34
|
- Set `reveal.duration_ms` to at least the native click-group duration reported in `slides[].click_durations_ms` by `slidevideo inspect --deck <file> --json`. Each `reveal` must execute the next consecutive click step `1..N` on the active slide.
|
|
35
35
|
|
|
36
36
|
## Managed media
|
|
@@ -46,7 +46,7 @@ Every storyboard `scene.slide` and `slide.target` value must match `^[a-zA-Z][a-
|
|
|
46
46
|
|
|
47
47
|
- Embed the local video file directly on the slide as an ungrouped shape and set `Shape.Name` to the storyboard `media[].id`. Linked or online video fails capability validation.
|
|
48
48
|
- Point `media[].src` in `slidevideo.yaml` at the exact file embedded into the `.pptx` package so its SHA-256 digest and duration match.
|
|
49
|
-
- Disable autoplay, loop, rewind, native trims, fullscreen playback,
|
|
49
|
+
- Disable autoplay, loop, rewind, native trims, fullscreen playback, rotation, flipping, 3D transforms, and shape animations on the video shape. Static cropping and borders or shadows are allowed. PowerPoint `play` actions run at `rate: 1` and support optional storyboard `trim_start_ms` and `trim_end_ms`.
|
|
50
50
|
|
|
51
51
|
## Annotation targets and canvas bounds
|
|
52
52
|
|
|
@@ -60,8 +60,8 @@ Every storyboard `scene.slide` and `slide.target` value must match `^[a-zA-Z][a-
|
|
|
60
60
|
### PowerPoint
|
|
61
61
|
|
|
62
62
|
- Shape annotations (`highlight` and `underline`) use `target: { type: shape, id: <number> }` with the integer shape ID reported by `slidevideo inspect --deck <file> --json`. Shape names are descriptive only and are not valid target identifiers.
|
|
63
|
-
- `--width` and `--height`
|
|
64
|
-
-
|
|
63
|
+
- `--width` and `--height` scale the native slide uniformly and letterbox when the output aspect ratio differs from the slide size. The native slideshow window sizes dynamically to the monitor bounds (using borderless capture during recording when windowed chrome would exceed the work area) to preserve full native resolution when the display permits.
|
|
64
|
+
- Static `.svg` media parts, unrotated cropped pictures, and stationary groups or group members are supported. Rotated, flipped, or 3D shapes, paragraph-level text animations, and shapes exited or hidden after animation fail `ANNOTATION_TARGET`. Any animation on the target shape must finish settling before the annotation interval starts.
|
|
65
65
|
- Both Slidev and PowerPoint also accept `target: { type: region, units: normalized, x, y, width, height }` in `[0, 1]` slide coordinates without modifying the deck.
|
|
66
66
|
|
|
67
67
|
### Contrast presets
|
|
@@ -18,7 +18,7 @@ For a visual pacing review, use `play --storyboard <file>` and open the printed
|
|
|
18
18
|
|
|
19
19
|
For a requested finished video, use `build`. It validates inputs, generates or reuses matching speech, resolves timing, captures the presentation, and assembles the MP4 at `1920` by `1080` and `30 fps` by default. Pass `--width` and `--height` together and optional `--fps` of `15`, `24`, `30`, or `60` to `build` or `record` to select another resolution or frame rate. `record` and `build` bind `width`, `height`, and `fps` in the run manifest. `assemble` and `build --resume` inherit those settings and fail with `RUN_MODE_MISMATCH` when you pass conflicting values.
|
|
20
20
|
|
|
21
|
-
`tts` and `resolve` reject `--width`, `--height`, and `--fps` because speech cache keys and millisecond schedules are independent of pixel dimensions. Changing from `1280` by `720` to `1920` by `1080` requires a new run directory for capture and assembly while reusing cached speech and alignment through `--cache-dir`. Scaling within the same aspect ratio preserves Slidev layout and frame-fixed `overlays[].box` placement, while changing aspect ratio alters
|
|
21
|
+
`tts` and `resolve` reject `--width`, `--height`, and `--fps` because speech cache keys and millisecond schedules are independent of pixel dimensions. Changing from `1280` by `720` to `1920` by `1080` requires a new run directory for capture and assembly while reusing cached speech and alignment through `--cache-dir`. Scaling within the same aspect ratio preserves Slidev and PowerPoint layout and frame-fixed `overlays[].box` placement, while changing aspect ratio alters letterboxing for both adapters.
|
|
22
22
|
|
|
23
23
|
Use staged commands when an intermediate result is useful to the creator. `tts` prepares audio and alignment, `resolve` calculates the schedule, `record` captures from resolved inputs, and `assemble` produces the final MP4. Begin with a new or empty run directory. Commands reject a nonempty directory without a run manifest before writing run artifacts. A requested narration review can occur after `tts` and before capture. `record` does not generate speech implicitly.
|
|
24
24
|
|
|
@@ -95,7 +95,7 @@ Every scene action has required `id` and `type`. The other fields depend on the
|
|
|
95
95
|
| `trim_end_ms` | Optional nonnegative source position. Default source duration. Must be after the start and no later than source duration. |
|
|
96
96
|
| `rate` | Optional number from 0.5 to 2. Default `1`. Picture and source audio use the same rate. |
|
|
97
97
|
|
|
98
|
-
The duration formula is `(trim_end_ms - trim_start_ms) / rate`, with omitted trims replaced by their defaults. Schema acceptance does not imply adapter support. Native PowerPoint currently
|
|
98
|
+
The duration formula is `(trim_end_ms - trim_start_ms) / rate`, with omitted trims replaced by their defaults. Schema acceptance does not imply adapter support. Native PowerPoint currently requires rate `1` and supports optional `trim_start_ms` and `trim_end_ms`.
|
|
99
99
|
|
|
100
100
|
Source-audio volume is an explicit fixed gain. The storyboard has no automatic ducking option.
|
|
101
101
|
|
|
@@ -132,11 +132,11 @@ The storyboard reserves intended durations. The resolved schedule establishes ex
|
|
|
132
132
|
| Concern | Slidev `.md` | Native PowerPoint `.pptx` |
|
|
133
133
|
| --- | --- | --- |
|
|
134
134
|
| Slide targets | Authored frontmatter `name`, otherwise `slide-<one-based effective index>`. Imports and filtering affect that index. | Unique native `Slide.Name`, or unambiguous `slide-<SlideID>`. SlideID is not the slide position. Names must also fit the YAML target syntax. |
|
|
135
|
-
| Reveals | Native click-driven content, such as `v-click`. Steps advance and must fit known or runtime-checked bounds. | Consecutive finite entrance
|
|
136
|
-
| Slide changes | Authored deck transition, with a matching settling allowance. | Cuts
|
|
137
|
-
| Video | Managed media element with a matching declared source. Trims and rates follow the shared action contract. |
|
|
135
|
+
| Reveals | Native click-driven content, such as `v-click`. Steps advance and must fit known or runtime-checked bounds. | Consecutive finite `MainSequence` click groups (entrance, emphasis, exit, and motion presets). The declared duration must cover the complete native group. |
|
|
136
|
+
| Slide changes | Authored deck transition, with a matching settling allowance. | Cuts or finite native slide transitions, plus optional automatic pre-click entry animations. Timed advancement, hidden slides, and interactive sequences are unsupported. |
|
|
137
|
+
| Video | Managed media element with a matching declared source. Trims and rates follow the shared action contract. | Embedded video at rate `1` with exact source-byte matching and optional storyboard `trim_start_ms` / `trim_end_ms`. No native trim, autoplay, loop, rewind, or fullscreen transform. |
|
|
138
138
|
| Runtime | Playwright-controlled Chromium and the playback addon. | Windows desktop PowerPoint and FFmpeg native window capture on an unlocked interactive desktop. |
|
|
139
|
-
| Viewport and aspect ratio | Scales the deck to `--width` and `--height`, letterboxing when the aspect ratio differs from the slide canvas. | `--width` and `--height
|
|
139
|
+
| Viewport and aspect ratio | Scales the deck to `--width` and `--height`, letterboxing when the aspect ratio differs from the slide canvas. | Scales the deck to `--width` and `--height`, letterboxing when the aspect ratio differs from the slide size and sizing the capture window dynamically to the monitor bounds. |
|
|
140
140
|
|
|
141
141
|
Linked or online media and unsupported dynamic PowerPoint objects fail capability validation. Run `slidevideo inspect --deck <file> --json` to list slide targets, `slide-<SlideID>` aliases, click counts, native click-group durations, media IDs, and unsupported native features before scheduling them in the storyboard.
|
|
142
142
|
|
|
@@ -220,7 +220,7 @@ Requested final-frame verification reports fill and bottom-border checks separat
|
|
|
220
220
|
|
|
221
221
|
The duration is positive milliseconds. An interval containing no output frame at the selected frame rate fails with `ANNOTATION_FRAME_RANGE`. Intervals are half-open `[start,end)` and do not extend scenes. They must fit one scene, slide visit, and settled reveal state. An annotation may end at a navigation or reveal boundary, and it cannot cross one or start during settling. Array order sets the drawing order, so later annotations draw above earlier ones. The first active frame is the first output frame at or after the resolved start, and removal begins on the first frame at or after the end.
|
|
222
222
|
|
|
223
|
-
Targets are stationary, visible, and axis-aligned. Missing, ambiguous, hidden, rotated, reflected,
|
|
223
|
+
Targets are stationary, visible, and axis-aligned. Missing, ambiguous, hidden, rotated, reflected, masked, clipped, or moving targets fail with annotation context (including Slidev SVG `<g>` groups). Slidev excludes navigation, notes, and duplicate hidden slide instances and samples geometry each animation frame. Native PowerPoint shape support includes stationary unrotated groups, group members, and cropped pictures, while excluding hidden, rotated, flipped, 3D, paragraph-animated, moving or resized, exited, and hide- or dim-after-animation targets; supported animations must have settled. PowerPoint schedules native geometry samples 50 ms apart. Movement above 0.5 output pixels invalidates the target. Sampling checks the documented stationary subset rather than tracking moving targets or recognizing pixels.
|
|
224
224
|
|
|
225
225
|
For a PowerPoint shape, use a target such as `{ type: shape, id: 2 }` when `slidevideo inspect --deck slides.pptx --json` or `slidevideo inspect --storyboard slidevideo.yaml --json` lists that ID on the selected slide without unsupported shape diagnostics.
|
|
226
226
|
|
|
@@ -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);
|