@remotion/timeline-utils 4.0.525 → 4.0.527
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/package.json +3 -3
- package/dist/image-thumbnail/draw-repeating-image-thumbnail.d.ts +0 -10
- package/dist/image-thumbnail/draw-repeating-image-thumbnail.js +0 -48
- package/dist/image-thumbnail/get-scaled-image-thumbnail-dimensions.d.ts +0 -8
- package/dist/image-thumbnail/get-scaled-image-thumbnail-dimensions.js +0 -17
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/timeline-utils"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/timeline-utils",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.527",
|
|
7
7
|
"description": "Internal utilities for rendering Remotion timelines",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"scripts": {
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"mediabunny": "1.56.1",
|
|
25
|
-
"remotion": "4.0.
|
|
25
|
+
"remotion": "4.0.527"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@mediabunny/server": "1.56.1",
|
|
29
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
29
|
+
"@remotion/eslint-config-internal": "4.0.527",
|
|
30
30
|
"eslint": "9.19.0",
|
|
31
31
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
32
32
|
},
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
type ImageWithNaturalDimensions = CanvasImageSource & {
|
|
2
|
-
readonly naturalWidth: number;
|
|
3
|
-
readonly naturalHeight: number;
|
|
4
|
-
};
|
|
5
|
-
export declare const drawRepeatingImageThumbnail: ({ canvas, image, offsetInPixels, }: {
|
|
6
|
-
readonly canvas: HTMLCanvasElement | OffscreenCanvas;
|
|
7
|
-
readonly image: ImageWithNaturalDimensions;
|
|
8
|
-
readonly offsetInPixels?: number | undefined;
|
|
9
|
-
}) => void;
|
|
10
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.drawRepeatingImageThumbnail = void 0;
|
|
4
|
-
const get_scaled_image_thumbnail_dimensions_1 = require("./get-scaled-image-thumbnail-dimensions");
|
|
5
|
-
const createOffscreenCanvas = (width, height) => {
|
|
6
|
-
if (typeof document !== 'undefined') {
|
|
7
|
-
const canvas = document.createElement('canvas');
|
|
8
|
-
canvas.width = width;
|
|
9
|
-
canvas.height = height;
|
|
10
|
-
return canvas;
|
|
11
|
-
}
|
|
12
|
-
if (typeof OffscreenCanvas !== 'undefined') {
|
|
13
|
-
return new OffscreenCanvas(width, height);
|
|
14
|
-
}
|
|
15
|
-
throw new Error('No canvas implementation available');
|
|
16
|
-
};
|
|
17
|
-
const drawRepeatingImageThumbnail = ({ canvas, image, offsetInPixels = 0, }) => {
|
|
18
|
-
const ctx = canvas.getContext('2d');
|
|
19
|
-
if (!ctx) {
|
|
20
|
-
throw new Error('Failed to get canvas context');
|
|
21
|
-
}
|
|
22
|
-
const { width, height } = canvas;
|
|
23
|
-
if (width === 0 || height === 0) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const { scaledWidth, scaledHeight } = (0, get_scaled_image_thumbnail_dimensions_1.getScaledImageThumbnailDimensions)({
|
|
27
|
-
naturalWidth: image.naturalWidth,
|
|
28
|
-
naturalHeight: image.naturalHeight,
|
|
29
|
-
canvasHeight: height,
|
|
30
|
-
});
|
|
31
|
-
if (scaledWidth === 0 || scaledHeight === 0) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const offscreen = createOffscreenCanvas(scaledWidth, scaledHeight);
|
|
35
|
-
const offCtx = offscreen.getContext('2d');
|
|
36
|
-
if (!offCtx) {
|
|
37
|
-
throw new Error('Failed to get offscreen canvas context');
|
|
38
|
-
}
|
|
39
|
-
offCtx.drawImage(image, 0, 0, scaledWidth, scaledHeight);
|
|
40
|
-
const pattern = ctx.createPattern(offscreen, 'repeat-x');
|
|
41
|
-
if (!pattern) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
pattern.setTransform(new DOMMatrix().translate(-offsetInPixels, 0));
|
|
45
|
-
ctx.fillStyle = pattern;
|
|
46
|
-
ctx.fillRect(0, 0, width, height);
|
|
47
|
-
};
|
|
48
|
-
exports.drawRepeatingImageThumbnail = drawRepeatingImageThumbnail;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const getScaledImageThumbnailDimensions: ({ naturalWidth, naturalHeight, canvasHeight, }: {
|
|
2
|
-
readonly naturalWidth: number;
|
|
3
|
-
readonly naturalHeight: number;
|
|
4
|
-
readonly canvasHeight: number;
|
|
5
|
-
}) => {
|
|
6
|
-
scaledWidth: number;
|
|
7
|
-
scaledHeight: number;
|
|
8
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getScaledImageThumbnailDimensions = void 0;
|
|
4
|
-
const getScaledImageThumbnailDimensions = ({ naturalWidth, naturalHeight, canvasHeight, }) => {
|
|
5
|
-
if (naturalWidth === 0 || naturalHeight === 0 || canvasHeight === 0) {
|
|
6
|
-
return {
|
|
7
|
-
scaledWidth: 0,
|
|
8
|
-
scaledHeight: 0,
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
const scale = canvasHeight / naturalHeight;
|
|
12
|
-
return {
|
|
13
|
-
scaledWidth: naturalWidth * scale,
|
|
14
|
-
scaledHeight: canvasHeight,
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
exports.getScaledImageThumbnailDimensions = getScaledImageThumbnailDimensions;
|