LibreOffice Module slideshow (master) 1
waterfallwipe.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
24#include "waterfallwipe.hxx"
25#include "transitiontools.hxx"
26
27
28namespace slideshow::internal {
29
30WaterfallWipe::WaterfallWipe( sal_Int32 nElements, bool flipOnYAxis )
31 : m_flipOnYAxis( flipOnYAxis )
32{
33 const sal_Int32 sqrtElements = static_cast<sal_Int32>(
34 sqrt( static_cast<double>(nElements) ) );
35 const double elementEdge = 1.0 / sqrtElements;
37 for ( sal_Int32 pos = sqrtElements; pos--; )
38 {
39 const sal_Int32 xPos = sqrtElements - pos - 1;
40 const double yPos = ::basegfx::pruneScaleValue( ((pos + 1) * elementEdge) - 1.0 );
42 ::basegfx::pruneScaleValue( xPos * elementEdge ),
43 yPos ) );
45 ::basegfx::pruneScaleValue( (xPos + 1) * elementEdge ),
46 yPos ) );
47 }
50}
51
53{
55 poly.transform(basegfx::utils::createTranslateB2DHomMatrix(0.0, ::basegfx::pruneScaleValue(2.0 * t)));
56 poly.setB2DPoint( 0, ::basegfx::B2DPoint( 0.0, -1.0 ) );
57 poly.setB2DPoint( poly.count()-1, ::basegfx::B2DPoint( 1.0, -1.0 ) );
58
61}
62
63}
64
65/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XPropertyListType t
void setB2DPoint(sal_uInt32 nIndex, const basegfx::B2DPoint &rValue)
void transform(const basegfx::B2DHomMatrix &rMatrix)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
sal_uInt32 count() const
void setClosed(bool bNew)
WaterfallWipe(sal_Int32 nElements, bool flipOnYAxis)
::basegfx::B2DPolygon m_waterfall
virtual ::basegfx::B2DPolyPolygon operator()(double t) override
Retrieve the poly-polygon for value t.
sal_Int32 nElements
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
::basegfx::B2DPolyPolygon flipOnYAxis(::basegfx::B2DPolyPolygon const &polypoly)
Flips on Y-axis:
size_t pos