[Libreoffice-commits] core.git: filter/source

Rohan Kumar rohankanojia420 at gmail.com
Thu Apr 6 23:06:06 UTC 2017


 filter/source/svg/presentation_engine.js |  112 ++++++++++++++++++++++++++++++-
 1 file changed, 111 insertions(+), 1 deletion(-)

New commits:
commit 7a64ad57036234c90dda0ba1fefdf8867114305e
Author: Rohan Kumar <rohankanojia420 at gmail.com>
Date:   Tue Jan 31 18:52:58 2017 +0530

    tdf#51358 Support for ZigZag-Wipe transition animation in SVG support
    
    Ported classes ZigZagWipe and BarnZigZagWipe
    
    Change-Id: Ib15929c24dc952944ac4de5b71c541cdd99affcc
    Reviewed-on: https://gerrit.libreoffice.org/33763
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index 33b958530c13..d46cc96d235d 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -5180,6 +5180,8 @@ SNAKEWIPE_TRANSITION        = 13; // 30
 IRISWIPE_TRANSITION         = 14; // 12
 BARNDOORWIPE_TRANSITION     = 15; // 4
 VEEWIPE_TRANSITION          = 16; // 8
+ZIGZAGWIPE_TRANSITION       = 17; // 10
+BARNZIGZAGWIPE_TRANSITION   = 18; // 11
 
 aTransitionTypeInMap = {
     'barWipe'           : BARWIPE_TRANSITION,
@@ -5197,7 +5199,9 @@ aTransitionTypeInMap = {
     'dissolve'          : DISSOLVE_TRANSITION,
     'snakeWipe'         : SNAKEWIPE_TRANSITION,
     'irisWipe'          : IRISWIPE_TRANSITION,
-    'veeWipe'           : VEEWIPE_TRANSITION
+    'veeWipe'           : VEEWIPE_TRANSITION,
+    'zigZagWipe'        : ZIGZAGWIPE_TRANSITION,
+    'barnZigZagWipe'    : BARNZIGZAGWIPE_TRANSITION
 };
 
 /*
@@ -5484,6 +5488,50 @@ aTransitionInfoTable[IRISWIPE_TRANSITION][DIAMOND_TRANS_SUBTYPE] =
     'scaleIsotropically': false
 };
 
+aTransitionInfoTable[ZIGZAGWIPE_TRANSITION] = {};
+aTransitionInfoTable[ZIGZAGWIPE_TRANSITION][LEFTTORIGHT_TRANS_SUBTYPE] =
+{
+    'class' : TRANSITION_CLIP_POLYPOLYGON,
+    'rotationAngle' : 0.0,
+    'scaleX' : 1.0,
+    'scaleY' : 1.0,
+    'reverseMethod' : REVERSEMETHOD_FLIP_X,
+    'outInvertsSweep' : true,
+    'scaleIsotropically' : false
+};
+aTransitionInfoTable[ZIGZAGWIPE_TRANSITION][TOPTOBOTTOM_TRANS_SUBTYPE] =
+{
+    'class' : TRANSITION_CLIP_POLYPOLYGON,
+    'rotationAngle' : 90.0,
+    'scaleX' : 1.0,
+    'scaleY' : 1.0,
+    'reverseMethod' : REVERSEMETHOD_FLIP_Y,
+    'outInvertsSweep' : true,
+    'scaleIsotropically' : false
+};
+
+aTransitionInfoTable[BARNZIGZAGWIPE_TRANSITION] = {};
+aTransitionInfoTable[BARNZIGZAGWIPE_TRANSITION][VERTICAL_TRANS_SUBTYPE] =
+{
+    'class' : TRANSITION_CLIP_POLYPOLYGON,
+    'rotationAngle' : 0.0,
+    'scaleX' : 1.0,
+    'scaleY' : 1.0,
+    'reverseMethod' : REVERSEMETHOD_IGNORE,
+    'outInvertsSweep' : true,
+    'scaleIsotropically' : false
+};
+aTransitionInfoTable[BARNZIGZAGWIPE_TRANSITION][HORIZONTAL_TRANS_SUBTYPE] =
+{
+    'class' : TRANSITION_CLIP_POLYPOLYGON,
+    'rotationAngle' : 90.0,
+    'scaleX' : 1.0,
+    'scaleY' : 1.0,
+    'reverseMethod' : REVERSEMETHOD_IGNORE,
+    'outInvertsSweep' : true,
+    'scaleIsotropically' : false
+};
+
 aTransitionInfoTable[BARWIPE_TRANSITION] = {};
 aTransitionInfoTable[BARWIPE_TRANSITION][LEFTTORIGHT_TRANS_SUBTYPE] =
 {
@@ -9440,6 +9488,10 @@ function createClipPolyPolygon( nType, nSubtype )
             return new RandomWipePath( 128, true /* bars */ );
         case CHECKERBOARDWIPE_TRANSITION:
             return new CheckerBoardWipePath( 10 );
