13#include "kwin_export.h"
16#include <QEasingCurve>
17#include <QElapsedTimer>
48 explicit FPx2(
const QPoint &other)
54 explicit FPx2(
const QPointF &other)
60 explicit FPx2(
const QSize &other)
63 f[1] = other.height();
66 explicit FPx2(
const QSizeF &other)
69 f[1] = other.height();
88 ret = QString::number(f[0]) + QLatin1Char(
',') + QString::number(f[1]);
129 return f1[0] == f2[0] && f1[1] == f2[1];
133 return f1[0] != f2[0] || f1[1] != f2[1];
137 return FPx2(f1[0] + f2[0], f1[1] + f2[1]);
141 return FPx2(f1[0] - f2[0], f1[1] - f2[1]);
145 return FPx2(f[0] * fl, f[1] * fl);
149 return FPx2(f[0] * fl, f[1] * fl);
153 return FPx2(-f[0], -f[1]);
157 return FPx2(f[0] / fl, f[1] / fl);
165 inline void set(
float v1,
float v2)
178class AnimationEffectPrivate;
230 NonFloatBase = Position
263 DontTerminate = 0x00,
269 TerminateAtSource = 0x01,
274 TerminateAtTarget = 0x02
276 Q_DECLARE_FLAGS(TerminationFlags, TerminationFlag)
277 Q_FLAG(TerminationFlags)
296 bool isActive()
const override;
312 static int metaData(MetaType type, uint meta);
322 static void setMetaData(MetaType type, uint value, uint &meta);
325 QString debug(
const QString ¶meter)
const override;
328 void postPaintScreen()
override;
337 progress = 2 * progress - 1;
338 progress *= -5 * progress;
339 return qExp(progress);
347 return s_clock.elapsed();
376 quint64
animate(
EffectWindow *w,
Attribute a, uint meta,
int ms,
const FPx2 &to,
const QEasingCurve &curve = QEasingCurve(),
int delay = 0,
const FPx2 &from =
FPx2(),
bool fullScreen =
false,
bool keepAlive =
true,
GLShader *shader =
nullptr)
378 return p_animate(w, a, meta, ms, to, curve, delay, from,
false, fullScreen, keepAlive, shader);
409 quint64
set(
EffectWindow *w,
Attribute a, uint meta,
int ms,
const FPx2 &to,
const QEasingCurve &curve = QEasingCurve(),
int delay = 0,
const FPx2 &from =
FPx2(),
bool fullScreen =
false,
bool keepAlive =
true,
GLShader *shader =
nullptr)
411 return p_animate(w, a, meta, ms, to, curve, delay, from,
true, fullScreen, keepAlive, shader);
427 bool retarget(quint64 animationId,
FPx2 newTarget,
int newRemainingTime = -1);
429 bool freezeInTime(quint64 animationId, qint64 frozenTime);
443 bool redirect(quint64 animationId,
445 TerminationFlags terminationFlags = TerminateAtSource);
455 bool complete(quint64 animationId);
468 virtual void animationEnded(
EffectWindow *w, Attribute a, uint meta);
482 bool cancel(quint64 animationId);
501 typedef QMap<EffectWindow *, QPair<QList<AniData>, QRect>>
AniMap;
509 quint64 p_animate(
EffectWindow *w,
Attribute a, uint meta,
int ms,
FPx2 to,
const QEasingCurve &curve,
int delay,
FPx2 from,
bool keepAtTarget,
bool fullScreenEffect,
bool keepAlive,
GLShader *shader);
510 QRect clipRect(
const QRect &windowRect,
const AniData &)
const;
511 float interpolated(
const AniData &,
int i = 0)
const;
512 float progress(
const AniData &)
const;
513 void updateLayerRepaints();
518 void triggerRepaint();
524 static QElapsedTimer s_clock;
525 const std::unique_ptr<AnimationEffectPrivate> d_ptr;
533Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::AnimationEffect::TerminationFlags)
@ Forward
The animation goes from source to target.
quint64 set(EffectWindow *w, Attribute a, uint meta, int ms, const FPx2 &to, const QEasingCurve &curve=QEasingCurve(), int delay=0, const FPx2 &from=FPx2(), bool fullScreen=false, bool keepAlive=true, GLShader *shader=nullptr)
QMap< EffectWindow *, QPair< QList< AniData >, QRect > > AniMap
quint64 animate(EffectWindow *w, Attribute a, uint meta, int ms, const FPx2 &to, const QEasingCurve &curve=QEasingCurve(), int delay=0, const FPx2 &from=FPx2(), bool fullScreen=false, bool keepAlive=true, GLShader *shader=nullptr)
static qreal qecGaussian(qreal progress)
Representation of a window used by/for Effect classes.
FPx2(const QPointF &other)
FPx2 & operator=(const FPx2 &other)
FPx2(const QPoint &other)
friend bool operator==(const FPx2 &f1, const FPx2 &f2)
FPx2 & operator*=(float fl)
FPx2 & operator/=(float fl)
void set(float v1, float v2)
FPx2 & operator-=(const FPx2 &other)
friend bool operator!=(const FPx2 &f1, const FPx2 &f2)
friend const FPx2 operator-(const FPx2 &f1, const FPx2 &f2)
friend const FPx2 operator*(const FPx2 &f, float fl)
friend const FPx2 operator+(const FPx2 &f1, const FPx2 &f2)
float operator[](int n) const
FPx2 & operator+=(const FPx2 &other)
friend const FPx2 operator-(const FPx2 &f)
friend const FPx2 operator*(float fl, const FPx2 &f)
friend const FPx2 operator/(const FPx2 &f, float fl)
FPx2(const QSizeF &other)