summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <jb@kdenlive.org>2016-09-25 12:27:51 (GMT)
committerJean-Baptiste Mardelle <jb@kdenlive.org>2016-09-25 12:27:51 (GMT)
commit891fe44167e2f431d54dcfc133ff6d5775e3e679 (patch)
treed7a3a7af7b2fbfb7fa78826eafd61d8d5c47e479
parentab3efa5d5c1e4c3f30940c1e9a220e9599b1c010 (diff)
Basic work to prepare rotoscoping porting
-rw-r--r--data/effects/rotoscoping.xml4
-rw-r--r--data/kdenlivemonitorrotoscene.qml78
-rw-r--r--src/uiresources.qrc2
3 files changed, 21 insertions, 63 deletions
diff --git a/data/effects/rotoscoping.xml b/data/effects/rotoscoping.xml
index afdd481..cad48be 100644
--- a/data/effects/rotoscoping.xml
+++ b/data/effects/rotoscoping.xml
@@ -17,7 +17,7 @@
<parameter type="bool" name="invert" default="0">
<name>Invert</name>
</parameter>
-
+
<!--<parameter type="bool" name="track" default="0">
<name>Track</name>
</parameter>-->
@@ -25,7 +25,7 @@
<parameter type="constant" name="feather" max="500" min="0" default="0">
<name>Feather width</name>
</parameter>
-
+
<parameter type="constant" name="feather_passes" max="20" min="1" default="1">
<name>Feathering passes</name>
</parameter>
diff --git a/data/kdenlivemonitorrotoscene.qml b/data/kdenlivemonitorrotoscene.qml
index b868c00..816e92e 100644
--- a/data/kdenlivemonitorrotoscene.qml
+++ b/data/kdenlivemonitorrotoscene.qml
@@ -8,20 +8,21 @@ Item {
height: 300; width: 400
property string comment
property string framenum
- property rect framesize
+ property rect framesize: Qt.rect(5, 5, 200, 200)
property point profile
- property point center
- property double scalex
- property double scaley
+ profile: Qt.point(1920, 1080)
+ property point center: Qt.point(960, 540)
+ property double scalex : 1
+ property double scaley : 1
property double stretch : 1
property double sourcedar : 1
onScalexChanged: canvas.requestPaint()
onScaleyChanged: canvas.requestPaint()
onSourcedarChanged: refreshdar()
- property bool iskeyframe
+ property bool iskeyframe : true
property int requestedKeyFrame
- property var centerPoints: []
- property var centerPointsTypes: []
+ property var centerPoints: [Qt.point(120, 100), Qt.point(160, 100), Qt.point(180, 200), Qt.point(120, 200)]
+ property var centerPointsTypes: [Qt.point(120, 100), Qt.point(160, 100), Qt.point(180, 200), Qt.point(120, 200)]
onCenterPointsChanged: canvas.requestPaint()
signal effectPolygonChanged()
signal addKeyframe()
@@ -49,6 +50,7 @@ Item {
handleSize: fontReference.fontSize / 2
renderTarget: Canvas.FramebufferObject
renderStrategy: Canvas.Cooperative
+
onPaint:
{
var ctx = getContext('2d')
@@ -59,68 +61,24 @@ Item {
ctx.fillStyle = Qt.rgba(1, 0, 0, 0.5)
ctx.lineWidth = 2
var p1 = convertPoint(root.centerPoints[0])
+ var startP = p1;
ctx.moveTo(p1.x, p1.y)
- for (int i = 0; i < root.centerPoints.length - 1; i++) {
+ ctx.fillRect(p1.x - handleSize, p1.y - handleSize, 2 * handleSize, 2 * handleSize);
+ for (var i = 0; i < root.centerPoints.length - 1; i++) {
p1 = convertPoint(root.centerPoints[i + 1])
// Control points
var c1 = convertPoint(root.centerPointsTypes[i])
var c2 = convertPoint(root.centerPointsTypes[i + 1])
- ctx.bezierCurveTo(c1.x, c1.y, c2.x, c2.y, p1.x, p1.y);;
- }
-
- // Handles
- /*if (root.iskeyframe == true) {
- if (root.requestedKeyFrame == 0) {
- ctx.fillStyle = Qt.rgba(1, 1, 0, 1)
+ ctx.bezierCurveTo(c1.x, c1.y, c2.x, c2.y, p1.x, p1.y);
ctx.fillRect(p1.x - handleSize, p1.y - handleSize, 2 * handleSize, 2 * handleSize);
- ctx.fillStyle = Qt.rgba(1, 0, 0, 0.5)
}
- else ctx.fillRect(p1.x - handleSize, p1.y - handleSize, 2 * handleSize, 2 * handleSize);
- if (root.requestedKeyFrame == 1) {
- ctx.fillStyle = Qt.rgba(1, 1, 0, 1)
- ctx.fillRect(p2.x - handleSize, p2.y - handleSize, 2 * handleSize, 2 * handleSize);
- ctx.fillStyle = Qt.rgba(1, 0, 0, 0.5)
+ if (root.centerPoints.length > 2) {
+ var c1 = convertPoint(root.centerPointsTypes[root.centerPoints.length - 1])
+ var c2 = convertPoint(root.centerPointsTypes[0])
+ ctx.bezierCurveTo(c1.x, c1.y, c2.x, c2.y, startP.x, startP.y);
}
- else ctx.fillRect(p2.x - handleSize, p2.y - handleSize, 2 * handleSize, 2 * handleSize);
- if (root.requestedKeyFrame == 2) {
- ctx.fillStyle = Qt.rgba(1, 1, 0, 1)
- ctx.fillRect(p3.x - handleSize, p3.y - handleSize, 2 * handleSize, 2 * handleSize);
- ctx.fillStyle = Qt.rgba(1, 0, 0, 0.5)
- }
- else ctx.fillRect(p3.x - handleSize, p3.y - handleSize, 2 * handleSize, 2 * handleSize);
- if (root.requestedKeyFrame == 3) {
- ctx.fillStyle = Qt.rgba(1, 1, 0, 1)
- ctx.fillRect(p4.x - handleSize, p4.y - handleSize, 2 * handleSize, 2 * handleSize);
- ctx.fillStyle = Qt.rgba(1, 0, 0, 0.5)
- }
- else ctx.fillRect(p4.x - handleSize, p4.y - handleSize, 2 * handleSize, 2 * handleSize);
- }*/
- // Rect
- /*ctx.moveTo(p1.x, p1.y)
- ctx.lineTo(p2.x, p2.y)
- ctx.lineTo(p3.x, p3.y)
- ctx.lineTo(p4.x, p4.y)
- ctx.lineTo(p1.x, p1.y)*/
- // Source rect
- /*if (canvas.darOffset != 0 && root.sourcedar > 0) {
- if (root.sourcedar < root.profile.x / root.profile.y) {
- // vertical bars
- ctx.moveTo(p1.x + (darOffset * (p2.x - p1.x)), p1.y + (darOffset * (p2.y - p1.y)))
- ctx.lineTo(p4.x + (darOffset * (p3.x - p4.x)), p4.y + (darOffset * (p3.y-p4.y)))
- ctx.moveTo(p2.x + (darOffset * (p1.x - p2.x)), p2.y + (darOffset * (p1.y - p2.y)))
- ctx.lineTo(p3.x + (darOffset * (p4.x - p3.x)), p3.y + (darOffset * (p4.y-p3.y)))
- } else {
- // horizontal bars
- ctx.moveTo(p1.x + (darOffset * (p4.x - p1.x)), p1.y + (darOffset * (p4.y - p1.y)))
- ctx.lineTo(p2.x + (darOffset * (p3.x - p2.x)), p2.y + (darOffset * (p3.y-p2.y)))
- ctx.moveTo(p4.x + (darOffset * (p1.x - p4.x)), p4.y + (darOffset * (p1.y - p4.y)))
- ctx.lineTo(p3.x + (darOffset * (p2.x - p3.x)), p3.y + (darOffset * (p2.y-p3.y)))
- }
- }*/
- ctx.stroke()
- //ctx.restore()
- //}
+ ctx.stroke()
}
function convertPoint(p)
diff --git a/src/uiresources.qrc b/src/uiresources.qrc
index 7cb6640..2caf82c 100644
--- a/src/uiresources.qrc
+++ b/src/uiresources.qrc
@@ -7,7 +7,7 @@
<file alias="kdenliveclipmonitor.qml">../data/kdenliveclipmonitor.qml</file>
<file alias="kdenlivemonitoreffectscene.qml">../data/kdenlivemonitoreffectscene.qml</file>
<file alias="kdenlivemonitorcornerscene.qml">../data/kdenlivemonitorcornerscene.qml</file>
- <file alias="kdenlivemonitorrotoscene.qml">../data/kdenlivemonitorsplit.qml</file>
+ <file alias="kdenlivemonitorrotoscene.qml">../data/kdenlivemonitorrotoscene.qml</file>
<file alias="kdenlivemonitorsplit.qml">../data/kdenlivemonitorsplit.qml</file>
<file alias="kdenlivemonitorripple.qml">../data/kdenlivemonitorripple.qml</file>
<file alias="SceneToolBar.qml">../data/SceneToolBar.qml</file>