+        case ZIGZAGWIPE_TRANSITION:
+            return new ZigZagWipePath( 5 );
+        case BARNZIGZAGWIPE_TRANSITION:
+            return new BarnZigZagWipePath( 5 );
         case IRISWIPE_TRANSITION:
             switch(nSubtype)
             {
@@ -9820,6 +9872,64 @@ IrisWipePath.prototype.perform = function( nT ) {
     return aPath;
 }
 
+/**
+ * Class ZigZagWipePath
+ *
+ * @param nZigs
+ *
+ */
+function ZigZagWipePath(nZigs) {
+    this.zigEdge = 1.0/nZigs;
+    const d = this.zigEdge;
+    const d2 = (d / 2.0);
+    this.aBasePath = 'M ' + (-1.0 - d) + ' ' + -d + ' ';
+    this.aBasePath += 'L ' + (-1.0 - d) + ' ' + (1.0 + d) + ' ';
+    this.aBasePath += 'L ' + -d + ' ' + (1.0 + d) + ' ';
+
+    for(var pos = (nZigs + 2); pos--; ) {
+        this.aBasePath += 'L ' + 0.0 + ' ' + ((pos - 1) * d + d2) + ' ';
+        this.aBasePath += 'L ' + -d + ' ' + (pos - 1) * d + ' ';
+    }
+    this.aBasePath += 'L ' + (-1.0 - d) + ' ' + -d + ' ';
+}
+
+ZigZagWipePath.prototype.perform = function( nT ) {
+    var res = document.createElementNS( NSS['svg'], 'path');
+    res.setAttribute('d', this.aBasePath);
+    res.matrixTransform(SVGIdentityMatrix.translate((1.0 + this.zigEdge) * nT, 0.0));
+    return res;
+}
+
+/*
+ * Class BarnZigZagWipePath
+ *
+ * @param nZigs
+ *
+ */
+function BarnZigZagWipePath( nZigs ) { ZigZagWipePath.call(this, nZigs); }
+
+BarnZigZagWipePath.prototype = Object.create(ZigZagWipePath);
+
+BarnZigZagWipePath.prototype.perform = function( nT ) {
+    var res = createEmptyPath();
+    var poly = document.createElementNS( NSS['svg'], 'path');
+    var aTransform = SVGIdentityMatrix.translate(
+        ((1.0 + this.zigEdge) * (1.0 - nT)) / 2.0, 0.0);
+    poly.setAttribute('d', this.aBasePath);
+    poly.changeOrientation();
+    poly.matrixTransform(aTransform);
+    res.appendPath(poly);
+
+    aTransform = SVGIdentityMatrix.scale(-1.0, 1.0);
+    aTransform.translate(1.0, this.zigEdge / 2.0);
+    poly = document.createElementNS( NSS['svg'], 'path');
+    poly.setAttribute('d', this.aBasePath);
+    poly.matrixTransform(aTransform);
+    res.appendPath(poly);
+
+    return res;
+}
+
 /** Class CheckerBoardWipePath
  *
  *  @param unitsPerEdge


More information about the Libreoffice-commits mailing list