Skip to content

🎥 Make videos programmatically with React

improve compositor

Jonny Burger07c53f140221
diff --git a/rust/compositor.rs b/rust/compositor.rs
index f01ea97c26..7917e9abd0 100644
--- a/rust/compositor.rs
+++ b/rust/compositor.rs
@@ -50,8 +50,8 @@ fn draw_image_layer(img: &mut ImageBuffer<image::Rgba<u8>, Vec<u8>>, layer: Imag
};
let bytes = &buf[..info.buffer_size()];
- for y in layer.y..(info.height + layer.y) {
- for x in layer.x..(info.width + layer.x) {
+ for y in layer.y..(layer.height + layer.y) {
+ for x in layer.x..(layer.width + layer.x) {
let r = bytes[((y * info.width + x) * 4) as usize];
let g = bytes[((y * info.width + x) * 4 + 1) as usize];
let b = bytes[((y * info.width + x) * 4 + 2) as usize];
diff --git a/rust/payload.json b/rust/payload.json
index a1e43703d3..dbcabef8ce 100644
--- a/rust/payload.json
+++ b/rust/payload.json
@@ -2,14 +2,14 @@
"width": 1920,
"height": 1080,
"v": 1,
- "output": "imglol.png",
+ "output": "imglol.jpeg",
"layers": [
{
"type": "Solid",
"params": {
"fill": [255, 0, 255, 255],
- "x": 0,
- "y": 0,
+ "x": 100,
+ "y": 100,
"width": 100,
"height": 100
}
@@ -18,8 +18,10 @@
"type": "Image",
"params": {
"src": "/var/folders/hs/mbxg3j_55ls1b_dhn50w32t00000gn/T/react-motion-renderqyvqrH/element-049.png",
- "x": 0,
- "y": 0
+ "x": 50,
+ "y": 50,
+ "width": 900,
+ "height": 490
}
}
]
diff --git a/rust/payloads.rs b/rust/payloads.rs
index f645a198da..4bed375367 100644
--- a/rust/payloads.rs
+++ b/rust/payloads.rs
@@ -10,6 +10,8 @@ pub mod payloads {
pub src: String,
pub x: u32,
pub y: u32,
+ pub width: u32,
+ pub height: u32,
}
#[derive(Serialize, Deserialize, Debug)]