LCOV - code coverage report
Current view: top level - slideshow/source/engine/transitions - figurewipe.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 67 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <canvas/debug.hxx>
      22             : #include <basegfx/numeric/ftools.hxx>
      23             : #include <basegfx/matrix/b2dhommatrix.hxx>
      24             : #include <basegfx/point/b2dpoint.hxx>
      25             : #include <basegfx/matrix/b2dhommatrixtools.hxx>
      26             : #include "transitiontools.hxx"
      27             : #include "figurewipe.hxx"
      28             : 
      29             : 
      30             : namespace slideshow {
      31             : namespace internal {
      32             : 
      33           0 : ::basegfx::B2DPolyPolygon FigureWipe::operator () ( double t )
      34             : {
      35           0 :     ::basegfx::B2DPolyPolygon res(m_figure);
      36           0 :     res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(t, t, 0.5, 0.5));
      37           0 :     return res;
      38             : }
      39             : 
      40           0 : FigureWipe * FigureWipe::createTriangleWipe()
      41             : {
      42           0 :     const double s60 = sin( basegfx::deg2rad(60.0) );
      43           0 :     const double s30 = sin( basegfx::deg2rad(30.0) );
      44           0 :     ::basegfx::B2DPolygon figure;
      45           0 :     figure.append( ::basegfx::B2DPoint( 0.5 + s30, 0.5 ) );
      46           0 :     figure.append( ::basegfx::B2DPoint( 0.0, -0.5 - s60 ) );
      47           0 :     figure.append( ::basegfx::B2DPoint( -0.5 - s30, 0.5 ) );
      48           0 :     figure.setClosed(true);
      49           0 :     return new FigureWipe(figure);
      50             : }
      51             : 
      52           0 : FigureWipe * FigureWipe::createArrowHeadWipe()
      53             : {
      54           0 :     const double s60 = sin( basegfx::deg2rad(60.0) );
      55           0 :     const double s30 = sin( basegfx::deg2rad(30.0) );
      56           0 :     const double off = s30;
      57           0 :     ::basegfx::B2DPolygon figure;
      58           0 :     figure.append( ::basegfx::B2DPoint( 0.5 + s30 + off, 0.5 + off ) );
      59           0 :     figure.append( ::basegfx::B2DPoint( 0.0, -0.5 - s60 ) );
      60           0 :     figure.append( ::basegfx::B2DPoint( -0.5 - s30 - off, 0.5 + off ) );
      61           0 :     figure.append( ::basegfx::B2DPoint( 0.0, 0.5 ) );
      62           0 :     figure.setClosed(true);
      63           0 :     return new FigureWipe(figure);
      64             : }
      65             : 
      66           0 : FigureWipe * FigureWipe::createPentagonWipe()
      67             : {
      68           0 :     const double s = sin( basegfx::deg2rad(18.0) );
      69           0 :     const double c = cos( basegfx::deg2rad(18.0) );
      70           0 :     ::basegfx::B2DPolygon figure;
      71           0 :     figure.append( ::basegfx::B2DPoint( 0.5, 0.5 ) );
      72           0 :     figure.append( ::basegfx::B2DPoint( 0.5 + s, 0.5 - c ) );
      73           0 :     figure.append( ::basegfx::B2DPoint( 0.0, 0.5 - c - sin(basegfx::deg2rad(36.0)) ) );
      74           0 :     figure.append( ::basegfx::B2DPoint( -0.5 - s, 0.5 - c ) );
      75           0 :     figure.append( ::basegfx::B2DPoint( -0.5, 0.5 ) );
      76           0 :     figure.setClosed(true);
      77           0 :     return new FigureWipe(figure);
      78             : }
      79             : 
      80           0 : FigureWipe * FigureWipe::createHexagonWipe()
      81             : {
      82           0 :     const double s = sin( basegfx::deg2rad(30.0) );
      83           0 :     const double c = cos( basegfx::deg2rad(30.0) );
      84           0 :     ::basegfx::B2DPolygon figure;
      85           0 :     figure.append( ::basegfx::B2DPoint( 0.5, c ) );
      86           0 :     figure.append( ::basegfx::B2DPoint( 0.5 + s, 0.0 ) );
      87           0 :     figure.append( ::basegfx::B2DPoint( 0.5, -c ) );
      88           0 :     figure.append( ::basegfx::B2DPoint( -0.5, -c ) );
      89           0 :     figure.append( ::basegfx::B2DPoint( -0.5 - s, 0.0 ) );
      90           0 :     figure.append( ::basegfx::B2DPoint( -0.5, c ) );
      91           0 :     figure.setClosed(true);
      92           0 :     return new FigureWipe(figure);
      93             : }
      94             : 
      95           0 : FigureWipe * FigureWipe::createStarWipe( sal_Int32 nPoints )
      96             : {
      97           0 :     const double v = (M_PI / nPoints);
      98           0 :     const ::basegfx::B2DPoint p_( 0.0, -M_SQRT2 );
      99           0 :     ::basegfx::B2DPolygon figure;
     100           0 :     for ( sal_Int32 pos = 0; pos < nPoints; ++pos ) {
     101           0 :         const double w = (pos * 2.0 * M_PI / nPoints);
     102           0 :         ::basegfx::B2DHomMatrix aTransform;
     103           0 :         ::basegfx::B2DPoint p(p_);
     104           0 :         aTransform.rotate( -w );
     105           0 :         p *= aTransform;
     106           0 :         figure.append(p);
     107           0 :         p = p_;
     108           0 :         aTransform.identity();
     109           0 :         aTransform.scale( 0.5, 0.5 );
     110           0 :         aTransform.rotate( -w - v );
     111           0 :         p *= aTransform;
     112           0 :         figure.append(p);
     113           0 :     }
     114           0 :     figure.setClosed(true);
     115           0 :     return new FigureWipe(figure);
     116             : }
     117             : 
     118             : }
     119             : }
     120             : 
     121             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11