Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/modules/qt/filter_qtblend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,23 @@ static int filter_get_image(mlt_frame frame,
if (mlt_properties_get(properties, "rotation")) {
double angle = mlt_properties_anim_get_double(properties, "rotation", position, length);
if (angle != 0.0) {
if (mlt_properties_get_int(properties, "rotate_center")) {
if (mlt_properties_get(properties, "rotate_anchor")) {
mlt_rect anchor
= mlt_properties_anim_get_rect(properties, "rotate_anchor", position, length);
// Use custom anchor point (x,y are normalized 0-1 coordinates) where 0, 0 is top left and 1, 1 is bottom right
// negative values are allowed so its possible to rotate around a point outside the rectangle
double anchor_x = anchor.x * rect.w;
double anchor_y = anchor.y * rect.h;
transform.translate(anchor_x, anchor_y);
transform.rotate(angle);
transform.translate(-anchor_x, -anchor_y);
} else if (mlt_properties_get_int(properties, "rotate_center")) {
// old style rotation (from center) to keep compatibility, equivalent to rotate_anchor = 0.5, 0.5
transform.translate(rect.w / 2.0, rect.h / 2.0);
transform.rotate(angle);
transform.translate(-rect.w / 2.0, -rect.h / 2.0);
} else {
// old style rotation (from top left corner) to keep compatibility
// old style rotation (from top left corner) to keep compatibility, equivalent to rotate_anchor = 0, 0
transform.rotate(angle);
}
hasAlpha = true;
Expand Down
12 changes: 11 additions & 1 deletion src/modules/qt/filter_qtblend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ schema_version: 7.0
type: filter
identifier: qtblend
title: Composite and transform
version: 2
version: 3
copyright: Meltytech, LLC
creator: Jean-Baptiste Mardelle
license: LGPLv2.1
Expand Down Expand Up @@ -56,6 +56,16 @@ parameters:
mutable: yes
widget: checkbox

- identifier: rotate_anchor
title: Rotation anchor point
type: rect
description: >
Keyframable anchor point for rotation. X and Y coordinates define the rotation center.
Values are normalized (0-1 for inside rectangle, negative or >1 for outside).
Default is center (0.5, 0.5). Takes precedence over rotate_center when set.
mutable: yes
animation: yes

- identifier: background_color
title: Background color
type: integer
Expand Down
Loading