diff options
Diffstat (limited to 'slideshow/source/engine/transitions')
53 files changed, 8271 insertions, 0 deletions
diff --git a/slideshow/source/engine/transitions/barndoorwipe.cxx b/slideshow/source/engine/transitions/barndoorwipe.cxx new file mode 100644 index 000000000000..2fa0f6517a5b --- /dev/null +++ b/slideshow/source/engine/transitions/barndoorwipe.cxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include "barndoorwipe.hxx" + + +namespace slideshow { +namespace internal { + +::basegfx::B2DPolyPolygon BarnDoorWipe::operator () ( double t ) +{ + if (m_doubled) + t /= 2.0; + + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5)); + aTransform.scale( ::basegfx::pruneScaleValue(t), 1.0 ); + aTransform.translate( 0.5, 0.5 ); + ::basegfx::B2DPolygon poly( m_unitRect ); + poly.transform( aTransform ); + ::basegfx::B2DPolyPolygon res(poly); + + if (m_doubled) { + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); + aTransform.rotate( M_PI_2 ); + aTransform.translate( 0.5, 0.5 ); + poly.transform( aTransform ); + res.append(poly); + } + + return res; +} + +} +} diff --git a/slideshow/source/engine/transitions/barndoorwipe.hxx b/slideshow/source/engine/transitions/barndoorwipe.hxx new file mode 100644 index 000000000000..ddec5ed862b0 --- /dev/null +++ b/slideshow/source/engine/transitions/barndoorwipe.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_BARNDOORWIPE_HXX +#define INCLUDED_SLIDESHOW_BARNDOORWIPE_HXX + +#include <basegfx/polygon/b2dpolygon.hxx> + +#include "parametricpolypolygon.hxx" +#include "transitiontools.hxx" + + +namespace slideshow { +namespace internal { + +/// Generate a barn door wipe or double barn door wipe: +class BarnDoorWipe : public ParametricPolyPolygon +{ +public: + BarnDoorWipe( bool doubled = false ) + : m_unitRect( createUnitRect() ), m_doubled(doubled) {} + virtual ::basegfx::B2DPolyPolygon operator()( double x ); +private: + const ::basegfx::B2DPolygon m_unitRect; + const bool m_doubled; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_BARNDOORWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/barwipepolypolygon.cxx b/slideshow/source/engine/transitions/barwipepolypolygon.cxx new file mode 100644 index 000000000000..0c01212c0d14 --- /dev/null +++ b/slideshow/source/engine/transitions/barwipepolypolygon.cxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include "barwipepolypolygon.hxx" + + +namespace slideshow { +namespace internal { + +::basegfx::B2DPolyPolygon BarWipePolyPolygon::operator () ( double t ) +{ + ::basegfx::B2DPolyPolygon res; + ::basegfx::B2DHomMatrix aTransform; + aTransform.scale( ::basegfx::pruneScaleValue( t / m_nBars ), 1.0 ); + for ( sal_Int32 i = m_nBars; i--; ) + { + ::basegfx::B2DHomMatrix transform( aTransform ); + transform.translate( static_cast<double>(i) / m_nBars, 0.0 ); + ::basegfx::B2DPolygon poly( m_unitRect ); + poly.transform( transform ); + res.append( poly ); + } + return res; +} + +} +} diff --git a/slideshow/source/engine/transitions/barwipepolypolygon.hxx b/slideshow/source/engine/transitions/barwipepolypolygon.hxx new file mode 100644 index 000000000000..a8bdd2664431 --- /dev/null +++ b/slideshow/source/engine/transitions/barwipepolypolygon.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_BARWIPEPOLYPOLYGON_HXX +#define INCLUDED_SLIDESHOW_BARWIPEPOLYPOLYGON_HXX + +#include "parametricpolypolygon.hxx" +#include "transitiontools.hxx" + + +namespace slideshow { +namespace internal { + +/// Generates a horizontal, left-to-right bar wipe: +class BarWipePolyPolygon : public ParametricPolyPolygon +{ +public: + BarWipePolyPolygon( sal_Int32 nBars = 1 /* nBars > 1: blinds effect */ ) + : m_nBars(nBars), + m_unitRect( createUnitRect() ) + {} + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +private: + const sal_Int32 m_nBars; + const ::basegfx::B2DPolygon m_unitRect; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_BARWIPEPOLYPOLYGON_HXX */ diff --git a/slideshow/source/engine/transitions/boxwipe.cxx b/slideshow/source/engine/transitions/boxwipe.cxx new file mode 100644 index 000000000000..7b522eb48bc4 --- /dev/null +++ b/slideshow/source/engine/transitions/boxwipe.cxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include "boxwipe.hxx" + + +namespace slideshow { +namespace internal { + +::basegfx::B2DPolyPolygon BoxWipe::operator () ( double t ) +{ + ::basegfx::B2DHomMatrix aTransform; + double d = ::basegfx::pruneScaleValue(t); + if (m_topCentered) { + aTransform.translate( -0.5, 0.0 ); + aTransform.scale( d, d ); + aTransform.translate( 0.5, 0.0 ); + } else { + aTransform.scale( d, d ); + } + + ::basegfx::B2DPolyPolygon res( m_unitRect ); + res.transform( aTransform ); + return res; +} + +} +} diff --git a/slideshow/source/engine/transitions/boxwipe.hxx b/slideshow/source/engine/transitions/boxwipe.hxx new file mode 100644 index 000000000000..ac2ed0972c0f --- /dev/null +++ b/slideshow/source/engine/transitions/boxwipe.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_BOXWIPE_HXX +#define INCLUDED_SLIDESHOW_BOXWIPE_HXX + +#include "parametricpolypolygon.hxx" +#include "transitiontools.hxx" + + +namespace slideshow { +namespace internal { + +/// Generates a default topleft to right bottom box wipe +class BoxWipe : public ParametricPolyPolygon +{ +public: + BoxWipe( bool topCentered ) : m_topCentered(topCentered), + m_unitRect( createUnitRect() ) + {} + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +private: + const bool m_topCentered; + const ::basegfx::B2DPolyPolygon m_unitRect; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_BOXWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/checkerboardwipe.cxx b/slideshow/source/engine/transitions/checkerboardwipe.cxx new file mode 100644 index 000000000000..630c046d438f --- /dev/null +++ b/slideshow/source/engine/transitions/checkerboardwipe.cxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include "checkerboardwipe.hxx" + + +namespace slideshow { +namespace internal { + +::basegfx::B2DPolyPolygon CheckerBoardWipe::operator () ( double t ) +{ + const double d = (1.0 / m_unitsPerEdge); + ::basegfx::B2DHomMatrix aTransform; + aTransform.scale( ::basegfx::pruneScaleValue( d * 2.0 * t ), + ::basegfx::pruneScaleValue( d ) ); + + ::basegfx::B2DPolyPolygon res; + for ( sal_Int32 i = m_unitsPerEdge; i--; ) + { + ::basegfx::B2DHomMatrix transform( aTransform ); + if ((i % 2) == 1) // odd line + transform.translate( -d, 0.0 ); + for ( sal_Int32 j = (m_unitsPerEdge / 2) + 1; j--; ) + { + ::basegfx::B2DPolyPolygon poly( m_unitRect ); + poly.transform( transform ); + res.append( poly ); + transform.translate( d * 2.0, 0.0 ); + } + aTransform.translate( 0.0, d ); // next line + } + return res; +} + +} +} diff --git a/slideshow/source/engine/transitions/checkerboardwipe.hxx b/slideshow/source/engine/transitions/checkerboardwipe.hxx new file mode 100644 index 000000000000..8a8ac15c6de1 --- /dev/null +++ b/slideshow/source/engine/transitions/checkerboardwipe.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_CHECKERBOARDWIPE_HXX +#define INCLUDED_SLIDESHOW_CHECKERBOARDWIPE_HXX + +#include <osl/diagnose.h> + +#include "transitiontools.hxx" +#include "parametricpolypolygon.hxx" + + +namespace slideshow { +namespace internal { + +/// Generate a check board wipe (across) +class CheckerBoardWipe : public ParametricPolyPolygon +{ +public: + CheckerBoardWipe( sal_Int32 unitsPerEdge = 10 ) + : m_unitsPerEdge(unitsPerEdge), + m_unitRect( createUnitRect() ) + { OSL_ASSERT( (unitsPerEdge % 2) == 0 ); } + virtual ::basegfx::B2DPolyPolygon operator () ( double x ); +private: + const sal_Int32 m_unitsPerEdge; + const ::basegfx::B2DPolyPolygon m_unitRect; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_CHECKERBOARDWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/clippingfunctor.cxx b/slideshow/source/engine/transitions/clippingfunctor.cxx new file mode 100644 index 000000000000..cef1e821f8f0 --- /dev/null +++ b/slideshow/source/engine/transitions/clippingfunctor.cxx @@ -0,0 +1,238 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <tools/diagnose_ex.h> +#include "clippingfunctor.hxx" +#include "transitiontools.hxx" + +#include <basegfx/polygon/b2dpolypolygoncutter.hxx> +#include <basegfx/polygon/b2dpolygonclipper.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolypolygoncutter.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> + +namespace slideshow +{ + namespace internal + { + ClippingFunctor::ClippingFunctor(const ParametricPolyPolygonSharedPtr& rPolygon, + const TransitionInfo& rTransitionInfo, + bool bDirectionForward, + bool bModeIn ) : + mpParametricPoly( rPolygon ), + maStaticTransformation(), + // AW: Not needed + // maBackgroundRect( createUnitRect() ), + mbForwardParameterSweep( true ), + mbSubtractPolygon( false ), + mbScaleIsotrophically( rTransitionInfo.mbScaleIsotrophically ), + mbFlip(false) + { + ENSURE_OR_THROW( rPolygon, + "ClippingFunctor::ClippingFunctor(): Invalid parametric polygon" ); + + // maBackgroundRect serves as the minuent when + // subtracting a given clip polygon from the + // background. To speed up the clipper algo, avoid + // actual intersections of the generated + // poly-polygon with the minuent - i.e. choose the + // polygon to subtract from sufficiently large. + + // blow up unit rect to (-1,-1),(2,2) + // AW: Not needed, just use range + // ::basegfx::B2DHomMatrix aMatrix; + // aMatrix.scale(3.0,3.0); + // aMatrix.translate(-1.0,-1.0); + // maBackgroundRect.transform( aMatrix ); + + // extract modification info from maTransitionInfo + // ----------------------------------------------- + + // perform general transformations _before_ the reverse + // mode changes. This allows the Transition table to be + // filled more constitently (otherwise, when e.g. rotating + // a clip 90 degrees, the REVERSEMETHOD_FLIP_X becomes + // REVERSEMETHOD_FLIP_Y instead) + if (rTransitionInfo.mnRotationAngle != 0.0 || + rTransitionInfo.mnScaleX != 1.0 || + rTransitionInfo.mnScaleY != 1.0) + { + maStaticTransformation.translate( -0.5, -0.5 ); + // apply further transformations: + if (rTransitionInfo.mnRotationAngle != 0.0) + { + maStaticTransformation.rotate( + basegfx::deg2rad(rTransitionInfo.mnRotationAngle) ); + } + if (rTransitionInfo.mnScaleX != 1.0 || + rTransitionInfo.mnScaleY != 1.0) + { + maStaticTransformation.scale( + rTransitionInfo.mnScaleX, + rTransitionInfo.mnScaleY ); + } + maStaticTransformation.translate( 0.5, 0.5 ); + } + + if( !bDirectionForward ) + { + // Client has requested reversed + // direction. Apply TransitionInfo's choice + // for that + switch( rTransitionInfo.meReverseMethod ) + { + default: + ENSURE_OR_THROW( + false, + "TransitionFactory::TransitionFactory(): Unexpected reverse method" ); + break; + + case TransitionInfo::REVERSEMETHOD_IGNORE: + break; + + case TransitionInfo::REVERSEMETHOD_INVERT_SWEEP: + mbForwardParameterSweep = !mbForwardParameterSweep; + break; + + case TransitionInfo::REVERSEMETHOD_SUBTRACT_POLYGON: + mbSubtractPolygon = !mbSubtractPolygon; + break; + + case TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT: + mbForwardParameterSweep = !mbForwardParameterSweep; + mbSubtractPolygon = !mbSubtractPolygon; + break; + + case TransitionInfo::REVERSEMETHOD_ROTATE_180: + maStaticTransformation = basegfx::tools::createRotateAroundPoint(0.5, 0.5, M_PI) + * maStaticTransformation; + break; + + case TransitionInfo::REVERSEMETHOD_FLIP_X: + maStaticTransformation = basegfx::tools::createScaleTranslateB2DHomMatrix(-1.0, 1.0, 1.0, 0.0) + * maStaticTransformation; + mbFlip = true; + break; + + case TransitionInfo::REVERSEMETHOD_FLIP_Y: + maStaticTransformation = basegfx::tools::createScaleTranslateB2DHomMatrix(1.0, -1.0, 0.0, 1.0) + * maStaticTransformation; + mbFlip = true; + break; + } + } + + if( !bModeIn ) + { + // client has requested 'out' mode. Apply + // TransitionInfo's method of choice + if( rTransitionInfo.mbOutInvertsSweep ) + mbForwardParameterSweep = !mbForwardParameterSweep; + else + mbSubtractPolygon = !mbSubtractPolygon; + } + } + + ::basegfx::B2DPolyPolygon ClippingFunctor::operator()( double nValue, + const ::basegfx::B2DSize& rTargetSize ) + { + // modify clip polygon according to static + // transformation plus current shape size + ::basegfx::B2DHomMatrix aMatrix( maStaticTransformation ); + + // retrieve current clip polygon + ::basegfx::B2DPolyPolygon aClipPoly = (*mpParametricPoly)( + mbForwardParameterSweep ? nValue : 1.0 - nValue ); + + // TODO(Q4): workaround here, better be fixed in cppcanvas + if (aClipPoly.count() == 0) + aClipPoly.append( basegfx::B2DPolygon() ); + + if (mbFlip) + aClipPoly.flip(); + + // currently, clipper cannot cope with curves. Subdivide first + // AW: Should be no longer necessary; clipping tools are now bezier-safe + // if( aClipPoly.areControlPointsUsed() ) + // aClipPoly = ::basegfx::tools::adaptiveSubdivideByAngle(aClipPoly); + + if( mbSubtractPolygon ) + { + // subtract given polygon from background + // rect. Do that before any transformations. + + // calc maBackgroundRect \ aClipPoly + // ================================= + + // AW: Simplified + // use a range with fixed size (-1,-1),(2,2) + const basegfx::B2DRange aBackgroundRange(-1, -1, 2, 2); + const basegfx::B2DRange aClipPolyRange(aClipPoly.getB2DRange()); + + if(aBackgroundRange.isInside(aClipPolyRange)) + { + // combine polygons; make the clip polygon the hole + aClipPoly = ::basegfx::tools::correctOrientations(aClipPoly); + aClipPoly.flip(); + aClipPoly.insert(0, basegfx::tools::createPolygonFromRect(aBackgroundRange)); + } + else + { + // when not completely inside aBackgroundRange clipping is needed + // substract aClipPoly from aBackgroundRange + const basegfx::B2DPolyPolygon aBackgroundPolyPoly(basegfx::tools::createPolygonFromRect(aBackgroundRange)); + aClipPoly = basegfx::tools::solvePolygonOperationDiff(aBackgroundPolyPoly, aClipPoly); + } + } + + // scale polygon up to current shape size + if( mbScaleIsotrophically ) + { + const double nScale( ::std::max( rTargetSize.getX(), + rTargetSize.getY() ) ); + aMatrix.scale( nScale, nScale ); + aMatrix.translate( -(nScale-rTargetSize.getX())/2.0, + -(nScale-rTargetSize.getY())/2.0 ); + } + else + { + aMatrix.scale( rTargetSize.getX(), + rTargetSize.getY() ); + } + + // apply cumulative transformation to clip polygon + aClipPoly.transform( aMatrix ); + + return aClipPoly; + } + + } +} diff --git a/slideshow/source/engine/transitions/clippingfunctor.hxx b/slideshow/source/engine/transitions/clippingfunctor.hxx new file mode 100644 index 000000000000..05a521233930 --- /dev/null +++ b/slideshow/source/engine/transitions/clippingfunctor.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_CLIPPINGFUNCTOR_HXX +#define INCLUDED_SLIDESHOW_CLIPPINGFUNCTOR_HXX + +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/vector/b2dsize.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <transitioninfo.hxx> +#include <parametricpolypolygon.hxx> + + +namespace slideshow +{ + namespace internal + { + /** Generates the final clipping polygon. + + This class serves as the functor, which generates the + final clipping polygon from a given ParametricPolyPolygon + and a TransitionInfo. + + The ParametricPolyPolygon can be obtained from the + ParametricPolyPolygonFactory, see there. + + The TransitionInfo further parameterizes the polygon + generated by the ParametricPolyPolygon, with common + modifications such as rotation, flipping, or change of + direction. This allows the ParametricPolyPolygonFactory to + provide only prototypical shapes, with the ClippingFunctor + further customizing the output. + */ + class ClippingFunctor + { + public: + ClippingFunctor( + const ParametricPolyPolygonSharedPtr& rPolygon, + const TransitionInfo& rTransitionInfo, + bool bDirectionForward, + bool bModeIn ); + + /** Generate clip polygon. + + @param nValue + Value to generate the polygon for. Must be in the + range [0,1]. + + @param rTargetSize + Size the clip polygon should cover. This is typically + the size of the object the effect is applied on. + */ + ::basegfx::B2DPolyPolygon operator()( double nValue, + const ::basegfx::B2DSize& rTargetSize ); + + private: + ParametricPolyPolygonSharedPtr mpParametricPoly; + ::basegfx::B2DHomMatrix maStaticTransformation; + // AW: Not needed + // ::basegfx::B2DPolyPolygon maBackgroundRect; + bool mbForwardParameterSweep; + bool mbSubtractPolygon; + const bool mbScaleIsotrophically; + bool mbFlip; + }; + + } +} + +#endif /* INCLUDED_SLIDESHOW_CLIPPINGFUNCTOR_HXX */ diff --git a/slideshow/source/engine/transitions/clockwipe.cxx b/slideshow/source/engine/transitions/clockwipe.cxx new file mode 100644 index 000000000000..c6eecf0873f5 --- /dev/null +++ b/slideshow/source/engine/transitions/clockwipe.cxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include "clockwipe.hxx" + + +namespace slideshow { +namespace internal { + +::basegfx::B2DPolygon ClockWipe::calcCenteredClock( double t, double e ) +{ + ::basegfx::B2DPolygon poly; + ::basegfx::B2DHomMatrix aTransform; + aTransform.rotate( t * 2.0 * M_PI ); + const double MAX_EDGE = 2.0; + ::basegfx::B2DPoint p( 0.0, -MAX_EDGE ); + p *= aTransform; + poly.append( p ); + if (t >= 0.875) + poly.append( ::basegfx::B2DPoint( -e, -e ) ); + if (t >= 0.625) + poly.append( ::basegfx::B2DPoint( -e, e ) ); + if (t >= 0.375) + poly.append( ::basegfx::B2DPoint( e, e ) ); + if (t >= 0.125) + poly.append( ::basegfx::B2DPoint( e, -e ) ); + poly.append( ::basegfx::B2DPoint( 0.0, -e ) ); + poly.append( ::basegfx::B2DPoint( 0.0, 0.0 ) ); + poly.setClosed(true); + return poly; +} + +::basegfx::B2DPolyPolygon ClockWipe::operator () ( double t ) +{ + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); + ::basegfx::B2DPolygon poly( calcCenteredClock(t) ); + poly.transform( aTransform ); + return ::basegfx::B2DPolyPolygon(poly); +} + +} +} diff --git a/slideshow/source/engine/transitions/clockwipe.hxx b/slideshow/source/engine/transitions/clockwipe.hxx new file mode 100644 index 000000000000..895c9058d5aa --- /dev/null +++ b/slideshow/source/engine/transitions/clockwipe.hxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_CLOCKWIPE_HXX +#define INCLUDED_SLIDESHOW_CLOCKWIPE_HXX + +#include <basegfx/polygon/b2dpolygon.hxx> +#include "parametricpolypolygon.hxx" + + +namespace slideshow { +namespace internal { + +/// Generates a clockWiseTwelve clock wipe: +class ClockWipe : public ParametricPolyPolygon +{ +public: + /// 0,1 to 1,1 to 1,0 to 0,-1 to -1,0 to 0,1: + static ::basegfx::B2DPolygon calcCenteredClock( double t, double e = 1.0 ); + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_CLOCKWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/combtransition.cxx b/slideshow/source/engine/transitions/combtransition.cxx new file mode 100644 index 000000000000..59118cf923c6 --- /dev/null +++ b/slideshow/source/engine/transitions/combtransition.cxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> + +#include <cppcanvas/spritecanvas.hxx> + +#include "combtransition.hxx" + +#include <boost/bind.hpp> + + +namespace slideshow { +namespace internal { + +namespace { + +basegfx::B2DPolyPolygon createClipPolygon( + const ::basegfx::B2DVector& rDirection, + const ::basegfx::B2DSize& rSlideSize, + int nNumStrips, int nOffset ) +{ + // create clip polygon in standard orientation (will later + // be rotated to match direction vector) + ::basegfx::B2DPolyPolygon aClipPoly; + + // create nNumStrips/2 vertical strips + for( int i=nOffset; i<nNumStrips; i+=2 ) + { + aClipPoly.append( + ::basegfx::tools::createPolygonFromRect( + ::basegfx::B2DRectangle( double(i)/nNumStrips, 0.0, + double(i+1)/nNumStrips, 1.0) ) ); + + } + + // rotate polygons, such that the strips are parallel to + // the given direction vector + const ::basegfx::B2DVector aUpVec(0.0, 1.0); + basegfx::B2DHomMatrix aMatrix(basegfx::tools::createRotateAroundPoint(0.5, 0.5, aUpVec.angle( rDirection ))); + + // blow up clip polygon to slide size + aMatrix.scale( rSlideSize.getX(), + rSlideSize.getY() ); + + aClipPoly.transform( aMatrix ); + + return aClipPoly; +} + +} + +CombTransition::CombTransition( + boost::optional<SlideSharedPtr> const & leavingSlide, + const SlideSharedPtr& pEnteringSlide, + const SoundPlayerSharedPtr& pSoundPlayer, + const UnoViewContainer& rViewContainer, + ScreenUpdater& rScreenUpdater, + EventMultiplexer& rEventMultiplexer, + const ::basegfx::B2DVector& rPushDirection, + sal_Int32 nNumStripes ) + : SlideChangeBase( leavingSlide, pEnteringSlide, pSoundPlayer, + rViewContainer, rScreenUpdater, rEventMultiplexer, + false /* no leaving sprite */, + false /* no entering sprite */ ), + maPushDirectionUnit( rPushDirection ), + mnNumStripes( nNumStripes ) +{ +} + +void CombTransition::renderComb( double t, + const ViewEntry& rViewEntry ) const +{ + const SlideBitmapSharedPtr& pEnteringBitmap = getEnteringBitmap(rViewEntry); + const cppcanvas::CanvasSharedPtr pCanvas_ = rViewEntry.mpView->getCanvas(); + + if( !pEnteringBitmap || !pCanvas_ ) + return; + + // calc bitmap offsets. The enter/leaving bitmaps are only + // as large as the actual slides. For scaled-down + // presentations, we have to move the left, top edge of + // those bitmaps to the actual position, governed by the + // given view transform. The aBitmapPosPixel local + // variable is already in device coordinate space + // (i.e. pixel). + + // TODO(F2): Properly respect clip here. Might have to be transformed, too. + const basegfx::B2DHomMatrix viewTransform( rViewEntry.mpView->getTransformation() ); + const basegfx::B2DPoint pageOrigin( viewTransform * basegfx::B2DPoint() ); + + // change transformation on cloned canvas to be in + // device pixel + cppcanvas::CanvasSharedPtr pCanvas( pCanvas_->clone() ); + basegfx::B2DPoint p; + + // TODO(Q2): Use basegfx bitmaps here + // TODO(F1): SlideBitmap is not fully portable between different canvases! + + const basegfx::B2DSize enteringSizePixel( + getEnteringSlideSizePixel( rViewEntry.mpView) ); + + const basegfx::B2DVector aPushDirection = basegfx::B2DVector( + enteringSizePixel * maPushDirectionUnit ); + const basegfx::B2DPolyPolygon aClipPolygon1 = basegfx::B2DPolyPolygon( + createClipPolygon( maPushDirectionUnit, + enteringSizePixel, + mnNumStripes, 0 ) ); + const basegfx::B2DPolyPolygon aClipPolygon2 = basegfx::B2DPolyPolygon( + createClipPolygon( maPushDirectionUnit, + enteringSizePixel, + mnNumStripes, 1 ) ); + + SlideBitmapSharedPtr const & pLeavingBitmap = getLeavingBitmap(rViewEntry); + if( pLeavingBitmap ) + { + // render odd strips: + pLeavingBitmap->clip( aClipPolygon1 ); + // don't modify bitmap object (no move!): + p = basegfx::B2DPoint( pageOrigin + (t * aPushDirection) ); + pCanvas->setTransformation(basegfx::tools::createTranslateB2DHomMatrix(p.getX(), p.getY())); + pLeavingBitmap->draw( pCanvas ); + + // render even strips: + pLeavingBitmap->clip( aClipPolygon2 ); + // don't modify bitmap object (no move!): + p = basegfx::B2DPoint( pageOrigin - (t * aPushDirection) ); + pCanvas->setTransformation(basegfx::tools::createTranslateB2DHomMatrix(p.getX(), p.getY())); + pLeavingBitmap->draw( pCanvas ); + } + + // TODO(Q2): Use basegfx bitmaps here + // TODO(F1): SlideBitmap is not fully portable between different canvases! + + // render odd strips: + pEnteringBitmap->clip( aClipPolygon1 ); + // don't modify bitmap object (no move!): + p = basegfx::B2DPoint( pageOrigin + ((t - 1.0) * aPushDirection) ); + pCanvas->setTransformation(basegfx::tools::createTranslateB2DHomMatrix(p.getX(), p.getY())); + pEnteringBitmap->draw( pCanvas ); + + // render even strips: + pEnteringBitmap->clip( aClipPolygon2 ); + // don't modify bitmap object (no move!): + p = basegfx::B2DPoint( pageOrigin + ((1.0 - t) * aPushDirection) ); + pCanvas->setTransformation(basegfx::tools::createTranslateB2DHomMatrix(p.getX(), p.getY())); + pEnteringBitmap->draw( pCanvas ); +} + +bool CombTransition::operator()( double t ) +{ + std::for_each( beginViews(), + endViews(), + boost::bind( &CombTransition::renderComb, + this, + t, + _1 )); + + getScreenUpdater().notifyUpdate(); + + return true; +} + +} // namespace internal +} // namespace presentation diff --git a/slideshow/source/engine/transitions/combtransition.hxx b/slideshow/source/engine/transitions/combtransition.hxx new file mode 100644 index 000000000000..b8014a6d5ef1 --- /dev/null +++ b/slideshow/source/engine/transitions/combtransition.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SLIDESHOW_COMBTRANSITION_HXX +#define INCLUDED_SLIDESHOW_COMBTRANSITION_HXX + +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include "slidechangebase.hxx" + +namespace slideshow { +namespace internal { + +/** Comb transition class. + + This class provides a SlideChangeAnimation, showing a + comb-like effect (stripes of alternating push effects). +*/ +class CombTransition : public SlideChangeBase +{ +public: + /** Create the comb transition effect. + + @param nNumStripes + Number of comb-like stripes to show in this effect + */ + CombTransition( ::boost::optional<SlideSharedPtr> const & leavingSlide, + const SlideSharedPtr& pEnteringSlide, + const SoundPlayerSharedPtr& pSoundPlayer, + const UnoViewContainer& rViewContainer, + ScreenUpdater& rScreenUpdater, + EventMultiplexer& rEventMultiplexer, + const ::basegfx::B2DVector& rPushDirection, + sal_Int32 nNumStripes ); + + // NumberAnimation + virtual bool operator()( double x ); + +private: + const ::basegfx::B2DVector maPushDirectionUnit; + sal_Int32 mnNumStripes; + + void renderComb( double t, const ViewEntry& rViewEntry ) const; +}; + +} // namespace internal +} // namespace presentation + +#endif /* INCLUDED_SLIDESHOW_COMBTRANSITION_HXX */ diff --git a/slideshow/source/engine/transitions/doublediamondwipe.cxx b/slideshow/source/engine/transitions/doublediamondwipe.cxx new file mode 100644 index 000000000000..62a9f342ed86 --- /dev/null +++ b/slideshow/source/engine/transitions/doublediamondwipe.cxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include "doublediamondwipe.hxx" + + +namespace slideshow { +namespace internal { + +::basegfx::B2DPolyPolygon DoubleDiamondWipe::operator () ( double t ) +{ + // outer: + const double a = ::basegfx::pruneScaleValue( 0.25 + (t * 0.75) ); + ::basegfx::B2DPolygon poly; + poly.append( ::basegfx::B2DPoint( 0.5 + a, 0.5 ) ); + poly.append( ::basegfx::B2DPoint( 0.5, 0.5 - a ) ); + poly.append( ::basegfx::B2DPoint( 0.5 - a, 0.5 ) ); + poly.append( ::basegfx::B2DPoint( 0.5, 0.5 + a ) ); + poly.setClosed(true); + ::basegfx::B2DPolyPolygon res(poly); + + // inner (reverse order to clip): + const double b = ::basegfx::pruneScaleValue( (1.0 - t) * 0.25 ); + poly.clear(); + poly.append( ::basegfx::B2DPoint( 0.5 + b, 0.5 ) ); + poly.append( ::basegfx::B2DPoint( 0.5, 0.5 + b ) ); + poly.append( ::basegfx::B2DPoint( 0.5 - b, 0.5 ) ); + poly.append( ::basegfx::B2DPoint( 0.5, 0.5 - b ) ); + poly.setClosed(true); + res.append(poly); + + return res; +} + +} +} diff --git a/slideshow/source/engine/transitions/doublediamondwipe.hxx b/slideshow/source/engine/transitions/doublediamondwipe.hxx new file mode 100644 index 000000000000..ff3880d12ce8 --- /dev/null +++ b/slideshow/source/engine/transitions/doublediamondwipe.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_DOUBLEDIAMONDWIPE_HXX +#define INCLUDED_SLIDESHOW_DOUBLEDIAMONDWIPE_HXX + +#include <basegfx/polygon/b2dpolypolygon.hxx> + +#include "parametricpolypolygon.hxx" +#include "transitiontools.hxx" + + +namespace slideshow { +namespace internal { + +/// Generates a double diamond wipe: +class DoubleDiamondWipe : public ParametricPolyPolygon +{ +public: + DoubleDiamondWipe() : m_unitRect( createUnitRect() ) {} + virtual ::basegfx::B2DPolyPolygon operator()( double x ); +private: + const ::basegfx::B2DPolyPolygon m_unitRect; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_DOUBLEDIAMONDWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/ellipsewipe.cxx b/slideshow/source/engine/transitions/ellipsewipe.cxx new file mode 100644 index 000000000000..ca1652cdd03b --- /dev/null +++ b/slideshow/source/engine/transitions/ellipsewipe.cxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include "ellipsewipe.hxx" +#include "transitiontools.hxx" + + +namespace slideshow { +namespace internal { + +::basegfx::B2DPolyPolygon EllipseWipe::operator () ( double t ) +{ + // currently only circle: + ::basegfx::B2DPolygon poly( + ::basegfx::tools::createPolygonFromCircle( + ::basegfx::B2DPoint( 0.5, 0.5 ), + ::basegfx::pruneScaleValue( t * M_SQRT2 / 2.0 ) ) ); + return ::basegfx::B2DPolyPolygon( poly ); +} + +} +} diff --git a/slideshow/source/engine/transitions/ellipsewipe.hxx b/slideshow/source/engine/transitions/ellipsewipe.hxx new file mode 100644 index 000000000000..03a2df4d409a --- /dev/null +++ b/slideshow/source/engine/transitions/ellipsewipe.hxx @@ -0,0 +1,48 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_ELLIPSEWIPE_HXX +#define INCLUDED_SLIDESHOW_ELLIPSEWIPE_HXX + +#include "parametricpolypolygon.hxx" + + +namespace slideshow { +namespace internal { + +/// Generate a iris wipe +class EllipseWipe : public ParametricPolyPolygon +{ +public: + EllipseWipe( sal_Int32 /*nTransitionSubType xxx todo */ ) {} + virtual ::basegfx::B2DPolyPolygon operator () ( double x ); +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_ELLIPSEWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/fanwipe.cxx b/slideshow/source/engine/transitions/fanwipe.cxx new file mode 100644 index 000000000000..43476e0a01fd --- /dev/null +++ b/slideshow/source/engine/transitions/fanwipe.cxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include "transitiontools.hxx" +#include "clockwipe.hxx" +#include "fanwipe.hxx" + + +namespace slideshow { +namespace internal { + +::basegfx::B2DPolyPolygon FanWipe::operator () ( double t ) +{ + ::basegfx::B2DPolyPolygon res; + ::basegfx::B2DPolygon poly( + ClockWipe::calcCenteredClock( + t / ((m_center && m_single) ? 2.0 : 4.0) ) ); + + res.append( poly ); + // flip on y-axis: + poly.transform(basegfx::tools::createScaleB2DHomMatrix(-1.0, 1.0)); + poly.flip(); + res.append( poly ); + + if (m_center) + { + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); + + if (! m_single) + res.append( flipOnXAxis(res) ); + } + else + { + OSL_ASSERT( ! m_fanIn ); + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 1.0, 0.5, 1.0)); + } + return res; +} + +} +} + diff --git a/slideshow/source/engine/transitions/fanwipe.hxx b/slideshow/source/engine/transitions/fanwipe.hxx new file mode 100644 index 000000000000..bb8168897b6d --- /dev/null +++ b/slideshow/source/engine/transitions/fanwipe.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_FANWIPE_HXX +#define INCLUDED_SLIDESHOW_FANWIPE_HXX + +#include "parametricpolypolygon.hxx" + + +namespace slideshow { +namespace internal { + +/// Generates a centerTop (center=true) or double fan wipe: +class FanWipe : public ParametricPolyPolygon +{ +public: + FanWipe( bool center, bool single = true, bool fanIn = false ) + : m_center(center), m_single(single), m_fanIn(fanIn) {} + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +private: + bool m_center, m_single, m_fanIn; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_FANWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/figurewipe.cxx b/slideshow/source/engine/transitions/figurewipe.cxx new file mode 100644 index 000000000000..22a2001487d7 --- /dev/null +++ b/slideshow/source/engine/transitions/figurewipe.cxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + * ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include "transitiontools.hxx" +#include "figurewipe.hxx" + + +namespace slideshow { +namespace internal { + +::basegfx::B2DPolyPolygon FigureWipe::operator () ( double t ) +{ + ::basegfx::B2DPolyPolygon res(m_figure); + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(t, t, 0.5, 0.5)); + return res; +} + +FigureWipe * FigureWipe::createTriangleWipe() +{ + const double s60 = sin( basegfx::deg2rad(60.0) ); + const double s30 = sin( basegfx::deg2rad(30.0) ); + ::basegfx::B2DPolygon figure; + figure.append( ::basegfx::B2DPoint( 0.5 + s30, 0.5 ) ); + figure.append( ::basegfx::B2DPoint( 0.0, -0.5 - s60 ) ); + figure.append( ::basegfx::B2DPoint( -0.5 - s30, 0.5 ) ); + figure.setClosed(true); + return new FigureWipe(figure); +} + +FigureWipe * FigureWipe::createArrowHeadWipe() +{ + const double s60 = sin( basegfx::deg2rad(60.0) ); + const double s30 = sin( basegfx::deg2rad(30.0) ); + const double off = s30; + ::basegfx::B2DPolygon figure; + figure.append( ::basegfx::B2DPoint( 0.5 + s30 + off, 0.5 + off ) ); + figure.append( ::basegfx::B2DPoint( 0.0, -0.5 - s60 ) ); + figure.append( ::basegfx::B2DPoint( -0.5 - s30 - off, 0.5 + off ) ); + figure.append( ::basegfx::B2DPoint( 0.0, 0.5 ) ); + figure.setClosed(true); + return new FigureWipe(figure); +} + +FigureWipe * FigureWipe::createPentagonWipe() +{ + const double s = sin( basegfx::deg2rad(18.0) ); + const double c = cos( basegfx::deg2rad(18.0) ); + ::basegfx::B2DPolygon figure; + figure.append( ::basegfx::B2DPoint( 0.5, 0.5 ) ); + figure.append( ::basegfx::B2DPoint( 0.5 + s, 0.5 - c ) ); + figure.append( ::basegfx::B2DPoint( 0.0, 0.5 - c - sin(basegfx::deg2rad(36.0)) ) ); + figure.append( ::basegfx::B2DPoint( -0.5 - s, 0.5 - c ) ); + figure.append( ::basegfx::B2DPoint( -0.5, 0.5 ) ); + figure.setClosed(true); + return new FigureWipe(figure); +} + +FigureWipe * FigureWipe::createHexagonWipe() +{ + const double s = sin( basegfx::deg2rad(30.0) ); + const double c = cos( basegfx::deg2rad(30.0) ); + ::basegfx::B2DPolygon figure; + figure.append( ::basegfx::B2DPoint( 0.5, c ) ); + figure.append( ::basegfx::B2DPoint( 0.5 + s, 0.0 ) ); + figure.append( ::basegfx::B2DPoint( 0.5, -c ) ); + figure.append( ::basegfx::B2DPoint( -0.5, -c ) ); + figure.append( ::basegfx::B2DPoint( -0.5 - s, 0.0 ) ); + figure.append( ::basegfx::B2DPoint( -0.5, c ) ); + figure.setClosed(true); + return new FigureWipe(figure); +} + +FigureWipe * FigureWipe::createStarWipe( sal_Int32 nPoints ) +{ + const double v = (M_PI / nPoints); + const ::basegfx::B2DPoint p_( 0.0, -M_SQRT2 ); + ::basegfx::B2DPolygon figure; + for ( sal_Int32 pos = 0; pos < nPoints; ++pos ) { + const double w = (pos * 2.0 * M_PI / nPoints); + ::basegfx::B2DHomMatrix aTransform; + ::basegfx::B2DPoint p(p_); + aTransform.rotate( -w ); + p *= aTransform; + figure.append(p); + p = p_; + aTransform.identity(); + aTransform.scale( 0.5, 0.5 ); + aTransform.rotate( -w - v ); + p *= aTransform; + figure.append(p); + } + figure.setClosed(true); + return new FigureWipe(figure); +} + +} +} diff --git a/slideshow/source/engine/transitions/figurewipe.hxx b/slideshow/source/engine/transitions/figurewipe.hxx new file mode 100644 index 000000000000..35f56a1400d3 --- /dev/null +++ b/slideshow/source/engine/transitions/figurewipe.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_FIGUREWIPE_HXX +#define INCLUDED_SLIDESHOW_FIGUREWIPE_HXX + +#include "parametricpolypolygon.hxx" + + +namespace slideshow { +namespace internal { + +class FigureWipe : public ParametricPolyPolygon +{ +public: + static FigureWipe * createTriangleWipe(); + static FigureWipe * createArrowHeadWipe(); + static FigureWipe * createStarWipe( sal_Int32 nPoints ); + static FigureWipe * createPentagonWipe(); + static FigureWipe * createHexagonWipe(); + + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +private: + FigureWipe( ::basegfx::B2DPolygon const & figure ) : m_figure(figure) {} + const ::basegfx::B2DPolygon m_figure; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_FIGUREWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/fourboxwipe.cxx b/slideshow/source/engine/transitions/fourboxwipe.cxx new file mode 100644 index 000000000000..e003d2435f36 --- /dev/null +++ b/slideshow/source/engine/transitions/fourboxwipe.cxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include "fourboxwipe.hxx" + + +namespace slideshow { +namespace internal { + +::basegfx::B2DPolyPolygon FourBoxWipe::operator () ( double t ) +{ + ::basegfx::B2DHomMatrix aTransform; + const double d = ::basegfx::pruneScaleValue( t / 2.0 ); + if (m_cornersOut) + { + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); + aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix(d, d, -0.25, -0.25) + * aTransform; + } + else + { + aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix(d, d, -0.5, -0.5); + } + + // top left: + ::basegfx::B2DPolygon square( m_unitRect ); + square.transform( aTransform ); + ::basegfx::B2DPolyPolygon res( square ); + // bottom left, flip on x-axis: + aTransform.scale( -1.0, 1.0 ); + ::basegfx::B2DPolygon square2( m_unitRect ); + square2.transform( aTransform ); + square2.flip(); // flip direction + res.append( square2 ); + // bottom right, flip on y-axis: + aTransform.scale( 1.0, -1.0 ); + ::basegfx::B2DPolygon square3( m_unitRect ); + square3.transform( aTransform ); + res.append( square3 ); + // top right, flip on x-axis: + aTransform.scale( -1.0, 1.0 ); + ::basegfx::B2DPolygon square4( m_unitRect ); + square4.transform( aTransform ); + square4.flip(); // flip direction + res.append( square4 ); + + aTransform = basegfx::tools::createTranslateB2DHomMatrix(0.5, 0.5); + res.transform( aTransform ); + return res; +} + +} +} diff --git a/slideshow/source/engine/transitions/fourboxwipe.hxx b/slideshow/source/engine/transitions/fourboxwipe.hxx new file mode 100644 index 000000000000..47fe2141a664 --- /dev/null +++ b/slideshow/source/engine/transitions/fourboxwipe.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_FOURBOXWIPE_HXX +#define INCLUDED_SLIDESHOW_FOURBOXWIPE_HXX + +#include "parametricpolypolygon.hxx" +#include "transitiontools.hxx" +#include "basegfx/polygon/b2dpolygon.hxx" + + +namespace slideshow { +namespace internal { + +/// Generate a 4-box wipe +class FourBoxWipe : public ParametricPolyPolygon +{ +public: + FourBoxWipe( bool cornersOut ) : m_cornersOut(cornersOut), + m_unitRect( createUnitRect() ) + {} + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +private: + const bool m_cornersOut; + const ::basegfx::B2DPolygon m_unitRect; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_FOURBOXWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/iriswipe.cxx b/slideshow/source/engine/transitions/iriswipe.cxx new file mode 100644 index 000000000000..310bff92ff43 --- /dev/null +++ b/slideshow/source/engine/transitions/iriswipe.cxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include "iriswipe.hxx" + + +namespace slideshow { +namespace internal { + +::basegfx::B2DPolyPolygon IrisWipe::operator () ( double t ) +{ + const double d = ::basegfx::pruneScaleValue(t); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5)); + aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix(d, d, 0.5, 0.5) * aTransform; + + ::basegfx::B2DPolyPolygon res( m_unitRect ); + res.transform( aTransform ); + return res; +} + +} +} diff --git a/slideshow/source/engine/transitions/iriswipe.hxx b/slideshow/source/engine/transitions/iriswipe.hxx new file mode 100644 index 000000000000..86200f94aff4 --- /dev/null +++ b/slideshow/source/engine/transitions/iriswipe.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_IRISWIPE_HXX +#define INCLUDED_SLIDESHOW_IRISWIPE_HXX + +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include "parametricpolypolygon.hxx" +#include "transitiontools.hxx" + + +namespace slideshow { +namespace internal { + +/// Generate a iris wipe +class IrisWipe : public ParametricPolyPolygon +{ +public: + IrisWipe() : m_unitRect( createUnitRect() ) {} + virtual ::basegfx::B2DPolyPolygon operator()( double x ); +private: + const ::basegfx::B2DPolyPolygon m_unitRect; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_IRISWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/makefile.mk b/slideshow/source/engine/transitions/makefile.mk new file mode 100644 index 000000000000..a5fbd567721c --- /dev/null +++ b/slideshow/source/engine/transitions/makefile.mk @@ -0,0 +1,73 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=slideshow +TARGET=transitions +ENABLE_EXCEPTIONS=TRUE +PRJINC=..$/.. + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Common ---------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/barwipepolypolygon.obj \ + $(SLO)$/boxwipe.obj \ + $(SLO)$/clippingfunctor.obj \ + $(SLO)$/combtransition.obj \ + $(SLO)$/fourboxwipe.obj \ + $(SLO)$/barndoorwipe.obj \ + $(SLO)$/iriswipe.obj \ + $(SLO)$/veewipe.obj \ + $(SLO)$/ellipsewipe.obj \ + $(SLO)$/checkerboardwipe.obj \ + $(SLO)$/randomwipe.obj \ + $(SLO)$/waterfallwipe.obj \ + $(SLO)$/clockwipe.obj \ + $(SLO)$/fanwipe.obj \ + $(SLO)$/pinwheelwipe.obj \ + $(SLO)$/snakewipe.obj \ + $(SLO)$/spiralwipe.obj \ + $(SLO)$/sweepwipe.obj \ + $(SLO)$/figurewipe.obj \ + $(SLO)$/doublediamondwipe.obj \ + $(SLO)$/zigzagwipe.obj \ + $(SLO)$/parametricpolypolygonfactory.obj \ + $(SLO)$/shapetransitionfactory.obj \ + $(SLO)$/slidetransitionfactory.obj \ + $(SLO)$/transitionfactorytab.obj \ + $(SLO)$/transitiontools.obj \ + $(SLO)$/slidechangebase.obj + +# ========================================================================== + +.INCLUDE : target.mk diff --git a/slideshow/source/engine/transitions/parametricpolypolygon.hxx b/slideshow/source/engine/transitions/parametricpolypolygon.hxx new file mode 100644 index 000000000000..3fbcdffb328d --- /dev/null +++ b/slideshow/source/engine/transitions/parametricpolypolygon.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SLIDESHOW_PARAMETRICPOLYPOLYGON_HXX +#define INCLUDED_SLIDESHOW_PARAMETRICPOLYPOLYGON_HXX + +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <boost/shared_ptr.hpp> + + +/* Definition of ParametricPolyPolygon interface */ + +namespace slideshow +{ + namespace internal + { + /** Interface defining a parametric poly-polygon. + + This interface defines a poly-polygon, whose actual shape + is parameterized by a floating point value. This is + e.g. used to generically access the various clip polygon + generators for transition effects. + + Since for every parametric poly-polygon, there is a set of + variations, which can easily be generated by simple + transformations or change in parameter range sweep + direction, objects implementing this interface only + generate <em>one</em> prototypical instance of the + parametric poly-polygon. Generally speaking, the main + effect direction should be horizontal, it should make + increasingly more area visible (transition 'in'), and when + there is a designated direction given, that should be + left-to-right. + */ + class ParametricPolyPolygon + { + public: + virtual ~ParametricPolyPolygon() {} + + /** Retrieve the poly-polygon for value t. + + @param t + Current parameter value to retrieve the corresponding + poly-polygon for. Permissible values for t must be in + the range [0,1]. + + @return a poly-polygon corresponding to the given + parameter value. The poly-polygon is interpreted as + living in the unit rectangle (i.e. [0,1]x[0,1]), but + is not necessarily constrained to completely lie in + this area (this very much depends on the actual effect + to be generated). Although, from a performance + perspective, it currently <em>is</em> advantageous to + try to keep the poly-polygon within these bounds (at + least if there are no hard reasons not to do so), + because then reversion or out transformations are + potentially faster to compute (see the + TransitionInfo::meReverseMethod member in + transitionfactory.cxx). Furthermore, if one of the + polygon modifications involve subtraction (also see + TransitionInfo::meReverseMethod), all generated + polygons should be oriented clock-wise + (i.e. traversing the polygon vertices with increasing + vertex index should generate a clock-wise movement). + */ + virtual ::basegfx::B2DPolyPolygon operator()( double t ) = 0; + }; + + typedef ::boost::shared_ptr< ParametricPolyPolygon > ParametricPolyPolygonSharedPtr; + + } +} + +#endif /* INCLUDED_SLIDESHOW_PARAMETRICPOLYPOLYGON_HXX */ diff --git a/slideshow/source/engine/transitions/parametricpolypolygonfactory.cxx b/slideshow/source/engine/transitions/parametricpolypolygonfactory.cxx new file mode 100644 index 000000000000..7823a1dd6452 --- /dev/null +++ b/slideshow/source/engine/transitions/parametricpolypolygonfactory.cxx @@ -0,0 +1,312 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <tools/diagnose_ex.h> + +#include <com/sun/star/animations/TransitionType.hpp> +#include <com/sun/star/animations/TransitionSubType.hpp> + +#include "parametricpolypolygonfactory.hxx" +#include "barwipepolypolygon.hxx" +#include "boxwipe.hxx" +#include "fourboxwipe.hxx" +#include "barndoorwipe.hxx" +#include "doublediamondwipe.hxx" +#include "veewipe.hxx" +#include "iriswipe.hxx" +#include "ellipsewipe.hxx" +#include "checkerboardwipe.hxx" +#include "randomwipe.hxx" +#include "waterfallwipe.hxx" +#include "clockwipe.hxx" +#include "fanwipe.hxx" +#include "pinwheelwipe.hxx" +#include "snakewipe.hxx" +#include "spiralwipe.hxx" +#include "sweepwipe.hxx" +#include "figurewipe.hxx" +#include "zigzagwipe.hxx" + + +using namespace ::com::sun::star; + +namespace slideshow +{ + namespace internal + { + ParametricPolyPolygonSharedPtr + ParametricPolyPolygonFactory::createClipPolyPolygon( + sal_Int16 nType, sal_Int16 nSubType ) + { + using namespace ::com::sun::star::animations::TransitionType; + using namespace ::com::sun::star::animations::TransitionSubType; + + switch (nType) + { + case BARWIPE: + return ParametricPolyPolygonSharedPtr( + new BarWipePolyPolygon ); + case BLINDSWIPE: + return ParametricPolyPolygonSharedPtr( + new BarWipePolyPolygon( 6 ) ); + case BOXWIPE: + return ParametricPolyPolygonSharedPtr( + new BoxWipe( nSubType == LEFTCENTER || + nSubType == TOPCENTER || + nSubType == RIGHTCENTER|| + nSubType == BOTTOMCENTER ) ); + case FOURBOXWIPE: + return ParametricPolyPolygonSharedPtr( + new FourBoxWipe( nSubType == CORNERSOUT ) ); + case BARNDOORWIPE: + return ParametricPolyPolygonSharedPtr( + new BarnDoorWipe ); + case DIAGONALWIPE: + return ParametricPolyPolygonSharedPtr( + new BarWipePolyPolygon ); + case VEEWIPE: + return ParametricPolyPolygonSharedPtr( + new VeeWipe ); + case IRISWIPE: + return ParametricPolyPolygonSharedPtr( + new IrisWipe ); + case ELLIPSEWIPE: + return ParametricPolyPolygonSharedPtr( + new EllipseWipe(nSubType) ); + case CHECKERBOARDWIPE: + return ParametricPolyPolygonSharedPtr( + new CheckerBoardWipe ); + case RANDOMBARWIPE: + return ParametricPolyPolygonSharedPtr( + new RandomWipe( 128, true /* bars */ ) ); + case DISSOLVE: + return ParametricPolyPolygonSharedPtr( + new RandomWipe( 16 * 16, // for now until dxcanvas is faster +// 64 * 64 /* elements */, + false /* dissolve */ ) ); + case WATERFALLWIPE: + return ParametricPolyPolygonSharedPtr( + new WaterfallWipe( + 128, + // flipOnYAxis: + nSubType == VERTICALRIGHT || + nSubType == HORIZONTALLEFT ) ); + case CLOCKWIPE: + return ParametricPolyPolygonSharedPtr( + new ClockWipe ); + case FANWIPE: + return ParametricPolyPolygonSharedPtr( + new FanWipe( // center: + nSubType == CENTERTOP || + nSubType == CENTERRIGHT ) ); + case PINWHEELWIPE: { + sal_Int32 blades; + switch (nSubType) { + case ONEBLADE: + blades = 1; + break; + case THREEBLADE: + blades = 3; + break; + case FOURBLADE: + blades = 4; + break; + case EIGHTBLADE: + blades = 8; + break; + default: + blades = 2; + break; + } + return ParametricPolyPolygonSharedPtr( + new PinWheelWipe( blades ) ); + } + case SNAKEWIPE: + return ParametricPolyPolygonSharedPtr( + new SnakeWipe( + // elements: + 64 * 64, + // diagonal: + nSubType == TOPLEFTDIAGONAL || + nSubType == TOPRIGHTDIAGONAL || + nSubType == BOTTOMRIGHTDIAGONAL || + nSubType == BOTTOMLEFTDIAGONAL, + // flipOnYAxis: + nSubType == TOPLEFTVERTICAL || + nSubType == TOPRIGHTDIAGONAL || + nSubType == BOTTOMLEFTDIAGONAL + ) ); + case PARALLELSNAKESWIPE: + return ParametricPolyPolygonSharedPtr( + new ParallelSnakesWipe( + // elements: + 64 * 64, + // diagonal: + nSubType == DIAGONALBOTTOMLEFTOPPOSITE || + nSubType == DIAGONALTOPLEFTOPPOSITE, + // flipOnYAxis: + nSubType == VERTICALBOTTOMLEFTOPPOSITE || + nSubType == HORIZONTALTOPLEFTOPPOSITE || + nSubType == DIAGONALTOPLEFTOPPOSITE, + // opposite: + nSubType == VERTICALTOPLEFTOPPOSITE || + nSubType == VERTICALBOTTOMLEFTOPPOSITE || + nSubType == HORIZONTALTOPLEFTOPPOSITE || + nSubType == HORIZONTALTOPRIGHTOPPOSITE || + nSubType == DIAGONALBOTTOMLEFTOPPOSITE || + nSubType == DIAGONALTOPLEFTOPPOSITE + ) ); + case SPIRALWIPE: + return ParametricPolyPolygonSharedPtr( + new SpiralWipe( + // elements: + 64 * 64, + // flipOnYAxis: + nSubType == TOPLEFTCOUNTERCLOCKWISE || + nSubType == TOPRIGHTCOUNTERCLOCKWISE || + nSubType == BOTTOMRIGHTCOUNTERCLOCKWISE || + nSubType == BOTTOMLEFTCOUNTERCLOCKWISE ) ); + case BOXSNAKESWIPE: + return ParametricPolyPolygonSharedPtr( + new BoxSnakesWipe( + // elements: + 64 * 64, + // fourBox: + nSubType == FOURBOXVERTICAL || + nSubType == FOURBOXHORIZONTAL ) ); + case SINGLESWEEPWIPE: + return ParametricPolyPolygonSharedPtr( + new SweepWipe( + // center: + nSubType == CLOCKWISETOP || + nSubType == CLOCKWISERIGHT || + nSubType == CLOCKWISEBOTTOM || + nSubType == CLOCKWISELEFT, + // single: + true, + // oppositeVertical: + false, + // flipOnYAxis: + nSubType == COUNTERCLOCKWISEBOTTOMLEFT || + nSubType == COUNTERCLOCKWISETOPRIGHT + ) ); + case DOUBLESWEEPWIPE: + return ParametricPolyPolygonSharedPtr( + new SweepWipe( + // center: + nSubType == PARALLELVERTICAL || + nSubType == PARALLELDIAGONAL || + nSubType == OPPOSITEVERTICAL || + nSubType == OPPOSITEHORIZONTAL, + // single: + false, + // oppositeVertical: + nSubType == OPPOSITEVERTICAL || + nSubType == OPPOSITEHORIZONTAL, + // flipOnYAxis: + false ) ); + case DOUBLEFANWIPE: + return ParametricPolyPolygonSharedPtr( + new FanWipe( + //center: + true, + // single: + false, + // fanIn: + nSubType == FANINVERTICAL || + nSubType == FANINHORIZONTAL ) ); + case TRIANGLEWIPE: + return ParametricPolyPolygonSharedPtr( + FigureWipe::createTriangleWipe() ); + case ARROWHEADWIPE: + return ParametricPolyPolygonSharedPtr( + FigureWipe::createArrowHeadWipe() ); + case PENTAGONWIPE: + return ParametricPolyPolygonSharedPtr( + FigureWipe::createPentagonWipe() ); + case HEXAGONWIPE: + return ParametricPolyPolygonSharedPtr( + FigureWipe::createHexagonWipe() ); + case STARWIPE: { + sal_Int32 points; + switch (nSubType) { + case FIVEPOINT: + points = 5; + break; + case SIXPOINT: + points = 6; + break; + default: + points = 4; + break; + } + return ParametricPolyPolygonSharedPtr( + FigureWipe::createStarWipe(points) ); + } + case MISCDIAGONALWIPE: { + switch (nSubType) { + case DOUBLEBARNDOOR: + return ParametricPolyPolygonSharedPtr( + new BarnDoorWipe( true /* doubled */ ) ); + case DOUBLEDIAMOND: + return ParametricPolyPolygonSharedPtr( + new DoubleDiamondWipe ); + } + break; + } + case ZIGZAGWIPE: + return ParametricPolyPolygonSharedPtr( new ZigZagWipe(5) ); + case BARNZIGZAGWIPE: + return ParametricPolyPolygonSharedPtr( new BarnZigZagWipe(5) ); + + case BOWTIEWIPE: + case BARNVEEWIPE: + case EYEWIPE: + case ROUNDRECTWIPE: + case MISCSHAPEWIPE: + case SALOONDOORWIPE: + case WINDSHIELDWIPE: + // for now, map to barwipe transition + return ParametricPolyPolygonSharedPtr( + new BarWipePolyPolygon ); + + default: + case PUSHWIPE: + case SLIDEWIPE: + case FADE: + ENSURE_OR_THROW( false, + "createShapeClipPolyPolygonAnimation(): Transition type mismatch" ); + } + + return ParametricPolyPolygonSharedPtr(); + } + } +} diff --git a/slideshow/source/engine/transitions/parametricpolypolygonfactory.hxx b/slideshow/source/engine/transitions/parametricpolypolygonfactory.hxx new file mode 100644 index 000000000000..b4279be5bc9f --- /dev/null +++ b/slideshow/source/engine/transitions/parametricpolypolygonfactory.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SLIDESHOW_PARAMETRICPOLYPOLYGONFACTORY_HXX +#define INCLUDED_SLIDESHOW_PARAMETRICPOLYPOLYGONFACTORY_HXX + +#include "parametricpolypolygon.hxx" +#include <boost/noncopyable.hpp> + +namespace slideshow +{ + namespace internal + { + /* Definition of Transitionfactory class */ + + class ParametricPolyPolygonFactory : private boost::noncopyable + { + public: + static ParametricPolyPolygonSharedPtr createClipPolyPolygon( sal_Int16 nTransitionType, + sal_Int16 nTransitionSubType ); + + private: + // static factory + ParametricPolyPolygonFactory(); + ~ParametricPolyPolygonFactory(); + }; + } +} + +#endif /* INCLUDED_SLIDESHOW_PARAMETRICPOLYPOLYGONFACTORY_HXX */ diff --git a/slideshow/source/engine/transitions/pinwheelwipe.cxx b/slideshow/source/engine/transitions/pinwheelwipe.cxx new file mode 100644 index 000000000000..7cd5b91006c3 --- /dev/null +++ b/slideshow/source/engine/transitions/pinwheelwipe.cxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include "clockwipe.hxx" +#include "pinwheelwipe.hxx" + + +namespace slideshow { +namespace internal { + +::basegfx::B2DPolyPolygon PinWheelWipe::operator () ( double t ) +{ + ::basegfx::B2DPolygon poly( ClockWipe::calcCenteredClock( + t / m_blades, + 2.0 /* max edge when rotating */ ) ); + ::basegfx::B2DPolyPolygon res; + for ( sal_Int32 i = m_blades; i--; ) + { + ::basegfx::B2DPolygon p(poly); + p.transform(basegfx::tools::createRotateB2DHomMatrix((i * 2.0 * M_PI) / m_blades)); + res.append( p ); + } + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); + return res; +} + +} +} diff --git a/slideshow/source/engine/transitions/pinwheelwipe.hxx b/slideshow/source/engine/transitions/pinwheelwipe.hxx new file mode 100644 index 000000000000..d4560b24b8aa --- /dev/null +++ b/slideshow/source/engine/transitions/pinwheelwipe.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_PINWHEELWIPE_HXX +#define INCLUDED_SLIDESHOW_PINWHEELWIPE_HXX + +#include <basegfx/polygon/b2dpolygon.hxx> +#include "parametricpolypolygon.hxx" + + +namespace slideshow { +namespace internal { + +/// Generates a n-blade pinWheel wipe: +class PinWheelWipe : public ParametricPolyPolygon +{ +public: + PinWheelWipe( sal_Int32 blades ) : m_blades(blades) {} + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +private: + sal_Int32 m_blades; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_PINWHEELWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/randomwipe.cxx b/slideshow/source/engine/transitions/randomwipe.cxx new file mode 100644 index 000000000000..22c51e38852e --- /dev/null +++ b/slideshow/source/engine/transitions/randomwipe.cxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include "randomwipe.hxx" +#include "tools.hxx" + + +namespace slideshow { +namespace internal { + +RandomWipe::RandomWipe( sal_Int32 nElements, bool randomBars ) + : m_positions( new ::basegfx::B2DPoint[ nElements ] ), + m_nElements( nElements ), + m_rect( createUnitRect() ) +{ + ::basegfx::B2DHomMatrix aTransform; + if (randomBars) + { + double edge = (1.0 / nElements); + for ( sal_Int32 pos = nElements; pos--; ) + m_positions[ pos ].setY( ::basegfx::pruneScaleValue( pos * edge ) ); + aTransform.scale( 1.0, ::basegfx::pruneScaleValue(edge) ); + } + else // dissolve effect + { + sal_Int32 sqrtElements = static_cast<sal_Int32>( + sqrt( static_cast<double>(nElements) ) ); + double edge = (1.0 / sqrtElements); + for ( sal_Int32 pos = nElements; pos--; ) { + m_positions[ pos ] = ::basegfx::B2DPoint( + ::basegfx::pruneScaleValue( (pos % sqrtElements) * edge ), + ::basegfx::pruneScaleValue( (pos / sqrtElements) * edge ) ); + } + const double pedge = ::basegfx::pruneScaleValue(edge); + aTransform.scale( pedge, pedge ); + } + m_rect.transform( aTransform ); + + // mix up: + for ( sal_Int32 i = (nElements / 2); i--; ) + { + const sal_Int32 pos1 = getRandomOrdinal(nElements); + const sal_Int32 pos2 = getRandomOrdinal(nElements); + const ::basegfx::B2DPoint point( m_positions[ pos1 ] ); + m_positions[ pos1 ] = m_positions[ pos2 ]; + m_positions[ pos2 ] = point; + } +} + +::basegfx::B2DPolyPolygon RandomWipe::operator () ( double t ) +{ + ::basegfx::B2DPolyPolygon res; + for ( sal_Int32 pos = static_cast<sal_Int32>(t * m_nElements); pos--; ) + { + ::basegfx::B2DPoint const & point = m_positions[ pos ]; + ::basegfx::B2DPolygon poly( m_rect ); + poly.transform(basegfx::tools::createTranslateB2DHomMatrix(point.getX(), point.getY())); + res.append( poly ); + } + return res; +} + +} +} diff --git a/slideshow/source/engine/transitions/randomwipe.hxx b/slideshow/source/engine/transitions/randomwipe.hxx new file mode 100644 index 000000000000..04a00e5a4e14 --- /dev/null +++ b/slideshow/source/engine/transitions/randomwipe.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_RANDOMWIPE_HXX +#define INCLUDED_SLIDESHOW_RANDOMWIPE_HXX + +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <boost/scoped_array.hpp> + +#include "parametricpolypolygon.hxx" +#include "transitiontools.hxx" + + +namespace slideshow { +namespace internal { + +class RandomWipe : public ParametricPolyPolygon +{ +public: + RandomWipe( sal_Int32 nElements, + bool randomBars /* true: generates a horizontal random bar wipe, + false: generates a dissolve wipe */ ); + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +private: + ::boost::scoped_array< ::basegfx::B2DPoint > m_positions; + sal_Int32 m_nElements; + ::basegfx::B2DPolygon m_rect; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_RANDOMWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/shapetransitionfactory.cxx b/slideshow/source/engine/transitions/shapetransitionfactory.cxx new file mode 100644 index 000000000000..667bd6d17c22 --- /dev/null +++ b/slideshow/source/engine/transitions/shapetransitionfactory.cxx @@ -0,0 +1,408 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <tools/diagnose_ex.h> + +#include <comphelper/anytostring.hxx> +#include <cppuhelper/exc_hlp.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> + +#include <com/sun/star/animations/TransitionType.hpp> +#include <com/sun/star/animations/TransitionSubType.hpp> + +#include "transitionfactory.hxx" +#include "transitiontools.hxx" +#include "parametricpolypolygonfactory.hxx" +#include "animationfactory.hxx" +#include "clippingfunctor.hxx" + +#include <boost/bind.hpp> + + +using namespace ::com::sun::star; + +namespace slideshow { +namespace internal { + +/*************************************************** + *** *** + *** Shape Transition Effects *** + *** *** + ***************************************************/ + +namespace { + +class ClippingAnimation : public NumberAnimation +{ +public: + ClippingAnimation( + const ParametricPolyPolygonSharedPtr& rPolygon, + const ShapeManagerSharedPtr& rShapeManager, + const TransitionInfo& rTransitionInfo, + bool bDirectionForward, + bool bModeIn ); + + ~ClippingAnimation(); + + // Animation interface + // ------------------- + virtual void prefetch( const AnimatableShapeSharedPtr& rShape, + const ShapeAttributeLayerSharedPtr& rAttrLayer ); + virtual void start( const AnimatableShapeSharedPtr& rShape, + const ShapeAttributeLayerSharedPtr& rAttrLayer ); + virtual void end(); + + // NumberAnimation interface + // ----------------------- + virtual bool operator()( double nValue ); + virtual double getUnderlyingValue() const; + +private: + void end_(); + + AnimatableShapeSharedPtr mpShape; + ShapeAttributeLayerSharedPtr mpAttrLayer; + ShapeManagerSharedPtr mpShapeManager; + ClippingFunctor maClippingFunctor; + bool mbSpriteActive; +}; + +ClippingAnimation::ClippingAnimation( + const ParametricPolyPolygonSharedPtr& rPolygon, + const ShapeManagerSharedPtr& rShapeManager, + const TransitionInfo& rTransitionInfo, + bool bDirectionForward, + bool bModeIn ) : + mpShape(), + mpAttrLayer(), + mpShapeManager( rShapeManager ), + maClippingFunctor( rPolygon, + rTransitionInfo, + bDirectionForward, + bModeIn ), + mbSpriteActive(false) +{ + ENSURE_OR_THROW( + rShapeManager, + "ClippingAnimation::ClippingAnimation(): Invalid ShapeManager" ); +} + +ClippingAnimation::~ClippingAnimation() +{ + try + { + end_(); + } + catch (uno::Exception &) + { + OSL_ENSURE( false, rtl::OUStringToOString( + comphelper::anyToString( + cppu::getCaughtException() ), + RTL_TEXTENCODING_UTF8 ).getStr() ); + } +} + +void ClippingAnimation::prefetch( const AnimatableShapeSharedPtr&, + const ShapeAttributeLayerSharedPtr& ) +{ +} + +void ClippingAnimation::start( const AnimatableShapeSharedPtr& rShape, + const ShapeAttributeLayerSharedPtr& rAttrLayer ) +{ + OSL_ENSURE( !mpShape, + "ClippingAnimation::start(): Shape already set" ); + OSL_ENSURE( !mpAttrLayer, + "ClippingAnimation::start(): Attribute layer already set" ); + + mpShape = rShape; + mpAttrLayer = rAttrLayer; + + ENSURE_OR_THROW( rShape, + "ClippingAnimation::start(): Invalid shape" ); + ENSURE_OR_THROW( rAttrLayer, + "ClippingAnimation::start(): Invalid attribute layer" ); + + mpShape = rShape; + mpAttrLayer = rAttrLayer; + + if( !mbSpriteActive ) + { + mpShapeManager->enterAnimationMode( mpShape ); + mbSpriteActive = true; + } +} + +void ClippingAnimation::end() +{ + end_(); +} + +void ClippingAnimation::end_() +{ + if( mbSpriteActive ) + { + mbSpriteActive = false; + mpShapeManager->leaveAnimationMode( mpShape ); + + if( mpShape->isContentChanged() ) + mpShapeManager->notifyShapeUpdate( mpShape ); + } +} + +bool ClippingAnimation::operator()( double nValue ) +{ + ENSURE_OR_RETURN_FALSE( + mpAttrLayer && mpShape, + "ClippingAnimation::operator(): Invalid ShapeAttributeLayer" ); + + // set new clip + mpAttrLayer->setClip( maClippingFunctor( nValue, + mpShape->getDomBounds().getRange() ) ); + + if( mpShape->isContentChanged() ) + mpShapeManager->notifyShapeUpdate( mpShape ); + + return true; +} + +double ClippingAnimation::getUnderlyingValue() const +{ + ENSURE_OR_THROW( + mpAttrLayer, + "ClippingAnimation::getUnderlyingValue(): Invalid ShapeAttributeLayer" ); + + return 0.0; // though this should be used in concert with + // ActivitiesFactory::createSimpleActivity, better + // explicitely name our start value. + // Permissible range for operator() above is [0,1] +} + +} // anon namespace + + +AnimationActivitySharedPtr TransitionFactory::createShapeTransition( + const ActivitiesFactory::CommonParameters& rParms, + const AnimatableShapeSharedPtr& rShape, + const ShapeManagerSharedPtr& rShapeManager, + const ::basegfx::B2DVector& rSlideSize, + uno::Reference< animations::XTransitionFilter > const& xTransition ) +{ + return createShapeTransition( rParms, + rShape, + rShapeManager, + rSlideSize, + xTransition, + xTransition->getTransition(), + xTransition->getSubtype() ); +} + +AnimationActivitySharedPtr TransitionFactory::createShapeTransition( + const ActivitiesFactory::CommonParameters& rParms, + const AnimatableShapeSharedPtr& rShape, + const ShapeManagerSharedPtr& rShapeManager, + const ::basegfx::B2DVector& rSlideSize, + ::com::sun::star::uno::Reference< + ::com::sun::star::animations::XTransitionFilter > const& xTransition, + sal_Int16 nType, + sal_Int16 nSubType ) +{ + ENSURE_OR_THROW( + xTransition.is(), + "TransitionFactory::createShapeTransition(): Invalid XTransition" ); + + const TransitionInfo* pTransitionInfo( + getTransitionInfo( nType, nSubType ) ); + + AnimationActivitySharedPtr pGeneratedActivity; + if( pTransitionInfo != NULL ) + { + switch( pTransitionInfo->meTransitionClass ) + { + default: + case TransitionInfo::TRANSITION_INVALID: + OSL_ENSURE( false, + "TransitionFactory::createShapeTransition(): Invalid transition type. " + "Don't ask me for a 0 TransitionType, have no XTransitionFilter node instead!" ); + return AnimationActivitySharedPtr(); + + + case TransitionInfo::TRANSITION_CLIP_POLYPOLYGON: + { + // generate parametric poly-polygon + ParametricPolyPolygonSharedPtr pPoly( + ParametricPolyPolygonFactory::createClipPolyPolygon( + nType, nSubType ) ); + + // create a clip activity from that + pGeneratedActivity = ActivitiesFactory::createSimpleActivity( + rParms, + NumberAnimationSharedPtr( + new ClippingAnimation( + pPoly, + rShapeManager, + *pTransitionInfo, + xTransition->getDirection(), + xTransition->getMode() ) ), + true ); + } + break; + + case TransitionInfo::TRANSITION_SPECIAL: + { + switch( nType ) + { + case animations::TransitionType::RANDOM: + { + // select randomly one of the effects from the + // TransitionFactoryTable + + const TransitionInfo* pRandomTransitionInfo( getRandomTransitionInfo() ); + + ENSURE_OR_THROW( pRandomTransitionInfo != NULL, + "TransitionFactory::createShapeTransition(): Got invalid random transition info" ); + + ENSURE_OR_THROW( pRandomTransitionInfo->mnTransitionType != animations::TransitionType::RANDOM, + "TransitionFactory::createShapeTransition(): Got random again for random input!" ); + + // and recurse + pGeneratedActivity = createShapeTransition( rParms, + rShape, + rShapeManager, + rSlideSize, + xTransition, + pRandomTransitionInfo->mnTransitionType, + pRandomTransitionInfo->mnTransitionSubType ); + } + break; + + // TODO(F3): Implement slidewipe for shape + case animations::TransitionType::SLIDEWIPE: + { + sal_Int16 nBarWipeSubType(0); + bool bDirectionForward(true); + + // map slidewipe to BARWIPE, for now + switch( nSubType ) + { + case animations::TransitionSubType::FROMLEFT: + nBarWipeSubType = animations::TransitionSubType::LEFTTORIGHT; + bDirectionForward = true; + break; + + case animations::TransitionSubType::FROMRIGHT: + nBarWipeSubType = animations::TransitionSubType::LEFTTORIGHT; + bDirectionForward = false; + break; + + case animations::TransitionSubType::FROMTOP: + nBarWipeSubType = animations::TransitionSubType::TOPTOBOTTOM; + bDirectionForward = true; + break; + + case animations::TransitionSubType::FROMBOTTOM: + nBarWipeSubType = animations::TransitionSubType::TOPTOBOTTOM; + bDirectionForward = false; + break; + + default: + ENSURE_OR_THROW( false, + "TransitionFactory::createShapeTransition(): Unexpected subtype for SLIDEWIPE" ); + break; + } + + // generate parametric poly-polygon + ParametricPolyPolygonSharedPtr pPoly( + ParametricPolyPolygonFactory::createClipPolyPolygon( + animations::TransitionType::BARWIPE, + nBarWipeSubType ) ); + + // create a clip activity from that + pGeneratedActivity = ActivitiesFactory::createSimpleActivity( + rParms, + NumberAnimationSharedPtr( + new ClippingAnimation( + pPoly, + rShapeManager, + *getTransitionInfo( animations::TransitionType::BARWIPE, + nBarWipeSubType ), + bDirectionForward, + xTransition->getMode() ) ), + true ); + } + break; + + default: + { + // TODO(F1): Check whether there's anything left, anyway, + // for _shape_ transitions. AFAIK, there are no special + // effects for shapes... + + // for now, map all to fade effect + pGeneratedActivity = ActivitiesFactory::createSimpleActivity( + rParms, + AnimationFactory::createNumberPropertyAnimation( + ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("Opacity") ), + rShape, + rShapeManager, + rSlideSize ), + xTransition->getMode() ); + } + break; + } + } + break; + } + } + + if( !pGeneratedActivity ) + { + // No animation generated, maybe no table entry for given + // transition? + OSL_TRACE( + "TransitionFactory::createShapeTransition(): Unknown type/subtype (%d/%d) " + "combination encountered", + xTransition->getTransition(), + xTransition->getSubtype() ); + OSL_ENSURE( + false, + "TransitionFactory::createShapeTransition(): Unknown type/subtype " + "combination encountered" ); + } + + return pGeneratedActivity; +} + +} +} diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx new file mode 100644 index 000000000000..466052b67900 --- /dev/null +++ b/slideshow/source/engine/transitions/slidechangebase.cxx @@ -0,0 +1,535 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <tools/diagnose_ex.h> +#include <canvas/canvastools.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <cppcanvas/basegfxfactory.hxx> + +#include "slidechangebase.hxx" +#include "tools.hxx" + +#include <boost/bind.hpp> +#include <algorithm> + +using namespace com::sun::star; + +namespace slideshow { +namespace internal { + +SlideChangeBase::SlideChangeBase( boost::optional<SlideSharedPtr> const & leavingSlide, + const SlideSharedPtr& pEnteringSlide, + const SoundPlayerSharedPtr& pSoundPlayer, + const UnoViewContainer& rViewContainer, + ScreenUpdater& rScreenUpdater, + EventMultiplexer& rEventMultiplexer, + bool bCreateLeavingSprites, + bool bCreateEnteringSprites ) : + mpSoundPlayer( pSoundPlayer ), + mrEventMultiplexer(rEventMultiplexer), + mrScreenUpdater(rScreenUpdater), + maLeavingSlide( leavingSlide ), + mpEnteringSlide( pEnteringSlide ), + maViewData(), + mrViewContainer(rViewContainer), + mbCreateLeavingSprites(bCreateLeavingSprites), + mbCreateEnteringSprites(bCreateEnteringSprites), + mbSpritesVisible(false), + mbFinished(false), + mbPrefetched(false) +{ + ENSURE_OR_THROW( + pEnteringSlide, + "SlideChangeBase::SlideChangeBase(): Invalid entering slide!" ); +} + +SlideBitmapSharedPtr SlideChangeBase::getLeavingBitmap( const ViewEntry& rViewEntry ) const +{ + if( !rViewEntry.mpLeavingBitmap ) + rViewEntry.mpLeavingBitmap = createBitmap(rViewEntry.mpView, + maLeavingSlide); + + return rViewEntry.mpLeavingBitmap; +} + +SlideBitmapSharedPtr SlideChangeBase::getEnteringBitmap( const ViewEntry& rViewEntry ) const +{ + if( !rViewEntry.mpEnteringBitmap ) + rViewEntry.mpEnteringBitmap = createBitmap( rViewEntry.mpView, + boost::optional<SlideSharedPtr>(mpEnteringSlide) ); + + return rViewEntry.mpEnteringBitmap; +} + +SlideBitmapSharedPtr SlideChangeBase::createBitmap( const UnoViewSharedPtr& rView, + const boost::optional<SlideSharedPtr>& rSlide ) const +{ + SlideBitmapSharedPtr pRet; + if( !rSlide ) + return pRet; + + SlideSharedPtr const & pSlide = *rSlide; + if( !pSlide ) + { + // TODO(P3): No need to generate a bitmap here. This only made + // the code more uniform. Faster would be to simply clear the + // sprite to black. + + // create empty, black-filled bitmap + const basegfx::B2ISize slideSizePixel( + getSlideSizePixel( mpEnteringSlide->getSlideSize(), + rView )); + + cppcanvas::CanvasSharedPtr pCanvas( rView->getCanvas() ); + + // create a bitmap of appropriate size + cppcanvas::BitmapSharedPtr pBitmap( + cppcanvas::BaseGfxFactory::getInstance().createBitmap( + pCanvas, + slideSizePixel ) ); + + ENSURE_OR_THROW( + pBitmap, + "SlideChangeBase::createBitmap(): Cannot create page bitmap" ); + + cppcanvas::BitmapCanvasSharedPtr pBitmapCanvas( + pBitmap->getBitmapCanvas() ); + + ENSURE_OR_THROW( pBitmapCanvas, + "SlideChangeBase::createBitmap(): " + "Cannot create page bitmap canvas" ); + + // set transformation to identitiy (->device pixel) + pBitmapCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); + + // clear bitmap to black + fillRect( pBitmapCanvas, + ::basegfx::B2DRectangle( 0.0, 0.0, + slideSizePixel.getX(), + slideSizePixel.getY() ), + 0x000000FFU ); + + pRet.reset( new SlideBitmap( pBitmap )); + } + else + { + pRet = pSlide->getCurrentSlideBitmap( rView ); + } + + return pRet; +} + +::basegfx::B2ISize SlideChangeBase::getEnteringSlideSizePixel( const UnoViewSharedPtr& pView ) const +{ + return getSlideSizePixel( mpEnteringSlide->getSlideSize(), + pView ); +} + +::basegfx::B2ISize SlideChangeBase::getLeavingSlideSizePixel( const UnoViewSharedPtr& pView ) const +{ + return getSlideSizePixel( (*maLeavingSlide)->getSlideSize(), + pView ); +} + + +void SlideChangeBase::renderBitmap( + SlideBitmapSharedPtr const & pSlideBitmap, + cppcanvas::CanvasSharedPtr const & pCanvas ) +{ + if( pSlideBitmap && pCanvas ) + { + // need to render without any transformation (we + // assume device units): + const basegfx::B2DHomMatrix viewTransform( + pCanvas->getTransformation() ); + const basegfx::B2DPoint pageOrigin( + viewTransform * basegfx::B2DPoint() ); + const cppcanvas::CanvasSharedPtr pDevicePixelCanvas( + pCanvas->clone() ); + + // render at output position, don't modify bitmap object (no move!): + const basegfx::B2DHomMatrix transform(basegfx::tools::createTranslateB2DHomMatrix( + pageOrigin.getX(), pageOrigin.getY())); + + pDevicePixelCanvas->setTransformation( transform ); + pSlideBitmap->draw( pDevicePixelCanvas ); + } +} + +void SlideChangeBase::prefetch( const AnimatableShapeSharedPtr&, + const ShapeAttributeLayerSharedPtr& ) +{ + // we're a one-shot activity, and already finished + if( mbFinished || mbPrefetched ) + return; + + // register ourselves for view change events + mrEventMultiplexer.addViewHandler( shared_from_this() ); + + // init views and create slide bitmaps + std::for_each( mrViewContainer.begin(), + mrViewContainer.end(), + boost::bind( &SlideChangeBase::viewAdded, + this, + _1 )); + + mbPrefetched = true; +} + +void SlideChangeBase::start( const AnimatableShapeSharedPtr& rShape, + const ShapeAttributeLayerSharedPtr& rLayer ) +{ + // we're a one-shot activity, and already finished + if( mbFinished ) + return; + + prefetch(rShape,rLayer); // no-op, if already done + + // start accompanying sound effect, if any + if( mpSoundPlayer ) + { + mpSoundPlayer->startPlayback(); + // xxx todo: for now, presentation.cxx takes care about the slide + // #i50492# transition sound object, so just release it here + mpSoundPlayer.reset(); + } +} + +void SlideChangeBase::end() +{ + // we're a one-shot activity, and already finished + if( mbFinished ) + return; + + try + { + // draw fully entered bitmap: + ViewsVecT::const_iterator aCurr( beginViews() ); + const ViewsVecT::const_iterator aEnd( endViews() ); + while( aCurr != aEnd ) + { + // fully clear view content to background color + aCurr->mpView->clearAll(); + + const SlideBitmapSharedPtr pSlideBitmap( getEnteringBitmap( *aCurr )); + pSlideBitmap->clip( basegfx::B2DPolyPolygon() /* no clipping */ ); + renderBitmap( pSlideBitmap, + aCurr->mpView->getCanvas() ); + + ++aCurr; + } + } + catch( uno::Exception& ) + { + // make sure releasing below happens + } + + // swap changes to screen + mrScreenUpdater.notifyUpdate(); + + // make object dysfunctional + mbFinished = true; + ViewsVecT().swap(maViewData); + maLeavingSlide.reset(); + mpEnteringSlide.reset(); + + // sprites have been binned above + mbSpritesVisible = false; + + // remove also from event multiplexer, we're dead anyway + mrEventMultiplexer.removeViewHandler( shared_from_this() ); +} + +bool SlideChangeBase::operator()( double nValue ) +{ + if( mbFinished ) + return false; + + const std::size_t nEntries( maViewData.size() ); + bool bSpritesVisible( mbSpritesVisible ); + + for( ::std::size_t i=0; i<nEntries; ++i ) + { + // calc sprite offsets. The enter/leaving bitmaps are only + // as large as the actual slides. For scaled-down + // presentations, we have to move the left, top edge of + // those bitmaps to the actual position, governed by the + // given view transform. The aSpritePosPixel local + // variable is already in device coordinate space + // (i.e. pixel). + + ViewEntry& rViewEntry( maViewData[i] ); + const ::cppcanvas::CanvasSharedPtr& rCanvas( rViewEntry.mpView->getCanvas() ); + ::cppcanvas::CustomSpriteSharedPtr& rInSprite( rViewEntry.mpInSprite ); + ::cppcanvas::CustomSpriteSharedPtr& rOutSprite( rViewEntry.mpOutSprite ); + + // TODO(F2): Properly respect clip here. + + // Might have to be transformed, too. + const ::basegfx::B2DHomMatrix aViewTransform( + rViewEntry.mpView->getTransformation() ); + const ::basegfx::B2DPoint aSpritePosPixel( + aViewTransform * ::basegfx::B2DPoint() ); + + // move sprite to final output position, in + // device coordinates + if( rOutSprite ) + rOutSprite->movePixel( aSpritePosPixel ); + if( rInSprite ) + rInSprite->movePixel( aSpritePosPixel ); + + if( !mbSpritesVisible ) + { + if( rOutSprite ) + { + // only render once: clipping is done + // exclusively with the sprite + const ::cppcanvas::CanvasSharedPtr pOutContentCanvas( + rOutSprite->getContentCanvas() ); + if( pOutContentCanvas) + { + // TODO(Q2): Use basegfx bitmaps here + + // TODO(F1): SlideBitmap is not fully portable + // between different canvases! + + // render the content + OSL_ASSERT( getLeavingBitmap( rViewEntry ) ); + if( getLeavingBitmap( rViewEntry ) ) + getLeavingBitmap( rViewEntry )->draw( pOutContentCanvas ); + } + } + + if( rInSprite ) + { + // only render once: clipping is done + // exclusively with the sprite + const ::cppcanvas::CanvasSharedPtr pInContentCanvas( + rInSprite->getContentCanvas() ); + if( pInContentCanvas ) + { + // TODO(Q2): Use basegfx bitmaps here + + // TODO(F1): SlideBitmap is not fully portable + // between different canvases! + + // render the content + getEnteringBitmap( rViewEntry )->draw( pInContentCanvas ); + } + } + } + + if( rOutSprite ) + performOut( rOutSprite, rViewEntry, rCanvas, nValue ); + if( rInSprite ) + performIn( rInSprite, rViewEntry, rCanvas, nValue ); + + // finishing deeds for first run. + if( !mbSpritesVisible) + { + // enable sprites: + if( rOutSprite ) + rOutSprite->show(); + if( rInSprite ) + rInSprite->show(); + bSpritesVisible = true; + } + } // for_each( sprite ) + + mbSpritesVisible = bSpritesVisible; + mrScreenUpdater.notifyUpdate(); + + return true; +} + +void SlideChangeBase::performIn( + const cppcanvas::CustomSpriteSharedPtr& /*rSprite*/, + const ViewEntry& /*rViewEntry*/, + const cppcanvas::CanvasSharedPtr& /*rDestinationCanvas*/, + double /*t*/ ) +{ +} + +void SlideChangeBase::performOut( + const cppcanvas::CustomSpriteSharedPtr& /*rSprite*/, + const ViewEntry& /*rViewEntry*/, + const cppcanvas::CanvasSharedPtr& /*rDestinationCanvas*/, + double /*t*/ ) +{ +} + +double SlideChangeBase::getUnderlyingValue() const +{ + return 0.0; // though this should be used in concert with + // ActivitiesFactory::createSimpleActivity, better + // explicitely name our start value. + // Permissible range for operator() above is [0,1] +} + +void SlideChangeBase::viewAdded( const UnoViewSharedPtr& rView ) +{ + // we're a one-shot activity, and already finished + if( mbFinished ) + return; + + maViewData.push_back( ViewEntry(rView) ); + + ViewEntry& rEntry( maViewData.back() ); + getEnteringBitmap( rEntry ); + getLeavingBitmap( rEntry ); + addSprites( rEntry ); +} + +void SlideChangeBase::viewRemoved( const UnoViewSharedPtr& rView ) +{ + // we're a one-shot activity, and already finished + if( mbFinished ) + return; + + // erase corresponding entry from maViewData + maViewData.erase( + std::remove_if( + maViewData.begin(), + maViewData.end(), + boost::bind( + std::equal_to<UnoViewSharedPtr>(), + rView, + // select view: + boost::bind( &ViewEntry::getView, _1 ))), + maViewData.end() ); +} + +void SlideChangeBase::viewChanged( const UnoViewSharedPtr& rView ) +{ + // we're a one-shot activity, and already finished + if( mbFinished ) + return; + + // find entry corresponding to modified view + ViewsVecT::iterator aModifiedEntry( + std::find_if( + maViewData.begin(), + maViewData.end(), + boost::bind( + std::equal_to<UnoViewSharedPtr>(), + rView, + // select view: + boost::bind( &ViewEntry::getView, _1 ) ))); + + OSL_ASSERT( aModifiedEntry != maViewData.end() ); + if( aModifiedEntry == maViewData.end() ) + return; + + // clear stale info (both bitmaps and sprites prolly need a + // resize) + clearViewEntry( *aModifiedEntry ); + addSprites( *aModifiedEntry ); +} + +void SlideChangeBase::viewsChanged() +{ + // we're a one-shot activity, and already finished + if( mbFinished ) + return; + + ViewsVecT::iterator aIter( maViewData.begin() ); + ViewsVecT::iterator const aEnd ( maViewData.end() ); + while( aIter != aEnd ) + { + // clear stale info (both bitmaps and sprites prolly need a + // resize) + clearViewEntry( *aIter ); + addSprites( *aIter ); + + ++aIter; + } +} + +cppcanvas::CustomSpriteSharedPtr SlideChangeBase::createSprite( + UnoViewSharedPtr const & pView, + basegfx::B2DSize const & rSpriteSize, + double nPrio ) const +{ + // TODO(P2): change to bitmapsprite once that's working + const cppcanvas::CustomSpriteSharedPtr pSprite( + pView->createSprite( rSpriteSize, + nPrio )); + + // alpha default is 0.0, which seems to be + // a bad idea when viewing content... + pSprite->setAlpha( 1.0 ); + if (mbSpritesVisible) + pSprite->show(); + + return pSprite; +} + +void SlideChangeBase::addSprites( ViewEntry& rEntry ) +{ + if( mbCreateLeavingSprites && maLeavingSlide ) + { + // create leaving sprite: + const basegfx::B2ISize leavingSlideSizePixel( + getLeavingBitmap( rEntry )->getSize() ); + + rEntry.mpOutSprite = createSprite( rEntry.mpView, + leavingSlideSizePixel, + 100 ); + } + + if( mbCreateEnteringSprites ) + { + // create entering sprite: + const basegfx::B2ISize enteringSlideSizePixel( + getSlideSizePixel( mpEnteringSlide->getSlideSize(), + rEntry.mpView )); + + rEntry.mpInSprite = createSprite( rEntry.mpView, + enteringSlideSizePixel, + 101 ); + } +} + +void SlideChangeBase::clearViewEntry( ViewEntry& rEntry ) +{ + // clear stale info (both bitmaps and sprites prolly need a + // resize) + rEntry.mpEnteringBitmap.reset(); + rEntry.mpLeavingBitmap.reset(); + rEntry.mpInSprite.reset(); + rEntry.mpOutSprite.reset(); +} + +} // namespace internal +} // namespace presentation diff --git a/slideshow/source/engine/transitions/slidechangebase.hxx b/slideshow/source/engine/transitions/slidechangebase.hxx new file mode 100644 index 000000000000..e0b9c4635996 --- /dev/null +++ b/slideshow/source/engine/transitions/slidechangebase.hxx @@ -0,0 +1,208 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SLIDESHOW_TRANSITIONS_SLIDECHANGEBASE_HXX +#define INCLUDED_SLIDESHOW_TRANSITIONS_SLIDECHANGEBASE_HXX + +#include <osl/mutex.hxx> + +#include "unoview.hxx" +#include "vieweventhandler.hxx" +#include "numberanimation.hxx" +#include "slide.hxx" +#include "screenupdater.hxx" +#include "soundplayer.hxx" + +#include <boost/enable_shared_from_this.hpp> +#include <boost/noncopyable.hpp> +#include <boost/optional.hpp> + +namespace cppcanvas +{ + class Canvas; + class CustomSprite; +} + +namespace slideshow { +namespace internal { + +/** Base class for all slide change effects. + + This class provides the basic sprite and view handling + functionality. Derived classes should normally only need to + implement the perform() method. +*/ +class SlideChangeBase : public ViewEventHandler, + public NumberAnimation, + public boost::enable_shared_from_this<SlideChangeBase>, + private ::boost::noncopyable +{ +public: + // NumberAnimation + virtual bool operator()( double x ); + virtual double getUnderlyingValue() const; + + // Animation + virtual void prefetch( const AnimatableShapeSharedPtr&, + const ShapeAttributeLayerSharedPtr& ); + virtual void start( const AnimatableShapeSharedPtr&, + const ShapeAttributeLayerSharedPtr& ); + virtual void end(); + + // ViewEventHandler + virtual void viewAdded( const UnoViewSharedPtr& rView ); + virtual void viewRemoved( const UnoViewSharedPtr& rView ); + virtual void viewChanged( const UnoViewSharedPtr& rView ); + virtual void viewsChanged(); + +protected: + /** Create a new SlideChanger, for the given leaving and + entering slides. + */ + SlideChangeBase( + ::boost::optional<SlideSharedPtr> const & leavingSlide, + const SlideSharedPtr& pEnteringSlide, + const SoundPlayerSharedPtr& pSoundPlayer, + const UnoViewContainer& rViewContainer, + ScreenUpdater& rScreenUpdater, + EventMultiplexer& rEventMultiplexer, + bool bCreateLeavingSprites = true, + bool bCreateEnteringSprites = true ); + + /// Info on a per-view basis + struct ViewEntry + { + ViewEntry() {} + + explicit ViewEntry( const UnoViewSharedPtr& rView ) : + mpView( rView ) + { + } + + /// The view this entry is for + UnoViewSharedPtr mpView; + /// outgoing slide sprite + boost::shared_ptr<cppcanvas::CustomSprite> mpOutSprite; + /// incoming slide sprite + boost::shared_ptr<cppcanvas::CustomSprite> mpInSprite; + /// outgoing slide bitmap + mutable SlideBitmapSharedPtr mpLeavingBitmap; + /// incoming slide bitmap + mutable SlideBitmapSharedPtr mpEnteringBitmap; + + // for algo access + const UnoViewSharedPtr& getView() const { return mpView; } + }; + + typedef ::std::vector<ViewEntry> ViewsVecT; + + ViewsVecT::const_iterator beginViews() { return maViewData.begin(); } + ViewsVecT::const_iterator endViews() { return maViewData.end(); } + + SlideBitmapSharedPtr getLeavingBitmap( const ViewEntry& rViewEntry ) const; + SlideBitmapSharedPtr getEnteringBitmap( const ViewEntry& rViewEntry ) const; + + SlideBitmapSharedPtr createBitmap( const UnoViewSharedPtr& pView, + const boost::optional<SlideSharedPtr>& rSlide_ ) const; + + ::basegfx::B2ISize getEnteringSlideSizePixel( const UnoViewSharedPtr& pView ) const; + ::basegfx::B2ISize getLeavingSlideSizePixel( const UnoViewSharedPtr& pView ) const; + + void renderBitmap( SlideBitmapSharedPtr const& pSlideBitmap, + boost::shared_ptr<cppcanvas::Canvas> const& pCanvas ); + + /** Called on derived classes to implement actual slide change. + + This method is called with the sprite of the slide coming 'in' + + @param rSprite + Current sprite to operate on. This is the sprite of the + 'entering' slide + + @param t + Current parameter value + */ + virtual void performIn( + const boost::shared_ptr<cppcanvas::CustomSprite>& rSprite, + const ViewEntry& rViewEntry, + const boost::shared_ptr<cppcanvas::Canvas>& rDestinationCanvas, + double t ); + + /** Called on derived classes to implement actual slide change. + + This method is called with the sprite of the slide moving 'out' + + @param rSprite + Current sprite to operate on. This is the sprite of the + 'leaving' slide + + @param t + Current parameter value + */ + virtual void performOut( + const boost::shared_ptr<cppcanvas::CustomSprite>& rSprite, + const ViewEntry& rViewEntry, + const boost::shared_ptr<cppcanvas::Canvas>& rDestinationCanvas, + double t ); + + ScreenUpdater& getScreenUpdater() const { return mrScreenUpdater; } + +private: + + boost::shared_ptr<cppcanvas::CustomSprite> createSprite( + UnoViewSharedPtr const & pView, + ::basegfx::B2DSize const & rSpriteSize, + double nPrio ) const; + + void addSprites( ViewEntry& rEntry ); + void clearViewEntry( ViewEntry& rEntry ); + + ViewsVecT::iterator lookupView( UnoViewSharedPtr const & pView ); + ViewsVecT::const_iterator lookupView( UnoViewSharedPtr const & pView ) const; + + SoundPlayerSharedPtr mpSoundPlayer; + + EventMultiplexer& mrEventMultiplexer; + ScreenUpdater& mrScreenUpdater; + + ::boost::optional<SlideSharedPtr> maLeavingSlide; + SlideSharedPtr mpEnteringSlide; + + ViewsVecT maViewData; + const UnoViewContainer& mrViewContainer; + + const bool mbCreateLeavingSprites; + const bool mbCreateEnteringSprites; + bool mbSpritesVisible; + bool mbFinished; + bool mbPrefetched; +}; + +} // namespace internal +} // namespace presentation + +#endif /* INCLUDED_SLIDESHOW_TRANSITIONS_SLIDECHANGEBASE_HXX */ diff --git a/slideshow/source/engine/transitions/slidetransitionfactory.cxx b/slideshow/source/engine/transitions/slidetransitionfactory.cxx new file mode 100644 index 000000000000..ab1ad816d3f6 --- /dev/null +++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx @@ -0,0 +1,1074 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <tools/diagnose_ex.h> + +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/tools/canvastools.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> + +#include <cppcanvas/basegfxfactory.hxx> + +#include <comphelper/optional.hxx> +#include <comphelper/make_shared_from_uno.hxx> + +#include <com/sun/star/rendering/XIntegerBitmap.hpp> +#include <com/sun/star/rendering/IntegerBitmapLayout.hpp> +#include <com/sun/star/animations/TransitionType.hpp> +#include <com/sun/star/animations/TransitionSubType.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include "slidechangebase.hxx" +#include "transitionfactory.hxx" +#include "transitiontools.hxx" +#include "parametricpolypolygonfactory.hxx" +#include "animationfactory.hxx" +#include "clippingfunctor.hxx" +#include "combtransition.hxx" +#include "tools.hxx" + +#include <boost/bind.hpp> + + +/*************************************************** + *** *** + *** Slide Transition Effects *** + *** *** + ***************************************************/ + +using namespace com::sun::star; + +namespace slideshow { +namespace internal { + +namespace { + +// helper methods +// ============================================= + +void fillPage( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + const ::basegfx::B2DSize& rPageSizePixel, + const RGBColor& rFillColor ) +{ + // need to render without any transformation (we + // assume rPageSizePixel to represent device units) + const ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( + rDestinationCanvas->clone() ); + pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); + + // TODO(F2): Properly respect clip here. + // Might have to be transformed, too. + const ::basegfx::B2DHomMatrix aViewTransform( + rDestinationCanvas->getTransformation() ); + const ::basegfx::B2DPoint aOutputPosPixel( + aViewTransform * ::basegfx::B2DPoint() ); + + fillRect( pDevicePixelCanvas, + ::basegfx::B2DRectangle( + aOutputPosPixel.getX(), + aOutputPosPixel.getY(), + aOutputPosPixel.getX() + rPageSizePixel.getX(), + aOutputPosPixel.getY() + rPageSizePixel.getY() ), + rFillColor.getIntegerColor() ); +} + +class PluginSlideChange: public SlideChangeBase +{ + struct TransitionViewPair { + uno::Reference<presentation::XTransition> mxTransition; + UnoViewSharedPtr mpView; + + TransitionViewPair( uno::Reference<presentation::XTransition> xTransition, const UnoViewSharedPtr pView ) + { + mxTransition = xTransition; + mpView = pView; + } + + ~TransitionViewPair() + { + mxTransition.clear(); + mpView.reset();; + } + + void update( double t ) + { + mxTransition->update( t ); + } + }; + +public: + /** Create a new SlideChanger, for the given leaving and + entering slide bitmaps, which uses super secret OpenGL + stuff. + */ + PluginSlideChange( sal_Int16 nTransitionType, + sal_Int16 nTransitionSubType, + boost::optional<SlideSharedPtr> const& leavingSlide_, + const SlideSharedPtr& pEnteringSlide, + const UnoViewContainer& rViewContainer, + ScreenUpdater& rScreenUpdater, + const uno::Reference< + presentation::XTransitionFactory>& xFactory, + const SoundPlayerSharedPtr& pSoundPlayer, + EventMultiplexer& rEventMultiplexer) : + SlideChangeBase( leavingSlide_, + pEnteringSlide, + pSoundPlayer, + rViewContainer, + rScreenUpdater, + rEventMultiplexer ), + maTransitions(), + mbSuccess( false ), + mnTransitionType( nTransitionType ), + mnTransitionSubType( nTransitionSubType ), + mxFactory( xFactory ) + { + // create one transition per view + UnoViewVector::const_iterator aCurrView (rViewContainer.begin()); + const UnoViewVector::const_iterator aEnd(rViewContainer.end()); + while( aCurrView != aEnd ) + { + if(! addTransition( *aCurrView ) ) + return; + + ENSURE_OR_THROW(maTransitions.back() && maTransitions.back()->mxTransition.is(), + "Failed to create plugin transition"); + ++aCurrView; + } + mbSuccess = true; + } + + ~PluginSlideChange() + { + mxFactory.clear(); + + ::std::vector< TransitionViewPair* >::const_iterator aCurrView (maTransitions.begin()); + ::std::vector< TransitionViewPair* >::const_iterator aEnd(maTransitions.end()); + while( aCurrView != aEnd ) + { + delete (*aCurrView); + ++aCurrView; + } + maTransitions.clear(); + } + + bool addTransition( const UnoViewSharedPtr& rView ) + { + uno::Reference<presentation::XTransition> rTransition = mxFactory->createTransition( + mnTransitionType, + mnTransitionSubType, + rView->getUnoView(), + getLeavingBitmap(ViewEntry(rView))->getXBitmap(), + getEnteringBitmap(ViewEntry(rView))->getXBitmap() ); + + if( rTransition.is() ) + maTransitions.push_back( new TransitionViewPair( rTransition, rView ) ); + else + return false; + + return true; + } + + virtual bool operator()( double t ) + { + std::for_each(maTransitions.begin(), + maTransitions.end(), + boost::bind( &TransitionViewPair::update, + _1, t) ); + return true; + } + + bool Success() + { + return mbSuccess; + } + + // ViewEventHandler + virtual void viewAdded( const UnoViewSharedPtr& rView ) + { + OSL_TRACE("PluginSlideChange viewAdded"); + SlideChangeBase::viewAdded( rView ); + + ::std::vector< TransitionViewPair* >::const_iterator aCurrView (maTransitions.begin()); + ::std::vector< TransitionViewPair* >::const_iterator aEnd(maTransitions.end()); + bool bKnown = false; + while( aCurrView != aEnd ) + { + if( (*aCurrView)->mpView == rView ) { + bKnown = true; + break; + } + ++aCurrView; + } + + if( !bKnown ) { + OSL_TRACE("need to be added"); + + addTransition( rView ); + } + } + + virtual void viewRemoved( const UnoViewSharedPtr& rView ) + { + OSL_TRACE("PluginSlideChange viewRemoved"); + SlideChangeBase::viewRemoved( rView ); + + ::std::vector< TransitionViewPair* >::iterator aCurrView (maTransitions.begin()); + ::std::vector< TransitionViewPair* >::const_iterator aEnd(maTransitions.end()); + while( aCurrView != aEnd ) + { + if( (*aCurrView)->mpView == rView ) { + OSL_TRACE( "view removed" ); + delete (*aCurrView); + maTransitions.erase( aCurrView ); + break; + } + ++aCurrView; + } + } + + virtual void viewChanged( const UnoViewSharedPtr& rView ) + { + OSL_TRACE("PluginSlideChange viewChanged"); + SlideChangeBase::viewChanged( rView ); + + ::std::vector< TransitionViewPair* >::const_iterator aCurrView (maTransitions.begin()); + ::std::vector< TransitionViewPair* >::const_iterator aEnd(maTransitions.end()); + while( aCurrView != aEnd ) + { + if( (*aCurrView)->mpView == rView ) { + OSL_TRACE( "view changed" ); + (*aCurrView)->mxTransition->viewChanged( rView->getUnoView(), + getLeavingBitmap(ViewEntry(rView))->getXBitmap(), + getEnteringBitmap(ViewEntry(rView))->getXBitmap() ); + } else + OSL_TRACE( "view did not changed" ); + + ++aCurrView; + } + } + + virtual void viewsChanged() + { + OSL_TRACE("PluginSlideChange viewsChanged"); + SlideChangeBase::viewsChanged(); + + ::std::vector< TransitionViewPair* >::const_iterator aCurrView (maTransitions.begin()); + ::std::vector< TransitionViewPair* >::const_iterator aEnd(maTransitions.end()); + while( aCurrView != aEnd ) + { + OSL_TRACE( "view changed" ); + (*aCurrView)->mxTransition->viewChanged( (*aCurrView)->mpView->getUnoView(), + getLeavingBitmap(ViewEntry((*aCurrView)->mpView))->getXBitmap(), + getEnteringBitmap(ViewEntry((*aCurrView)->mpView))->getXBitmap() ); + ++aCurrView; + } + } + +private: + // One transition object per view + std::vector< TransitionViewPair* > maTransitions; + + // bool + bool mbSuccess; + + sal_Int16 mnTransitionType; + sal_Int16 mnTransitionSubType; + + uno::Reference<presentation::XTransitionFactory> mxFactory; +}; + +class ClippedSlideChange : public SlideChangeBase +{ +public: + /** Create a new SlideChanger, for the given leaving and + entering slide bitmaps, which applies the given clip + polygon. + */ + ClippedSlideChange( + const SlideSharedPtr& pEnteringSlide, + const ParametricPolyPolygonSharedPtr& rPolygon, + const TransitionInfo& rTransitionInfo, + const UnoViewContainer& rViewContainer, + ScreenUpdater& rScreenUpdater, + EventMultiplexer& rEventMultiplexer, + bool bDirectionForward, + const SoundPlayerSharedPtr& pSoundPlayer ) : + SlideChangeBase( + // leaving bitmap is empty, we're leveraging the fact that the + // old slide is still displayed in the background: + boost::optional<SlideSharedPtr>(), + pEnteringSlide, + pSoundPlayer, + rViewContainer, + rScreenUpdater, + rEventMultiplexer ), + maClippingFunctor( rPolygon, + rTransitionInfo, + bDirectionForward, + true ) + {} + + virtual void performIn( + const ::cppcanvas::CustomSpriteSharedPtr& rSprite, + const ViewEntry& rViewEntry, + const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + double t ); + + virtual void performOut( + const ::cppcanvas::CustomSpriteSharedPtr& rSprite, + const ViewEntry& rViewEntry, + const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + double t ); + +private: + ClippingFunctor maClippingFunctor; +}; + +void ClippedSlideChange::performIn( + const ::cppcanvas::CustomSpriteSharedPtr& rSprite, + const ViewEntry& rViewEntry, + const ::cppcanvas::CanvasSharedPtr& /*rDestinationCanvas*/, + double t ) +{ + // #i46602# Better work in device coordinate space here, + // otherwise, we too easily suffer from roundoffs. Apart from + // that, getEnteringSizePixel() _guarantees_ to cover the whole + // slide bitmap. There's a catch, though: this removes any effect + // of the view transformation (e.g. rotation) from the transition. + rSprite->setClipPixel( + maClippingFunctor( t, + getEnteringSlideSizePixel(rViewEntry.mpView) ) ); +} + +void ClippedSlideChange::performOut( + const ::cppcanvas::CustomSpriteSharedPtr& /*rSprite*/, + const ViewEntry& /*rViewEntry*/, + const ::cppcanvas::CanvasSharedPtr& /*rDestinationCanvas*/, + double /*t*/ ) +{ + // not needed here +} + + +class FadingSlideChange : public SlideChangeBase +{ +public: + /** Create a new SlideChanger, for the given leaving and + entering slides, which applies a fade effect. + */ + FadingSlideChange( + boost::optional<SlideSharedPtr> const & leavingSlide, + const SlideSharedPtr& pEnteringSlide, + boost::optional<RGBColor> const& rFadeColor, + const SoundPlayerSharedPtr& pSoundPlayer, + const UnoViewContainer& rViewContainer, + ScreenUpdater& rScreenUpdater, + EventMultiplexer& rEventMultiplexer ) + : SlideChangeBase( leavingSlide, + pEnteringSlide, + pSoundPlayer, + rViewContainer, + rScreenUpdater, + rEventMultiplexer ), + maFadeColor( rFadeColor ), + mbFirstTurn( true ) + {} + + virtual void performIn( + const ::cppcanvas::CustomSpriteSharedPtr& rSprite, + const ViewEntry& rViewEntry, + const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + double t ); + + virtual void performOut( + const ::cppcanvas::CustomSpriteSharedPtr& rSprite, + const ViewEntry& rViewEntry, + const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + double t ); + +private: + const boost::optional< RGBColor > maFadeColor; + bool mbFirstTurn; +}; + +void FadingSlideChange::performIn( + const ::cppcanvas::CustomSpriteSharedPtr& rSprite, + const ViewEntry& /*rViewEntry*/, + const ::cppcanvas::CanvasSharedPtr& /*rDestinationCanvas*/, + double t ) +{ + ENSURE_OR_THROW( + rSprite, + "FadingSlideChange::performIn(): Invalid sprite" ); + + if( maFadeColor ) + // After half of the active time, fade in new slide + rSprite->setAlpha( t > 0.5 ? 2.0*(t-0.5) : 0.0 ); + else + // Fade in new slide over full active time + rSprite->setAlpha( t ); +} + +void FadingSlideChange::performOut( + const ::cppcanvas::CustomSpriteSharedPtr& rSprite, + const ViewEntry& rViewEntry, + const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + double t ) +{ + ENSURE_OR_THROW( + rSprite, + "FadingSlideChange::performOut(): Invalid sprite" ); + ENSURE_OR_THROW( + rDestinationCanvas, + "FadingSlideChange::performOut(): Invalid dest canvas" ); + + // only needed for color fades + if( maFadeColor ) + { + if( mbFirstTurn ) + { + mbFirstTurn = false; + + // clear page to given fade color. 'Leaving' slide is + // painted atop of that, but slowly fading out. + fillPage( rDestinationCanvas, + getEnteringSlideSizePixel( rViewEntry.mpView ), + *maFadeColor ); + } + + // Until half of the active time, fade out old + // slide. After half of the active time, old slide + // will be invisible. + rSprite->setAlpha( t > 0.5 ? 0.0 : 2.0*(0.5-t) ); + } +} + +class MovingSlideChange : public SlideChangeBase +{ + /// Direction vector for leaving slide, + const ::basegfx::B2DVector maLeavingDirection; + + /// Direction vector for entering slide, + const ::basegfx::B2DVector maEnteringDirection; + + bool mbFirstPerformCall; + +public: + /** Create a new SlideChanger, for the given entering slide + bitmaps, which performes a moving slide change effect + + @param rLeavingDirection + Direction vector. The move is performed along this + direction vector, starting at a position where the leaving + slide is fully visible, and ending at a position where the + leaving slide is just not visible. The vector must have + unit length. + + @param rEnteringDirection + Direction vector. The move is performed along this + direction vector, starting at a position where the + entering slide is just not visible, and ending at the + final slide position. The vector must have unit length. + */ + MovingSlideChange( + const boost::optional<SlideSharedPtr>& leavingSlide, + const SlideSharedPtr& pEnteringSlide, + const SoundPlayerSharedPtr& pSoundPlayer, + const UnoViewContainer& rViewContainer, + ScreenUpdater& rScreenUpdater, + EventMultiplexer& rEventMultiplexer, + const ::basegfx::B2DVector& rLeavingDirection, + const ::basegfx::B2DVector& rEnteringDirection ) + : SlideChangeBase( + leavingSlide, pEnteringSlide, pSoundPlayer, + rViewContainer, rScreenUpdater, rEventMultiplexer, + // Optimization: when leaving bitmap is given, + // but it does not move, don't create sprites for it, + // we simply paint it once at startup: + !rLeavingDirection.equalZero() /* bCreateLeavingSprites */, + !rEnteringDirection.equalZero() /* bCreateEnteringSprites */ ), + // TODO(F1): calc correct length of direction + // vector. Directions not strictly horizontal or vertical + // must travel a longer distance. + maLeavingDirection( rLeavingDirection ), + // TODO(F1): calc correct length of direction + // vector. Directions not strictly horizontal or vertical + // must travel a longer distance. + maEnteringDirection( rEnteringDirection ), + mbFirstPerformCall( true ) + {} + + virtual void performIn( + const ::cppcanvas::CustomSpriteSharedPtr& rSprite, + const ViewEntry& rViewEntry, + const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + double t ); + + virtual void performOut( + const ::cppcanvas::CustomSpriteSharedPtr& rSprite, + const ViewEntry& rViewEntry, + const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + double t ); +}; + +void MovingSlideChange::performIn( + const ::cppcanvas::CustomSpriteSharedPtr& rSprite, + const ViewEntry& rViewEntry, + const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + double t ) +{ + // intro sprite moves: + + ENSURE_OR_THROW( + rSprite, + "MovingSlideChange::performIn(): Invalid sprite" ); + ENSURE_OR_THROW( + rDestinationCanvas, + "MovingSlideChange::performIn(): Invalid dest canvas" ); + + if (mbFirstPerformCall && maLeavingDirection.equalZero()) + { + mbFirstPerformCall = false; + renderBitmap( getLeavingBitmap(rViewEntry), rDestinationCanvas ); + } + + // TODO(F1): This does not account for non-translational + // transformations! If the canvas is rotated, we still + // move the sprite unrotated (which might or might not + // produce the intended effect). + const basegfx::B2DHomMatrix aViewTransform( + rDestinationCanvas->getTransformation() ); + const basegfx::B2DPoint aPageOrigin( + aViewTransform * basegfx::B2DPoint() ); + + // move sprite + rSprite->movePixel( + aPageOrigin + + ((t - 1.0) * + ::basegfx::B2DSize( getEnteringSlideSizePixel(rViewEntry.mpView) ) * + maEnteringDirection) ); +} + +void MovingSlideChange::performOut( + const ::cppcanvas::CustomSpriteSharedPtr& rSprite, + const ViewEntry& rViewEntry, + const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + double t ) +{ + // outro sprite moves: + + ENSURE_OR_THROW( + rSprite, + "MovingSlideChange::performOut(): Invalid sprite" ); + ENSURE_OR_THROW( + rDestinationCanvas, + "MovingSlideChange::performOut(): Invalid dest canvas" ); + + if (mbFirstPerformCall && maEnteringDirection.equalZero()) + { + mbFirstPerformCall = false; + renderBitmap( getEnteringBitmap(rViewEntry), rDestinationCanvas ); + } + + // TODO(F1): This does not account for non-translational + // transformations! If the canvas is rotated, we still + // move the sprite unrotated (which might or might not + // produce the intended effect). + const basegfx::B2DHomMatrix aViewTransform( + rDestinationCanvas->getTransformation() ); + const basegfx::B2DPoint aPageOrigin( + aViewTransform * basegfx::B2DPoint() ); + + // move sprite + rSprite->movePixel( + aPageOrigin + (t * + ::basegfx::B2DSize( getEnteringSlideSizePixel(rViewEntry.mpView) ) * + maLeavingDirection) ); +} + + +NumberAnimationSharedPtr createPushWipeTransition( + boost::optional<SlideSharedPtr> const & leavingSlide_, + const SlideSharedPtr& pEnteringSlide, + const UnoViewContainer& rViewContainer, + ScreenUpdater& rScreenUpdater, + EventMultiplexer& rEventMultiplexer, + sal_Int16 /*nTransitionType*/, + sal_Int16 nTransitionSubType, + bool /*bTransitionDirection*/, + const SoundPlayerSharedPtr& pSoundPlayer ) +{ + boost::optional<SlideSharedPtr> leavingSlide; // no bitmap + if (leavingSlide_ && (*leavingSlide_).get() != 0) + { + // opt: only page, if we've an + // actual slide to move out here. We + // _don't_ need a fake black background + // bitmap, neither for push nor for comb + // wipes. + leavingSlide = leavingSlide_; + } + + // setup direction vector + bool bComb( false ); + ::basegfx::B2DVector aDirection; + switch( nTransitionSubType ) + { + default: + OSL_ENSURE( + false, + "createPushWipeTransition(): Unexpected transition " + "subtype for animations::TransitionType::PUSHWIPE " + "transitions" ); + return NumberAnimationSharedPtr(); + + case animations::TransitionSubType::FROMTOP: + aDirection = ::basegfx::B2DVector( 0.0, 1.0 ); + break; + + case animations::TransitionSubType::FROMBOTTOM: + aDirection = ::basegfx::B2DVector( 0.0, -1.0 ); + break; + + case animations::TransitionSubType::FROMLEFT: + aDirection = ::basegfx::B2DVector( 1.0, 0.0 ); + break; + + case animations::TransitionSubType::FROMRIGHT: + aDirection = ::basegfx::B2DVector( -1.0, 0.0 ); + break; + + case animations::TransitionSubType::FROMBOTTOMRIGHT: + aDirection = ::basegfx::B2DVector( -1.0, -1.0 ); + break; + + case animations::TransitionSubType::FROMBOTTOMLEFT: + aDirection = ::basegfx::B2DVector( 1.0, -1.0 ); + break; + + case animations::TransitionSubType::FROMTOPRIGHT: + aDirection = ::basegfx::B2DVector( -1.0, 1.0 ); + break; + + case animations::TransitionSubType::FROMTOPLEFT: + aDirection = ::basegfx::B2DVector( 1.0, 1.0 ); + break; + + case animations::TransitionSubType::COMBHORIZONTAL: + aDirection = ::basegfx::B2DVector( 1.0, 0.0 ); + bComb = true; + break; + + case animations::TransitionSubType::COMBVERTICAL: + aDirection = ::basegfx::B2DVector( 0.0, 1.0 ); + bComb = true; + break; + } + + if( bComb ) + { + return NumberAnimationSharedPtr( + new CombTransition( leavingSlide, + pEnteringSlide, + pSoundPlayer, + rViewContainer, + rScreenUpdater, + rEventMultiplexer, + aDirection, + 24 /* comb with 12 stripes */ )); + } + else + { + return NumberAnimationSharedPtr( + new MovingSlideChange( leavingSlide, + pEnteringSlide, + pSoundPlayer, + rViewContainer, + rScreenUpdater, + rEventMultiplexer, + aDirection, + aDirection )); + } +} + +NumberAnimationSharedPtr createSlideWipeTransition( + boost::optional<SlideSharedPtr> const & leavingSlide, + const SlideSharedPtr& pEnteringSlide, + const UnoViewContainer& rViewContainer, + ScreenUpdater& rScreenUpdater, + EventMultiplexer& rEventMultiplexer, + sal_Int16 /*nTransitionType*/, + sal_Int16 nTransitionSubType, + bool bTransitionDirection, + const SoundPlayerSharedPtr& pSoundPlayer ) +{ + // setup 'in' direction vector + ::basegfx::B2DVector aInDirection; + switch( nTransitionSubType ) + { + default: + OSL_ENSURE( + false, + "createSlideWipeTransition(): Unexpected transition " + "subtype for animations::TransitionType::SLIDEWIPE " + "transitions" ); + return NumberAnimationSharedPtr(); + + case animations::TransitionSubType::FROMTOP: + aInDirection = ::basegfx::B2DVector( 0.0, 1.0 ); + break; + + case animations::TransitionSubType::FROMRIGHT: + aInDirection = ::basegfx::B2DVector( -1.0, 0.0 ); + break; + + case animations::TransitionSubType::FROMLEFT: + aInDirection = ::basegfx::B2DVector( 1.0, 0.0 ); + break; + + case animations::TransitionSubType::FROMBOTTOM: + aInDirection = ::basegfx::B2DVector( 0.0, -1.0 ); + break; + + case animations::TransitionSubType::FROMBOTTOMRIGHT: + aInDirection = ::basegfx::B2DVector( -1.0, -1.0 ); + break; + + case animations::TransitionSubType::FROMBOTTOMLEFT: + aInDirection = ::basegfx::B2DVector( 1.0, -1.0 ); + break; + + case animations::TransitionSubType::FROMTOPRIGHT: + aInDirection = ::basegfx::B2DVector( -1.0, 1.0 ); + break; + + case animations::TransitionSubType::FROMTOPLEFT: + aInDirection = ::basegfx::B2DVector( 1.0, 1.0 ); + break; + } + + if( bTransitionDirection ) + { + // normal, 'forward' slide wipe effect. Since the old + // content is still on screen (and does not move), we omit + // the 'leaving' slide. + // ======================================================= + + return NumberAnimationSharedPtr( + new MovingSlideChange( + boost::optional<SlideSharedPtr>() /* no slide */, + pEnteringSlide, + pSoundPlayer, + rViewContainer, + rScreenUpdater, + rEventMultiplexer, + basegfx::B2DVector(), + aInDirection )); + } + else + { + // 'reversed' slide wipe effect. Reverse for slide wipes + // means, that the new slide is in the back, statically, + // and the old one is moving off in the foreground. + // ======================================================= + + return NumberAnimationSharedPtr( + new MovingSlideChange( leavingSlide, + pEnteringSlide, + pSoundPlayer, + rViewContainer, + rScreenUpdater, + rEventMultiplexer, + aInDirection, + basegfx::B2DVector() )); + } +} + +NumberAnimationSharedPtr createPluginTransition( + sal_Int16 nTransitionType, + sal_Int16 nTransitionSubType, + boost::optional<SlideSharedPtr> const& pLeavingSlide, + const SlideSharedPtr& pEnteringSlide, + const UnoViewContainer& rViewContainer, + ScreenUpdater& rScreenUpdater, + const uno::Reference< + presentation::XTransitionFactory>& xFactory, + const SoundPlayerSharedPtr& pSoundPlayer, + EventMultiplexer& rEventMultiplexer) +{ + PluginSlideChange* pTransition = + new PluginSlideChange( + nTransitionType, + nTransitionSubType, + pLeavingSlide, + pEnteringSlide, + rViewContainer, + rScreenUpdater, + xFactory, + pSoundPlayer, + rEventMultiplexer ); + + if( pTransition->Success() ) + return NumberAnimationSharedPtr( pTransition ); + else { + delete pTransition; + return NumberAnimationSharedPtr(); + } +} + +} // anon namespace + + +NumberAnimationSharedPtr TransitionFactory::createSlideTransition( + const SlideSharedPtr& pLeavingSlide, + const SlideSharedPtr& pEnteringSlide, + const UnoViewContainer& rViewContainer, + ScreenUpdater& rScreenUpdater, + EventMultiplexer& rEventMultiplexer, + const uno::Reference<presentation::XTransitionFactory>& xOptionalFactory, + sal_Int16 nTransitionType, + sal_Int16 nTransitionSubType, + bool bTransitionDirection, + const RGBColor& rTransitionFadeColor, + const SoundPlayerSharedPtr& pSoundPlayer ) +{ + // xxx todo: change to TransitionType::NONE, TransitionSubType::NONE: + if (nTransitionType == 0 && nTransitionSubType == 0) { + // just play sound, no slide transition: + if (pSoundPlayer) { + pSoundPlayer->startPlayback(); + // xxx todo: for now, presentation.cxx takes care about the slide + // #i50492# transition sound object, so just release it here + } + return NumberAnimationSharedPtr(); + } + + ENSURE_OR_THROW( + pEnteringSlide, + "TransitionFactory::createSlideTransition(): Invalid entering slide" ); + + if( xOptionalFactory.is() && + xOptionalFactory->hasTransition(nTransitionType, nTransitionSubType) ) + { + // #i82460# - optional plugin factory claims this transition. delegate. + NumberAnimationSharedPtr pTransition( + createPluginTransition( + nTransitionType, + nTransitionSubType, + comphelper::make_optional(pLeavingSlide), + pEnteringSlide, + rViewContainer, + rScreenUpdater, + xOptionalFactory, + pSoundPlayer, + rEventMultiplexer )); + + if( pTransition.get() ) + return pTransition; + } + + const TransitionInfo* pTransitionInfo( + getTransitionInfo( nTransitionType, nTransitionSubType ) ); + + if( pTransitionInfo != NULL ) + { + switch( pTransitionInfo->meTransitionClass ) + { + default: + case TransitionInfo::TRANSITION_INVALID: + OSL_TRACE( + "TransitionFactory::createSlideTransition(): " + "Invalid type/subtype (%d/%d) combination encountered.", + nTransitionType, + nTransitionSubType ); + return NumberAnimationSharedPtr(); + + + case TransitionInfo::TRANSITION_CLIP_POLYPOLYGON: + { + // generate parametric poly-polygon + ParametricPolyPolygonSharedPtr pPoly( + ParametricPolyPolygonFactory::createClipPolyPolygon( + nTransitionType, nTransitionSubType ) ); + + // create a clip transition from that + return NumberAnimationSharedPtr( + new ClippedSlideChange( pEnteringSlide, + pPoly, + *pTransitionInfo, + rViewContainer, + rScreenUpdater, + rEventMultiplexer, + bTransitionDirection, + pSoundPlayer )); + } + + case TransitionInfo::TRANSITION_SPECIAL: + { + switch( nTransitionType ) + { + default: + OSL_ENSURE( + false, + "TransitionFactory::createSlideTransition(): " + "Unexpected transition type for " + "TRANSITION_SPECIAL transitions" ); + return NumberAnimationSharedPtr(); + + case animations::TransitionType::RANDOM: + { + // select randomly one of the effects from the + // TransitionFactoryTable + + const TransitionInfo* pRandomTransitionInfo( + getRandomTransitionInfo() ); + + ENSURE_OR_THROW( + pRandomTransitionInfo != NULL, + "TransitionFactory::createSlideTransition(): " + "Got invalid random transition info" ); + + ENSURE_OR_THROW( + pRandomTransitionInfo->mnTransitionType != + animations::TransitionType::RANDOM, + "TransitionFactory::createSlideTransition(): " + "Got random again for random input!" ); + + // and recurse + return createSlideTransition( + pLeavingSlide, + pEnteringSlide, + rViewContainer, + rScreenUpdater, + rEventMultiplexer, + xOptionalFactory, + pRandomTransitionInfo->mnTransitionType, + pRandomTransitionInfo->mnTransitionSubType, + bTransitionDirection, + rTransitionFadeColor, + pSoundPlayer ); + } + + case animations::TransitionType::PUSHWIPE: + { + return createPushWipeTransition( + comphelper::make_optional(pLeavingSlide), + pEnteringSlide, + rViewContainer, + rScreenUpdater, + rEventMultiplexer, + nTransitionType, + nTransitionSubType, + bTransitionDirection, + pSoundPlayer ); + } + + case animations::TransitionType::SLIDEWIPE: + { + return createSlideWipeTransition( + comphelper::make_optional(pLeavingSlide), + pEnteringSlide, + rViewContainer, + rScreenUpdater, + rEventMultiplexer, + nTransitionType, + nTransitionSubType, + bTransitionDirection, + pSoundPlayer ); + } + + case animations::TransitionType::FADE: + { + // black page: + boost::optional<SlideSharedPtr> leavingSlide; + + switch( nTransitionSubType ) + { + case animations::TransitionSubType::CROSSFADE: + // crossfade needs no further setup, + // just blend new slide over existing + // background. + break; + + // TODO(F1): Implement toColor/fromColor fades + case animations::TransitionSubType::FADETOCOLOR: + // FALLTHROUGH intended + case animations::TransitionSubType::FADEFROMCOLOR: + // FALLTHROUGH intended + case animations::TransitionSubType::FADEOVERCOLOR: + if (pLeavingSlide) { + // only generate, if fade + // effect really needs it. + leavingSlide.reset( pLeavingSlide ); + } + break; + + default: + ENSURE_OR_THROW( false, + "SlideTransitionFactory::createSlideTransition(): Unknown FADE subtype" ); + } + + return NumberAnimationSharedPtr( + new FadingSlideChange( + leavingSlide, + pEnteringSlide, + comphelper::make_optional( + rTransitionFadeColor), + pSoundPlayer, + rViewContainer, + rScreenUpdater, + rEventMultiplexer )); + } + } + } + break; + } + } + + // No animation generated, maybe no table entry for given + // transition? + OSL_TRACE( + "TransitionFactory::createSlideTransition(): " + "Unknown type/subtype (%d/%d) combination encountered", + nTransitionType, + nTransitionSubType ); + OSL_ENSURE( + false, + "TransitionFactory::createSlideTransition(): " + "Unknown type/subtype combination encountered" ); + + return NumberAnimationSharedPtr(); +} + +} // namespace internal +} // namespace presentation diff --git a/slideshow/source/engine/transitions/snakewipe.cxx b/slideshow/source/engine/transitions/snakewipe.cxx new file mode 100644 index 000000000000..a65f8ec583ee --- /dev/null +++ b/slideshow/source/engine/transitions/snakewipe.cxx @@ -0,0 +1,244 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include "snakewipe.hxx" +#include "transitiontools.hxx" + + +namespace slideshow { +namespace internal { + +SnakeWipe::SnakeWipe( sal_Int32 nElements, bool diagonal, bool flipOnYAxis ) + : m_sqrtElements( static_cast<sal_Int32>( + sqrt( static_cast<double>(nElements) ) ) ), + m_elementEdge( 1.0 / m_sqrtElements ), + m_diagonal(diagonal), + m_flipOnYAxis(flipOnYAxis) +{ +} + +::basegfx::B2DPolyPolygon SnakeWipe::calcSnake( double t ) const +{ + ::basegfx::B2DPolyPolygon res; + const double area = (t * m_sqrtElements * m_sqrtElements); + const sal_Int32 line_ = (static_cast<sal_Int32>(area) / m_sqrtElements); + const double line = ::basegfx::pruneScaleValue( + static_cast<double>(line_) / m_sqrtElements ); + const double col = ::basegfx::pruneScaleValue( + (area - (line_ * m_sqrtElements)) / m_sqrtElements ); + + if (! ::basegfx::fTools::equalZero( line )) { + ::basegfx::B2DPolygon poly; + poly.append( ::basegfx::B2DPoint( 0.0, 0.0 ) ); + poly.append( ::basegfx::B2DPoint( 0.0, line ) ); + poly.append( ::basegfx::B2DPoint( 1.0, line ) ); + poly.append( ::basegfx::B2DPoint( 1.0, 0.0 ) ); + poly.setClosed(true); + res.append(poly); + } + if (! ::basegfx::fTools::equalZero( col )) + { + double offset = 0.0; + if ((line_ & 1) == 1) { + // odd line: => right to left + offset = (1.0 - col); + } + ::basegfx::B2DPolygon poly; + poly.append( ::basegfx::B2DPoint( offset, line ) ); + poly.append( ::basegfx::B2DPoint( offset, + line + m_elementEdge ) ); + poly.append( ::basegfx::B2DPoint( offset + col, + line + m_elementEdge ) ); + poly.append( ::basegfx::B2DPoint( offset + col, line ) ); + poly.setClosed(true); + res.append(poly); + } + + return res; +} + +::basegfx::B2DPolyPolygon SnakeWipe::calcHalfDiagonalSnake( + double t, bool in ) const +{ + ::basegfx::B2DPolyPolygon res; + + if (in) { + const double sqrtArea2 = sqrt( t * m_sqrtElements * m_sqrtElements ); + const double edge = ::basegfx::pruneScaleValue( + static_cast<double>( static_cast<sal_Int32>(sqrtArea2) ) / + m_sqrtElements ); + + ::basegfx::B2DPolygon poly; + if (! ::basegfx::fTools::equalZero( edge )) { + poly.append( ::basegfx::B2DPoint( 0.0, 0.0 ) ); + poly.append( ::basegfx::B2DPoint( 0.0, edge ) ); + poly.append( ::basegfx::B2DPoint( edge, 0.0 ) ); + poly.setClosed(true); + res.append(poly); + } + const double a = (M_SQRT1_2 / m_sqrtElements); + const double d = (sqrtArea2 - static_cast<sal_Int32>(sqrtArea2)); + const double len = (t * M_SQRT2 * d); + const double height = ::basegfx::pruneScaleValue( M_SQRT1_2 / m_sqrtElements ); + poly.clear(); + poly.append( ::basegfx::B2DPoint( 0.0, 0.0 ) ); + poly.append( ::basegfx::B2DPoint( 0.0, height ) ); + poly.append( ::basegfx::B2DPoint( len + a, height ) ); + poly.append( ::basegfx::B2DPoint( len + a, 0.0 ) ); + poly.setClosed(true); + ::basegfx::B2DHomMatrix aTransform; + + if ((static_cast<sal_Int32>(sqrtArea2) & 1) == 1) + { + // odd line + aTransform = basegfx::tools::createRotateB2DHomMatrix(M_PI_2 + M_PI_4); + aTransform.translate(edge + m_elementEdge, 0.0); + } + else + { + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-a, 0.0); + aTransform.rotate( -M_PI_4 ); + aTransform.translate( 0.0, edge ); + } + + poly.transform( aTransform ); + res.append(poly); + } + else // out + { + const double sqrtArea2 = sqrt( t * m_sqrtElements * m_sqrtElements ); + const double edge = ::basegfx::pruneScaleValue( + static_cast<double>( static_cast<sal_Int32>(sqrtArea2) ) / + m_sqrtElements ); + + ::basegfx::B2DPolygon poly; + if (! ::basegfx::fTools::equalZero( edge )) { + poly.append( ::basegfx::B2DPoint( 0.0, 1.0 ) ); + poly.append( ::basegfx::B2DPoint( edge, 1.0 ) ); + poly.append( ::basegfx::B2DPoint( 1.0, edge ) ); + poly.append( ::basegfx::B2DPoint( 1.0, 0.0 ) ); + poly.setClosed(true); + res.append(poly); + } + const double a = (M_SQRT1_2 / m_sqrtElements); + const double d = (sqrtArea2 - static_cast<sal_Int32>(sqrtArea2)); + const double len = ((1.0 - t) * M_SQRT2 * d); + const double height = ::basegfx::pruneScaleValue( M_SQRT1_2 / m_sqrtElements ); + poly.clear(); + poly.append( ::basegfx::B2DPoint( 0.0, 0.0 ) ); + poly.append( ::basegfx::B2DPoint( 0.0, height ) ); + poly.append( ::basegfx::B2DPoint( len + a, height ) ); + poly.append( ::basegfx::B2DPoint( len + a, 0.0 ) ); + poly.setClosed(true); + ::basegfx::B2DHomMatrix aTransform; + + if ((static_cast<sal_Int32>(sqrtArea2) & 1) == 1) + { + // odd line + aTransform = basegfx::tools::createTranslateB2DHomMatrix(0.0, -height); + aTransform.rotate( M_PI_2 + M_PI_4 ); + aTransform.translate( 1.0, edge ); + } + else + { + aTransform = basegfx::tools::createRotateB2DHomMatrix(-M_PI_4); + aTransform.translate( edge, 1.0 ); + } + poly.transform( aTransform ); + res.append(poly); + } + + return res; +} + +::basegfx::B2DPolyPolygon SnakeWipe::operator () ( double t ) +{ + ::basegfx::B2DPolyPolygon res; + if (m_diagonal) + { + if (t >= 0.5) { + res.append( calcHalfDiagonalSnake( 1.0, true ) ); + res.append( calcHalfDiagonalSnake( 2.0 * (t - 0.5), false ) ); + } + else + res.append( calcHalfDiagonalSnake( 2.0 * t, true ) ); + } + else + res = calcSnake(t); + + return m_flipOnYAxis ? flipOnYAxis(res) : res; +} + +::basegfx::B2DPolyPolygon ParallelSnakesWipe::operator () ( double t ) +{ + ::basegfx::B2DPolyPolygon res; + if (m_diagonal) + { + OSL_ASSERT( m_opposite ); + ::basegfx::B2DPolyPolygon half( + calcHalfDiagonalSnake( t, false /* out */ ) ); + // flip on x axis and rotate 90 degrees: + basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleB2DHomMatrix(1.0, -1.0)); + aTransform.translate( -0.5, 0.5 ); + aTransform.rotate( M_PI_2 ); + aTransform.translate( 0.5, 0.5 ); + half.transform( aTransform ); + half.flip(); + res.append( half ); + + // rotate 180 degrees: + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); + aTransform.rotate( M_PI ); + aTransform.translate( 0.5, 0.5 ); + half.transform( aTransform ); + res.append( half ); + } + else + { + ::basegfx::B2DPolyPolygon half( calcSnake( t / 2.0 ) ); + // rotate 90 degrees: + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5)); + aTransform.rotate( M_PI_2 ); + aTransform.translate( 0.5, 0.5 ); + half.transform( aTransform ); + res.append( flipOnYAxis(half) ); + res.append( m_opposite ? flipOnXAxis(half) : half ); + } + + return m_flipOnYAxis ? flipOnYAxis(res) : res; +} + +} +} diff --git a/slideshow/source/engine/transitions/snakewipe.hxx b/slideshow/source/engine/transitions/snakewipe.hxx new file mode 100644 index 000000000000..265f383757d9 --- /dev/null +++ b/slideshow/source/engine/transitions/snakewipe.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_SNAKEWIPE_HXX +#define INCLUDED_SLIDESHOW_SNAKEWIPE_HXX + +#include "parametricpolypolygon.hxx" + +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/point/b2dpoint.hxx> + + +namespace slideshow { +namespace internal { + +/// Generates a snake wipe: +class SnakeWipe : public ParametricPolyPolygon +{ +public: + SnakeWipe( sal_Int32 nElements, bool diagonal, bool flipOnYAxis ); + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); + +protected: + // topLeftHorizontal: + ::basegfx::B2DPolyPolygon calcSnake( double t ) const; + // topLeftDiagonal: + ::basegfx::B2DPolyPolygon calcHalfDiagonalSnake( double t, bool in ) const; + + const sal_Int32 m_sqrtElements; + const double m_elementEdge; + const bool m_diagonal; + const bool m_flipOnYAxis; +}; + +/// Generates a parallel snakes wipe: +class ParallelSnakesWipe : public SnakeWipe +{ +public: + ParallelSnakesWipe( sal_Int32 nElements, + bool diagonal, bool flipOnYAxis, bool opposite ) + : SnakeWipe( nElements, diagonal, flipOnYAxis ), + m_opposite( opposite ) + {} + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +private: + const bool m_opposite; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_SNAKEWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/spiralwipe.cxx b/slideshow/source/engine/transitions/spiralwipe.cxx new file mode 100644 index 000000000000..0ceb38cacc53 --- /dev/null +++ b/slideshow/source/engine/transitions/spiralwipe.cxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include "spiralwipe.hxx" +#include "transitiontools.hxx" + +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> + + +namespace slideshow { +namespace internal { + +SpiralWipe::SpiralWipe( sal_Int32 nElements, bool flipOnYAxis ) + : m_elements(nElements), + m_sqrtElements( static_cast<sal_Int32>( + sqrt( static_cast<double>(nElements) ) ) ), + m_flipOnYAxis(flipOnYAxis) +{ +} + +::basegfx::B2DPolyPolygon SpiralWipe::calcNegSpiral( double t ) const +{ + const double area = (t * m_elements); + const double e = (sqrt(area) / 2.0); + const sal_Int32 edge = (static_cast<sal_Int32>(e) * 2); + + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5)); + const double edge_ = ::basegfx::pruneScaleValue( + static_cast<double>(edge) / m_sqrtElements ); + aTransform.scale( edge_, edge_ ); + aTransform.translate( 0.5, 0.5 ); + ::basegfx::B2DPolygon poly( createUnitRect() ); + poly.transform( aTransform ); + ::basegfx::B2DPolyPolygon res(poly); + + if (! ::basegfx::fTools::equalZero( 1.0 - t )) { + const sal_Int32 edge1 = (edge + 1); + sal_Int32 len = static_cast<sal_Int32>( (e - (edge /2)) * edge1 * 4 ); + double w = M_PI_2; + while (len > 0) { + const sal_Int32 alen = (len > edge1 ? edge1 : len); + len -= alen; + poly = createUnitRect(); + aTransform = basegfx::tools::createScaleB2DHomMatrix( + ::basegfx::pruneScaleValue( static_cast<double>(alen) / m_sqrtElements ), + ::basegfx::pruneScaleValue( 1.0 / m_sqrtElements ) ); + aTransform.translate( + - ::basegfx::pruneScaleValue( + static_cast<double>(edge / 2) / m_sqrtElements ), + ::basegfx::pruneScaleValue( + static_cast<double>(edge / 2) / m_sqrtElements ) ); + aTransform.rotate( w ); + w -= M_PI_2; + aTransform.translate( 0.5, 0.5 ); + poly.transform( aTransform ); + res.append(poly); + } + } + + return res; +} + +::basegfx::B2DPolyPolygon SpiralWipe::operator () ( double t ) +{ + ::basegfx::B2DPolyPolygon res( createUnitRect() ); + ::basegfx::B2DPolyPolygon innerSpiral( calcNegSpiral( 1.0 - t ) ); + innerSpiral.flip(); + res.append(innerSpiral); + return m_flipOnYAxis ? flipOnYAxis(res) : res; +} + +::basegfx::B2DPolyPolygon BoxSnakesWipe::operator () ( double t ) +{ + ::basegfx::B2DPolyPolygon res( createUnitRect() ); + ::basegfx::B2DPolyPolygon innerSpiral( calcNegSpiral( 1.0 - t ) ); + innerSpiral.flip(); + + if (m_fourBox) { + ::basegfx::B2DHomMatrix aTransform; + aTransform.scale( 0.5, 0.5 ); + innerSpiral.transform( aTransform ); + res.append(innerSpiral); + res.append( flipOnXAxis(innerSpiral) ); + innerSpiral = flipOnYAxis(innerSpiral); + res.append(innerSpiral); + res.append( flipOnXAxis(innerSpiral) ); + } + else { + ::basegfx::B2DHomMatrix aTransform; + aTransform.scale( 1.0, 0.5 ); + innerSpiral.transform( aTransform ); + res.append(innerSpiral); + res.append( flipOnXAxis(innerSpiral) ); + } + + return m_flipOnYAxis ? flipOnYAxis(res) : res; +} + +} +} diff --git a/slideshow/source/engine/transitions/spiralwipe.hxx b/slideshow/source/engine/transitions/spiralwipe.hxx new file mode 100644 index 000000000000..35727caa2c76 --- /dev/null +++ b/slideshow/source/engine/transitions/spiralwipe.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_SPIRALWIPE_HXX +#define INCLUDED_SLIDESHOW_SPIRALWIPE_HXX + +#include "parametricpolypolygon.hxx" +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/point/b2dpoint.hxx> + + +namespace slideshow { +namespace internal { + +/// Generates a topLeftClockWise or +/// bottomLeftCounterClockWise (flipOnYAxis=true) spiral wipe: +class SpiralWipe : public ParametricPolyPolygon +{ +public: + SpiralWipe( sal_Int32 nElements, bool flipOnYAxis = false ); + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +protected: + ::basegfx::B2DPolyPolygon calcNegSpiral( double t ) const; + + const sal_Int32 m_elements; + const sal_Int32 m_sqrtElements; + const bool m_flipOnYAxis; +}; + +/// Generates a twoBoxLeft or fourBoxHorizontal wipe: +class BoxSnakesWipe : public SpiralWipe +{ +public: + BoxSnakesWipe( sal_Int32 nElements, bool fourBox = false ) + : SpiralWipe(nElements), m_fourBox(fourBox) {} + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +private: + const bool m_fourBox; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_SPIRALWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/sweepwipe.cxx b/slideshow/source/engine/transitions/sweepwipe.cxx new file mode 100644 index 000000000000..d5361121743c --- /dev/null +++ b/slideshow/source/engine/transitions/sweepwipe.cxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include "clockwipe.hxx" +#include "sweepwipe.hxx" +#include "transitiontools.hxx" + + +namespace slideshow { +namespace internal { + +::basegfx::B2DPolyPolygon SweepWipe::operator () ( double t ) +{ + t /= 2.0; + if (! m_center) + t /= 2.0; + if (!m_single && !m_oppositeVertical) + t /= 2.0; + + ::basegfx::B2DPolygon poly( ClockWipe::calcCenteredClock( 0.25 + t ) ); + ::basegfx::B2DHomMatrix aTransform; + + if (m_center) + { + aTransform = basegfx::tools::createTranslateB2DHomMatrix(0.5, 0.0); + poly.transform( aTransform ); + } + ::basegfx::B2DPolyPolygon res(poly); + + if (! m_single) + { + if (m_oppositeVertical) + { + aTransform = basegfx::tools::createScaleB2DHomMatrix(1.0, -1.0); + aTransform.translate( 0.0, 1.0 ); + poly.transform( aTransform ); + poly.flip(); + } + else + { + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); + aTransform.rotate( M_PI ); + aTransform.translate( 0.5, 0.5 ); + poly.transform( aTransform ); + } + res.append(poly); + } + + return m_flipOnYAxis ? flipOnYAxis(res) : res; +} + +} +} diff --git a/slideshow/source/engine/transitions/sweepwipe.hxx b/slideshow/source/engine/transitions/sweepwipe.hxx new file mode 100644 index 000000000000..f641b4afad12 --- /dev/null +++ b/slideshow/source/engine/transitions/sweepwipe.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_SWEEPWIPE_HXX +#define INCLUDED_SLIDESHOW_SWEEPWIPE_HXX + +#include "parametricpolypolygon.hxx" + + +namespace slideshow { +namespace internal { + +class SweepWipe : public ParametricPolyPolygon +{ +public: + SweepWipe( bool center, bool single, + bool oppositeVertical, bool flipOnYAxis ) + : m_center(center), m_single(single), + m_oppositeVertical(oppositeVertical), m_flipOnYAxis(flipOnYAxis) + {} + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +private: + const bool m_center, m_single, m_oppositeVertical, m_flipOnYAxis; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_SWEEPWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/transitionfactorytab.cxx b/slideshow/source/engine/transitions/transitionfactorytab.cxx new file mode 100644 index 000000000000..671df2ab0fae --- /dev/null +++ b/slideshow/source/engine/transitions/transitionfactorytab.cxx @@ -0,0 +1,2132 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <boost/current_function.hpp> +#include <basegfx/numeric/ftools.hxx> +#include <com/sun/star/animations/TransitionType.hpp> +#include <com/sun/star/animations/TransitionSubType.hpp> + +#include "transitionfactory.hxx" +#include "tools.hxx" + +#include <algorithm> + +using namespace ::com::sun::star; + +namespace slideshow { +namespace internal { + +namespace { + +static const TransitionInfo lcl_transitionInfo[] = +{ + { + 0, + 0, + TransitionInfo::TRANSITION_INVALID, + 0.0, + 0.0, + 0.0, + TransitionInfo::REVERSEMETHOD_IGNORE, + false, + false + }, + { + // mapped to BarWipePolyPolygon: + animations::TransitionType::BARWIPE, + animations::TransitionSubType::LEFTTORIGHT, // (1) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + false, // 'out' by subtraction + false // scale isotrophically to target size + }, + { + // mapped to BarWipePolyPolygon: + animations::TransitionType::BARWIPE, + animations::TransitionSubType::TOPTOBOTTOM, // (2) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + false, // 'out' by subtraction + false // scale isotrophically to target size + }, + + { + // mapped to BarWipePolyPolygon(nBars=5): + animations::TransitionType::BLINDSWIPE, + animations::TransitionSubType::VERTICAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BarWipePolyPolygon(nBars=5): + animations::TransitionType::BLINDSWIPE, + animations::TransitionSubType::HORIZONTAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to BoxWipe: + animations::TransitionType::BOXWIPE, + animations::TransitionSubType::TOPLEFT, // (3) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, // possible via bottomRight + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BoxWipe: + animations::TransitionType::BOXWIPE, + animations::TransitionSubType::TOPRIGHT, // (4) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, // possible via bottomLeft + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BoxWipe: + animations::TransitionType::BOXWIPE, + animations::TransitionSubType::BOTTOMRIGHT, // (5) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, // possible via topLeft + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BoxWipe: + animations::TransitionType::BOXWIPE, + animations::TransitionSubType::BOTTOMLEFT, // (6) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, // possible via topRight + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BoxWipe: + animations::TransitionType::BOXWIPE, + animations::TransitionSubType::TOPCENTER, // (23) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BoxWipe: + animations::TransitionType::BOXWIPE, + animations::TransitionSubType::RIGHTCENTER, // (24) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BoxWipe: + animations::TransitionType::BOXWIPE, + animations::TransitionSubType::BOTTOMCENTER, // (25) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BoxWipe: + animations::TransitionType::BOXWIPE, + animations::TransitionSubType::LEFTCENTER, // (26) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to FourBoxWipe: + animations::TransitionType::FOURBOXWIPE, + animations::TransitionSubType::CORNERSIN, // (7) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FourBoxWipe: + animations::TransitionType::FOURBOXWIPE, + animations::TransitionSubType::CORNERSOUT, // (8) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to BarnDoorWipe: + animations::TransitionType::BARNDOORWIPE, + animations::TransitionSubType::VERTICAL, // (21) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BarnDoorWipe: + animations::TransitionType::BARNDOORWIPE, + animations::TransitionSubType::HORIZONTAL, // (22) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BarnDoorWipe: + animations::TransitionType::BARNDOORWIPE, + animations::TransitionSubType::DIAGONALBOTTOMLEFT, // (45) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 45.0, // rotation + M_SQRT2, // scaling + M_SQRT2, // scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BarnDoorWipe: + animations::TransitionType::BARNDOORWIPE, + animations::TransitionSubType::DIAGONALTOPLEFT, // (46) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -45.0, // rotation + M_SQRT2, // scaling + M_SQRT2, // scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to BarWipePolyPolygon: + animations::TransitionType::DIAGONALWIPE, + animations::TransitionSubType::TOPLEFT, // (41) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 45.0, // rotation + M_SQRT2, // scaling + M_SQRT2, // scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BarWipePolyPolygon: + animations::TransitionType::DIAGONALWIPE, + animations::TransitionSubType::TOPRIGHT, // (42) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 135.0, // rotation + M_SQRT2, // scaling + M_SQRT2, // scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + + { + animations::TransitionType::BOWTIEWIPE, + animations::TransitionSubType::VERTICAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::BOWTIEWIPE, + animations::TransitionSubType::HORIZONTAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to BarnDoorWipe (doubled=true): + animations::TransitionType::MISCDIAGONALWIPE, + animations::TransitionSubType::DOUBLEBARNDOOR, // (47) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 45.0, // rotation + M_SQRT2, // scaling + M_SQRT2, // scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to DoubleDiamondWipe: + animations::TransitionType::MISCDIAGONALWIPE, + animations::TransitionSubType::DOUBLEDIAMOND, // (48) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to VeeWipe: + animations::TransitionType::VEEWIPE, + animations::TransitionSubType::DOWN, // (61) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to VeeWipe: + animations::TransitionType::VEEWIPE, + animations::TransitionSubType::LEFT, // (62) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::VEEWIPE, + animations::TransitionSubType::UP, // (63) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::VEEWIPE, + animations::TransitionSubType::RIGHT, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + + { + animations::TransitionType::BARNVEEWIPE, + animations::TransitionSubType::TOP, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::BARNVEEWIPE, + animations::TransitionSubType::LEFT, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::BARNVEEWIPE, + animations::TransitionSubType::UP, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::BARNVEEWIPE, + animations::TransitionSubType::RIGHT, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to ZigZagWipe: + animations::TransitionType::ZIGZAGWIPE, + animations::TransitionSubType::LEFTTORIGHT, // (71) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to ZigZagWipe: + animations::TransitionType::ZIGZAGWIPE, + animations::TransitionSubType::TOPTOBOTTOM, // (72) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BarnZigZagWipe: + animations::TransitionType::BARNZIGZAGWIPE, + animations::TransitionSubType::VERTICAL, // (73) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BarnZigZagWipe: + animations::TransitionType::BARNZIGZAGWIPE, + animations::TransitionSubType::HORIZONTAL, // (74) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to IrisWipe: + animations::TransitionType::IRISWIPE, + animations::TransitionSubType::RECTANGLE, // (101) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to IrisWipe: + animations::TransitionType::IRISWIPE, + animations::TransitionSubType::DIAMOND, // (102) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 45.0, // rotation + M_SQRT2, // scaling + M_SQRT2, // scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + + { + // mapped to FigureWipe(triangle): + animations::TransitionType::TRIANGLEWIPE, + animations::TransitionSubType::UP, // (103) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FigureWipe(triangle): + animations::TransitionType::TRIANGLEWIPE, + animations::TransitionSubType::RIGHT, // (104) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FigureWipe(triangle): + animations::TransitionType::TRIANGLEWIPE, + animations::TransitionSubType::DOWN, // (105) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FigureWipe(triangle): + animations::TransitionType::TRIANGLEWIPE, + animations::TransitionSubType::LEFT, // (106) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 270.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to FigureWipe(arrowHead): + animations::TransitionType::ARROWHEADWIPE, + animations::TransitionSubType::UP, // (107) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FigureWipe(arrowHead): + animations::TransitionType::ARROWHEADWIPE, + animations::TransitionSubType::RIGHT, // (108) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FigureWipe(arrowHead): + animations::TransitionType::ARROWHEADWIPE, + animations::TransitionSubType::DOWN, // (109) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FigureWipe(arrowHead): + animations::TransitionType::ARROWHEADWIPE, + animations::TransitionSubType::LEFT, // (110) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 270.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to FigureWipe(pentagon): + animations::TransitionType::PENTAGONWIPE, + animations::TransitionSubType::UP, // (111) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FigureWipe(pentagon): + animations::TransitionType::PENTAGONWIPE, + animations::TransitionSubType::DOWN, // (112) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to FigureWipe(hexagon): + animations::TransitionType::HEXAGONWIPE, + animations::TransitionSubType::HORIZONTAL, // (113) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FigureWipe(hexagon): + animations::TransitionType::HEXAGONWIPE, + animations::TransitionSubType::VERTICAL, // (114) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to EllipseWipe: + animations::TransitionType::ELLIPSEWIPE, + animations::TransitionSubType::CIRCLE, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + true // scale isotrophically to target size + }, + { + // mapped to EllipseWipe: + animations::TransitionType::ELLIPSEWIPE, + animations::TransitionSubType::HORIZONTAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to EllipseWipe: + animations::TransitionType::ELLIPSEWIPE, + animations::TransitionSubType::VERTICAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + + { + animations::TransitionType::EYEWIPE, + animations::TransitionSubType::HORIZONTAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::EYEWIPE, + animations::TransitionSubType::VERTICAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::ROUNDRECTWIPE, + animations::TransitionSubType::HORIZONTAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::ROUNDRECTWIPE, + animations::TransitionSubType::VERTICAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to FigureWipe(star, points=4): + animations::TransitionType::STARWIPE, + animations::TransitionSubType::FOURPOINT, // (127) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FigureWipe(star, points=5): + animations::TransitionType::STARWIPE, + animations::TransitionSubType::FIVEPOINT, // (128) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FigureWipe(star, points=6): + animations::TransitionType::STARWIPE, + animations::TransitionSubType::SIXPOINT, // (129) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + animations::TransitionType::MISCSHAPEWIPE, + animations::TransitionSubType::HEART, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::MISCSHAPEWIPE, + animations::TransitionSubType::KEYHOLE, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to ClockWipe: + animations::TransitionType::CLOCKWIPE, + animations::TransitionSubType::CLOCKWISETWELVE, // (201) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to ClockWipe: + animations::TransitionType::CLOCKWIPE, + animations::TransitionSubType::CLOCKWISETHREE, // (202) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_ROTATE_180, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to ClockWipe: + animations::TransitionType::CLOCKWIPE, + animations::TransitionSubType::CLOCKWISESIX, // (203) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_ROTATE_180, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to ClockWipe: + animations::TransitionType::CLOCKWIPE, + animations::TransitionSubType::CLOCKWISENINE, // (204) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 270.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_ROTATE_180, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to PinWheelWipe: + animations::TransitionType::PINWHEELWIPE, + animations::TransitionSubType::ONEBLADE, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + true // scale isotrophically to target size, like ppt + }, + { + // mapped to PinWheelWipe: + animations::TransitionType::PINWHEELWIPE, + animations::TransitionSubType::TWOBLADEVERTICAL, // (205) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + true // scale isotrophically to target size, like ppt + }, + { + // mapped to PinWheelWipe: + animations::TransitionType::PINWHEELWIPE, + animations::TransitionSubType::TWOBLADEHORIZONTAL, // (206) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + true, // 'out' by parameter sweep inversion + true // scale isotrophically to target size, like ppt + }, + { + // mapped to PinWheelWipe: + animations::TransitionType::PINWHEELWIPE, + animations::TransitionSubType::THREEBLADE, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + true // scale isotrophically to target size, like ppt + }, + { + // mapped to PinWheelWipe: + animations::TransitionType::PINWHEELWIPE, + animations::TransitionSubType::FOURBLADE, // (207) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + true // scale isotrophically to target size, like ppt + }, + { + // mapped to PinWheelWipe: + animations::TransitionType::PINWHEELWIPE, + animations::TransitionSubType::EIGHTBLADE, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + true // scale isotrophically to target size, like ppt + }, + + { + // mapped to SweepWipe (center=true, single=true): + animations::TransitionType::SINGLESWEEPWIPE, + animations::TransitionSubType::CLOCKWISETOP, // (221) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SweepWipe (center=true, single=true): + animations::TransitionType::SINGLESWEEPWIPE, + animations::TransitionSubType::CLOCKWISERIGHT, // (222) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SweepWipe (center=true, single=true): + animations::TransitionType::SINGLESWEEPWIPE, + animations::TransitionSubType::CLOCKWISEBOTTOM, // (223) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SweepWipe (center=true, single=true): + animations::TransitionType::SINGLESWEEPWIPE, + animations::TransitionSubType::CLOCKWISELEFT, // (224) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 270.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SweepWipe (center=false, single=true): + animations::TransitionType::SINGLESWEEPWIPE, + animations::TransitionSubType::CLOCKWISETOPLEFT, // (241) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SweepWipe (center=false, single=true, flipOnYAxis=true): + animations::TransitionType::SINGLESWEEPWIPE, + animations::TransitionSubType::COUNTERCLOCKWISEBOTTOMLEFT, // (242) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SweepWipe (center=false, single=true): + animations::TransitionType::SINGLESWEEPWIPE, + animations::TransitionSubType::CLOCKWISEBOTTOMRIGHT, // (243) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SweepWipe (center=false, single=true, flipOnYAxis=true): + animations::TransitionType::SINGLESWEEPWIPE, + animations::TransitionSubType::COUNTERCLOCKWISETOPRIGHT, // (244) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to FanWipe(center=true): + animations::TransitionType::FANWIPE, + animations::TransitionSubType::CENTERTOP, // (211) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FanWipe(center=true): + animations::TransitionType::FANWIPE, + animations::TransitionSubType::CENTERRIGHT, // (212) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FanWipe: + animations::TransitionType::FANWIPE, + animations::TransitionSubType::TOP, // (231) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FanWipe: + animations::TransitionType::FANWIPE, + animations::TransitionSubType::RIGHT, // (232) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FanWipe: + animations::TransitionType::FANWIPE, + animations::TransitionSubType::BOTTOM, // (233) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FanWipe: + animations::TransitionType::FANWIPE, + animations::TransitionSubType::LEFT, // (234) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to FanWipe(center=true, single=false, fanIn=false): + animations::TransitionType::DOUBLEFANWIPE, + animations::TransitionSubType::FANOUTVERTICAL, // (213) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FanWipe(center=true, single=false, fanIn=false): + animations::TransitionType::DOUBLEFANWIPE, + animations::TransitionSubType::FANOUTHORIZONTAL, // (214) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FanWipe(center=true, single=false, fanIn=true): + animations::TransitionType::DOUBLEFANWIPE, + animations::TransitionSubType::FANINVERTICAL, // (235) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to FanWipe(center=true, single=false, fanIn=true): + animations::TransitionType::DOUBLEFANWIPE, + animations::TransitionSubType::FANINHORIZONTAL, // (236) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to SweepWipe (center=true, single=false): + animations::TransitionType::DOUBLESWEEPWIPE, + animations::TransitionSubType::PARALLELVERTICAL, // (225) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SweepWipe (center=true, single=false): + animations::TransitionType::DOUBLESWEEPWIPE, + animations::TransitionSubType::PARALLELDIAGONAL, // (226) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SweepWipe (center=true, single=false, + // oppositeVertical=true): + animations::TransitionType::DOUBLESWEEPWIPE, + animations::TransitionSubType::OPPOSITEVERTICAL, // (227) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SweepWipe (center=true, single=false, + // oppositeVertical=true): + animations::TransitionType::DOUBLESWEEPWIPE, + animations::TransitionSubType::OPPOSITEHORIZONTAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SweepWipe (center=false, single=false): + animations::TransitionType::DOUBLESWEEPWIPE, + animations::TransitionSubType::PARALLELDIAGONALTOPLEFT, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SweepWipe (center=false, single=false): + animations::TransitionType::DOUBLESWEEPWIPE, + animations::TransitionSubType::PARALLELDIAGONALBOTTOMLEFT, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + animations::TransitionType::SALOONDOORWIPE, + animations::TransitionSubType::TOP, // (251) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::SALOONDOORWIPE, + animations::TransitionSubType::LEFT, // (252) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::SALOONDOORWIPE, + animations::TransitionSubType::BOTTOM, // (253) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::SALOONDOORWIPE, + animations::TransitionSubType::RIGHT, // (254) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::WINDSHIELDWIPE, + animations::TransitionSubType::RIGHT, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::WINDSHIELDWIPE, + animations::TransitionSubType::UP, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::WINDSHIELDWIPE, + animations::TransitionSubType::VERTICAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::WINDSHIELDWIPE, + animations::TransitionSubType::HORIZONTAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to SnakeWipe: + animations::TransitionType::SNAKEWIPE, + animations::TransitionSubType::TOPLEFTHORIZONTAL, // (301) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_ROTATE_180, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SnakeWipe(flipOnYAxis=true): + animations::TransitionType::SNAKEWIPE, + animations::TransitionSubType::TOPLEFTVERTICAL, // (302) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_ROTATE_180, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SnakeWipe(diagonal=true): + animations::TransitionType::SNAKEWIPE, + animations::TransitionSubType::TOPLEFTDIAGONAL, // (303) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_ROTATE_180, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SnakeWipe(diagonal=true, flipOnYAxis=true): + animations::TransitionType::SNAKEWIPE, + animations::TransitionSubType::TOPRIGHTDIAGONAL, // (304) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_ROTATE_180, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SnakeWipe(diagonal=true): + animations::TransitionType::SNAKEWIPE, + animations::TransitionSubType::BOTTOMRIGHTDIAGONAL, // (305) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_ROTATE_180, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SnakeWipe(diagonal=true, flipOnYAxis=true): + animations::TransitionType::SNAKEWIPE, + animations::TransitionSubType::BOTTOMLEFTDIAGONAL, // (306) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_ROTATE_180, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to SpiralWipe: + animations::TransitionType::SPIRALWIPE, + animations::TransitionSubType::TOPLEFTCLOCKWISE, // (310) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SpiralWipe: + animations::TransitionType::SPIRALWIPE, + animations::TransitionSubType::TOPRIGHTCLOCKWISE, // (311) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SpiralWipe: + animations::TransitionType::SPIRALWIPE, + animations::TransitionSubType::BOTTOMRIGHTCLOCKWISE, // (312) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SpiralWipe: + animations::TransitionType::SPIRALWIPE, + animations::TransitionSubType::BOTTOMLEFTCLOCKWISE, // (313) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 270.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SpiralWipe(flipOnYAxis=true): + animations::TransitionType::SPIRALWIPE, + animations::TransitionSubType::TOPLEFTCOUNTERCLOCKWISE, // (314) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SpiralWipe(flipOnYAxis=true): + animations::TransitionType::SPIRALWIPE, + animations::TransitionSubType::TOPRIGHTCOUNTERCLOCKWISE, // (315) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SpiralWipe(flipOnYAxis=true): + animations::TransitionType::SPIRALWIPE, + animations::TransitionSubType::BOTTOMRIGHTCOUNTERCLOCKWISE, // (316) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 270.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to SpiralWipe(flipOnYAxis=true): + animations::TransitionType::SPIRALWIPE, + animations::TransitionSubType::BOTTOMLEFTCOUNTERCLOCKWISE, // (317) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_SUBTRACT_AND_INVERT, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to ParallelSnakesWipe: + animations::TransitionType::PARALLELSNAKESWIPE, + animations::TransitionSubType::VERTICALTOPSAME, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to ParallelSnakesWipe: + animations::TransitionType::PARALLELSNAKESWIPE, + animations::TransitionSubType::VERTICALBOTTOMSAME, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to ParallelSnakesWipe (opposite=true): + animations::TransitionType::PARALLELSNAKESWIPE, + animations::TransitionSubType::VERTICALTOPLEFTOPPOSITE, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to ParallelSnakesWipe (flipOnYAxis=true, opposite=true): + animations::TransitionType::PARALLELSNAKESWIPE, + animations::TransitionSubType::VERTICALBOTTOMLEFTOPPOSITE, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to ParallelSnakesWipe: + animations::TransitionType::PARALLELSNAKESWIPE, + animations::TransitionSubType::HORIZONTALLEFTSAME, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to ParallelSnakesWipe: + animations::TransitionType::PARALLELSNAKESWIPE, + animations::TransitionSubType::HORIZONTALRIGHTSAME, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to ParallelSnakesWipe (flipOnYAxis=true, opposite=true): + animations::TransitionType::PARALLELSNAKESWIPE, + animations::TransitionSubType::HORIZONTALTOPLEFTOPPOSITE, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to ParallelSnakesWipe (opposite=true): + animations::TransitionType::PARALLELSNAKESWIPE, + animations::TransitionSubType::HORIZONTALTOPRIGHTOPPOSITE, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to ParallelSnakesWipe (diagonal=true, opposite=true): + animations::TransitionType::PARALLELSNAKESWIPE, + animations::TransitionSubType::DIAGONALBOTTOMLEFTOPPOSITE, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to ParallelSnakesWipe (diagonal=true, opposite=true, + // flipOnYAxis=true): + animations::TransitionType::PARALLELSNAKESWIPE, + animations::TransitionSubType::DIAGONALTOPLEFTOPPOSITE, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to BoxSnakesWipe: + animations::TransitionType::BOXSNAKESWIPE, + animations::TransitionSubType::TWOBOXTOP, // (340) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BoxSnakesWipe: + animations::TransitionType::BOXSNAKESWIPE, + animations::TransitionSubType::TWOBOXBOTTOM, // (341) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BoxSnakesWipe: + animations::TransitionType::BOXSNAKESWIPE, + animations::TransitionSubType::TWOBOXLEFT, // (342) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BoxSnakesWipe: + animations::TransitionType::BOXSNAKESWIPE, + animations::TransitionSubType::TWOBOXRIGHT, // (343) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 180.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BoxSnakesWipe(fourBox=true): + animations::TransitionType::BOXSNAKESWIPE, + animations::TransitionSubType::FOURBOXVERTICAL, // (344) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to BoxSnakesWipe(fourBox=true): + animations::TransitionType::BOXSNAKESWIPE, + animations::TransitionSubType::FOURBOXHORIZONTAL, // (345) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to WaterfallWipe: + animations::TransitionType::WATERFALLWIPE, + animations::TransitionSubType::VERTICALLEFT, // (350) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_ROTATE_180, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to WaterfallWipe (flipOnYAxis=true): + animations::TransitionType::WATERFALLWIPE, + animations::TransitionSubType::VERTICALRIGHT, // (351) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_ROTATE_180, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to WaterfallWipe (flipOnYAxis=true): + animations::TransitionType::WATERFALLWIPE, + animations::TransitionSubType::HORIZONTALLEFT, // (352) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + -90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_ROTATE_180, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to WaterfallWipe, flipOnYAxis=false: + animations::TransitionType::WATERFALLWIPE, + animations::TransitionSubType::HORIZONTALRIGHT, // (353) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_ROTATE_180, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + animations::TransitionType::PUSHWIPE, + animations::TransitionSubType::FROMLEFT, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::PUSHWIPE, + animations::TransitionSubType::FROMTOP, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::PUSHWIPE, + animations::TransitionSubType::FROMRIGHT, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::PUSHWIPE, + animations::TransitionSubType::FROMBOTTOM, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::PUSHWIPE, + animations::TransitionSubType::FROMBOTTOMRIGHT, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::PUSHWIPE, + animations::TransitionSubType::FROMBOTTOMLEFT, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::PUSHWIPE, + animations::TransitionSubType::FROMTOPRIGHT, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::PUSHWIPE, + animations::TransitionSubType::FROMTOPLEFT, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::PUSHWIPE, + animations::TransitionSubType::COMBHORIZONTAL, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::PUSHWIPE, + animations::TransitionSubType::COMBVERTICAL, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::SLIDEWIPE, + animations::TransitionSubType::FROMLEFT, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, // special code for this transition + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::SLIDEWIPE, + animations::TransitionSubType::FROMTOP, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, // special code for this transition + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::SLIDEWIPE, + animations::TransitionSubType::FROMRIGHT, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, // special code for this transition + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::SLIDEWIPE, + animations::TransitionSubType::FROMBOTTOM, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, // special code for this transition + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::SLIDEWIPE, + animations::TransitionSubType::FROMBOTTOMRIGHT, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, // special code for this transition + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::SLIDEWIPE, + animations::TransitionSubType::FROMTOPRIGHT, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, // special code for this transition + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::SLIDEWIPE, + animations::TransitionSubType::FROMTOPLEFT, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, // special code for this transition + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::SLIDEWIPE, + animations::TransitionSubType::FROMBOTTOMLEFT, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, // special code for this transition + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::FADE, + animations::TransitionSubType::CROSSFADE, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::FADE, + animations::TransitionSubType::FADETOCOLOR, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::FADE, + animations::TransitionSubType::FADEFROMCOLOR, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + animations::TransitionType::FADE, + animations::TransitionSubType::FADEOVERCOLOR, + TransitionInfo::TRANSITION_SPECIAL, + // TODO(F2): Setup parameters + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to RandomWipe: + animations::TransitionType::RANDOMBARWIPE, + animations::TransitionSubType::VERTICAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to RandomWipe: + animations::TransitionType::RANDOMBARWIPE, + animations::TransitionSubType::HORIZONTAL, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to CheckerBoard: + animations::TransitionType::CHECKERBOARDWIPE, + animations::TransitionSubType::DOWN, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 90.0, // rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_Y, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + { + // mapped to CheckerBoard: + animations::TransitionType::CHECKERBOARDWIPE, + animations::TransitionSubType::ACROSS, // (default) + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_FLIP_X, + true, // 'out' by parameter sweep inversion + false // scale isotrophically to target size + }, + + { + // mapped to RandomWipe: + animations::TransitionType::DISSOLVE, + animations::TransitionSubType::DEFAULT, + TransitionInfo::TRANSITION_CLIP_POLYPOLYGON, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + true // scale isotrophically to target size + }, + + ///////////////////////////////////////////////////////// + // NOTE: This entry MUST be the last, to keep + // createSlideTransition() from infinite recursion. Because + // getRandomTransitionInfo() below will exclude the last entry of + // the table from the random number generation. + ///////////////////////////////////////////////////////// + { + // specially handled + animations::TransitionType::RANDOM, + animations::TransitionSubType::DEFAULT, + TransitionInfo::TRANSITION_SPECIAL, + 0.0, // no rotation + 1.0, // no scaling + 1.0, // no scaling + TransitionInfo::REVERSEMETHOD_IGNORE, + true, // 'out' by parameter sweep inversion + true // scale isotrophically to target size + } + ///////////////////////////////////////////////////////// + // NOTE: DON'T add after this entry! See comment above! + ///////////////////////////////////////////////////////// +}; + +} // anon namespace + +const TransitionInfo* TransitionFactory::getTransitionInfo( + sal_Int16 nTransitionType, sal_Int16 nTransitionSubType ) +{ + static const ::std::size_t lcl_tableSize( + sizeof(lcl_transitionInfo)/sizeof(TransitionInfo) ); + static const TransitionInfo* pTableEnd = lcl_transitionInfo+lcl_tableSize; + + const TransitionInfo* pRes = ::std::find_if( + lcl_transitionInfo, pTableEnd, + TransitionInfo::Comparator( nTransitionType, + nTransitionSubType ) ); + if (pRes != pTableEnd) + return pRes; + else + return NULL; +} + +const TransitionInfo* TransitionFactory::getRandomTransitionInfo() +{ + return lcl_transitionInfo + getRandomOrdinal( + sizeof(lcl_transitionInfo) / sizeof(TransitionInfo) + - 1 /* exclude random transition at end of table */ ); +} + +} // namespace internal +} // namespace presentation diff --git a/slideshow/source/engine/transitions/transitiontools.cxx b/slideshow/source/engine/transitions/transitiontools.cxx new file mode 100644 index 000000000000..f57994e3d25c --- /dev/null +++ b/slideshow/source/engine/transitions/transitiontools.cxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include "transitiontools.hxx" +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> + + +namespace slideshow { +namespace internal { + +// TODO(Q2): Move this to basegfx +::basegfx::B2DPolygon createUnitRect() +{ + return ::basegfx::tools::createPolygonFromRect( + ::basegfx::B2DRectangle(0.0,0.0, + 1.0,1.0 ) ); +} + +::basegfx::B2DPolyPolygon flipOnYAxis( + ::basegfx::B2DPolyPolygon const & polypoly ) +{ + ::basegfx::B2DPolyPolygon res(polypoly); + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(-1.0, 1.0, 1.0, 0.0)); + res.flip(); + return res; +} + +::basegfx::B2DPolyPolygon flipOnXAxis( + ::basegfx::B2DPolyPolygon const & polypoly ) +{ + ::basegfx::B2DPolyPolygon res(polypoly); + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(1.0, -1.0, 0.0, 1.0)); + res.flip(); + return res; +} + +} +} diff --git a/slideshow/source/engine/transitions/transitiontools.hxx b/slideshow/source/engine/transitions/transitiontools.hxx new file mode 100644 index 000000000000..4653b2ced6dd --- /dev/null +++ b/slideshow/source/engine/transitions/transitiontools.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SLIDESHOW_TRANSITIONTOOLS_HXX +#define INCLUDED_SLIDESHOW_TRANSITIONTOOLS_HXX + +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> + +#include <algorithm> + + +namespace slideshow { +namespace internal { + +/// Create a unit rect. +::basegfx::B2DPolygon createUnitRect(); + +/// Flips on X-axis: +::basegfx::B2DPolyPolygon flipOnXAxis( + ::basegfx::B2DPolyPolygon const & polypoly ); + +/// Flips on Y-axis: +::basegfx::B2DPolyPolygon flipOnYAxis( + ::basegfx::B2DPolyPolygon const & polypoly ); + +} +} + +#endif /* INCLUDED_SLIDESHOW_TRANSITIONTOOLS_HXX */ diff --git a/slideshow/source/engine/transitions/veewipe.cxx b/slideshow/source/engine/transitions/veewipe.cxx new file mode 100644 index 000000000000..0fa3635a63c6 --- /dev/null +++ b/slideshow/source/engine/transitions/veewipe.cxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include "veewipe.hxx" + + +namespace slideshow { +namespace internal { + +::basegfx::B2DPolyPolygon VeeWipe::operator () ( double t ) +{ + ::basegfx::B2DPolygon poly; + poly.append( ::basegfx::B2DPoint( 0.0, -1.0 ) ); + const double d = ::basegfx::pruneScaleValue( 2.0 * t ); + poly.append( ::basegfx::B2DPoint( 0.0, d - 1.0 ) ); + poly.append( ::basegfx::B2DPoint( 0.5, d ) ); + poly.append( ::basegfx::B2DPoint( 1.0, d - 1.0 ) ); + poly.append( ::basegfx::B2DPoint( 1.0, -1.0 ) ); + poly.setClosed(true); + return ::basegfx::B2DPolyPolygon( poly ); +} + +} +} diff --git a/slideshow/source/engine/transitions/veewipe.hxx b/slideshow/source/engine/transitions/veewipe.hxx new file mode 100644 index 000000000000..0e6771820cd2 --- /dev/null +++ b/slideshow/source/engine/transitions/veewipe.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_VEEWIPE_HXX +#define INCLUDED_SLIDESHOW_VEEWIPE_HXX + +#include <basegfx/polygon/b2dpolypolygon.hxx> + +#include "parametricpolypolygon.hxx" +#include "transitiontools.hxx" + + +namespace slideshow { +namespace internal { + +/// Generate a vee wipe +class VeeWipe : public ParametricPolyPolygon +{ +public: + VeeWipe() {} + virtual ::basegfx::B2DPolyPolygon operator()( double x ); +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_VEEWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/waterfallwipe.cxx b/slideshow/source/engine/transitions/waterfallwipe.cxx new file mode 100644 index 000000000000..b7d55be55bcd --- /dev/null +++ b/slideshow/source/engine/transitions/waterfallwipe.cxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include "waterfallwipe.hxx" +#include "transitiontools.hxx" + + +namespace slideshow { +namespace internal { + +WaterfallWipe::WaterfallWipe( sal_Int32 nElements, bool flipOnYAxis ) + : m_flipOnYAxis( flipOnYAxis ) +{ + const sal_Int32 sqrtElements = static_cast<sal_Int32>( + sqrt( static_cast<double>(nElements) ) ); + const double elementEdge = (1.0 / sqrtElements); + m_waterfall.append( ::basegfx::B2DPoint( 0.0, -1.0 ) ); + for ( sal_Int32 pos = sqrtElements; pos--; ) + { + const sal_Int32 xPos = (sqrtElements - pos - 1); + const double yPos = ::basegfx::pruneScaleValue( ((pos + 1) * elementEdge) - 1.0 ); + m_waterfall.append( ::basegfx::B2DPoint( + ::basegfx::pruneScaleValue( xPos * elementEdge ), + yPos ) ); + m_waterfall.append( ::basegfx::B2DPoint( + ::basegfx::pruneScaleValue( (xPos + 1) * elementEdge ), + yPos ) ); + } + m_waterfall.append( ::basegfx::B2DPoint( 1.0, -1.0 ) ); + m_waterfall.setClosed(true); +} + +::basegfx::B2DPolyPolygon WaterfallWipe::operator () ( double t ) +{ + ::basegfx::B2DPolygon poly( m_waterfall ); + poly.transform(basegfx::tools::createTranslateB2DHomMatrix(0.0, ::basegfx::pruneScaleValue(2.0 * t))); + poly.setB2DPoint( 0, ::basegfx::B2DPoint( 0.0, -1.0 ) ); + poly.setB2DPoint( poly.count()-1, ::basegfx::B2DPoint( 1.0, -1.0 ) ); + + return m_flipOnYAxis ? flipOnYAxis( ::basegfx::B2DPolyPolygon(poly) ) + : ::basegfx::B2DPolyPolygon(poly); +} + +} +} diff --git a/slideshow/source/engine/transitions/waterfallwipe.hxx b/slideshow/source/engine/transitions/waterfallwipe.hxx new file mode 100644 index 000000000000..bffc5227f4da --- /dev/null +++ b/slideshow/source/engine/transitions/waterfallwipe.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_WATERFALLWIPE_HXX +#define INCLUDED_SLIDESHOW_WATERFALLWIPE_HXX + +#include "parametricpolypolygon.hxx" +#include <basegfx/polygon/b2dpolygon.hxx> + + +namespace slideshow { +namespace internal { + +/// Generate a vertical left waterfall wipe +class WaterfallWipe : public ParametricPolyPolygon +{ +public: + WaterfallWipe( sal_Int32 nElements, bool flipOnYAxis = false ); + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +private: + bool m_flipOnYAxis; + ::basegfx::B2DPolygon m_waterfall; +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_WATERFALLWIPE_HXX */ diff --git a/slideshow/source/engine/transitions/zigzagwipe.cxx b/slideshow/source/engine/transitions/zigzagwipe.cxx new file mode 100644 index 000000000000..478024999c61 --- /dev/null +++ b/slideshow/source/engine/transitions/zigzagwipe.cxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_slideshow.hxx" + +#include <canvas/debug.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include "transitiontools.hxx" +#include "zigzagwipe.hxx" + + +namespace slideshow { +namespace internal { + +ZigZagWipe::ZigZagWipe( sal_Int32 nZigs ) : m_zigEdge( 1.0 / nZigs ) +{ + const double d = m_zigEdge; + const double d2 = (d / 2.0); + m_stdZigZag.append( ::basegfx::B2DPoint( -1.0 - d, -d ) ); + m_stdZigZag.append( ::basegfx::B2DPoint( -1.0 - d, 1.0 + d ) ); + m_stdZigZag.append( ::basegfx::B2DPoint( -d, 1.0 + d ) ); + for ( sal_Int32 pos = (nZigs + 2); pos--; ) { + m_stdZigZag.append( ::basegfx::B2DPoint( 0.0, ((pos - 1) * d) + d2 ) ); + m_stdZigZag.append( ::basegfx::B2DPoint( -d, (pos - 1) * d ) ); + } + m_stdZigZag.setClosed(true); +} + +::basegfx::B2DPolyPolygon ZigZagWipe::operator () ( double t ) +{ + ::basegfx::B2DPolyPolygon res(m_stdZigZag); + res.transform(basegfx::tools::createTranslateB2DHomMatrix((1.0 + m_zigEdge) * t, 0.0)); + return res; +} + +::basegfx::B2DPolyPolygon BarnZigZagWipe::operator () ( double t ) +{ + ::basegfx::B2DPolyPolygon res( createUnitRect() ); + ::basegfx::B2DPolygon poly( m_stdZigZag ); + poly.flip(); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix( + (1.0 + m_zigEdge) * (1.0 - t) / 2.0, 0.0)); + poly.transform( aTransform ); + res.append( poly ); + aTransform.scale( -1.0, 1.0 ); + aTransform.translate( 1.0, m_zigEdge / 2.0 ); + poly = m_stdZigZag; + poly.transform( aTransform ); + res.append( poly ); + return res; +} + +} +} diff --git a/slideshow/source/engine/transitions/zigzagwipe.hxx b/slideshow/source/engine/transitions/zigzagwipe.hxx new file mode 100644 index 000000000000..ab08cfbdada4 --- /dev/null +++ b/slideshow/source/engine/transitions/zigzagwipe.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_SLIDESHOW_ZIGZAGWIPE_HXX +#define INCLUDED_SLIDESHOW_ZIGZAGWIPE_HXX + +#include "parametricpolypolygon.hxx" +#include <basegfx/polygon/b2dpolygon.hxx> + + +namespace slideshow { +namespace internal { + +/// Generates a left to right zigZag wipe: +class ZigZagWipe : public ParametricPolyPolygon +{ +public: + ZigZagWipe( sal_Int32 nZigs ); + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +protected: + const double m_zigEdge; + ::basegfx::B2DPolygon m_stdZigZag; +}; + +/// Generates a vertical barnZigZag wipe: +class BarnZigZagWipe : public ZigZagWipe +{ +public: + BarnZigZagWipe( sal_Int32 nZigs ) : ZigZagWipe(nZigs) {} + virtual ::basegfx::B2DPolyPolygon operator () ( double t ); +}; + +} +} + +#endif /* INCLUDED_SLIDESHOW_ZIGZAGWIPE_HXX */ |