LibreOffice Module vcl (master) 1
Animation.hxx
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#ifndef INCLUDED_VCL_ANIMATE_ANIMATION_HXX
21#define INCLUDED_VCL_ANIMATE_ANIMATION_HXX
22
23#include <tools/solar.h>
24#include <vcl/dllapi.h>
25#include <vcl/timer.hxx>
27
28#define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
29
31struct AnimationData;
32
34{
35public:
36 Animation();
37 Animation(const Animation& rAnimation);
38 ~Animation();
39
40 Animation& operator=(const Animation& rAnimation);
41 bool operator==(const Animation& rAnimation) const;
42 bool operator!=(const Animation& rAnimation) const { return !(*this == rAnimation); }
43
44 void Clear();
45
46 bool Start(OutputDevice& rOutDev, const Point& rDestPt, const Size& rDestSz,
47 tools::Long nRendererId, OutputDevice* pFirstFrameOutDev);
48
49 void Stop(const OutputDevice* pOutDev = nullptr, tools::Long nRendererId = 0);
50
51 void Draw(OutputDevice& rOutDev, const Point& rDestPt) const;
52 void Draw(OutputDevice& rOutDev, const Point& rDestPt, const Size& rDestSz) const;
53
54 bool IsInAnimation() const { return mbIsInAnimation; }
55 bool IsTransparent() const;
56
57 const Size& GetDisplaySizePixel() const { return maGlobalSize; }
58 void SetDisplaySizePixel(const Size& rSize) { maGlobalSize = rSize; }
59
60 const BitmapEx& GetBitmapEx() const { return maBitmapEx; }
61 void SetBitmapEx(const BitmapEx& rBmpEx) { maBitmapEx = rBmpEx; }
62
63 sal_uInt32 GetLoopCount() const { return mnLoopCount; }
64 void SetLoopCount(const sal_uInt32 nLoopCount);
65 void ResetLoopCount();
66
67 void SetNotifyHdl(const Link<Animation*, void>& rLink) { maNotifyLink = rLink; }
68 const Link<Animation*, void>& GetNotifyHdl() const { return maNotifyLink; }
69
70 std::vector<std::unique_ptr<AnimationFrame>>& GetAnimationFrames() { return maFrames; }
71 size_t Count() const { return maFrames.size(); }
72 bool Insert(const AnimationFrame& rAnimationFrame);
73 const AnimationFrame& Get(sal_uInt16 nAnimation) const;
74 void Replace(const AnimationFrame& rNewAnimationBmp, sal_uInt16 nAnimation);
75
76 sal_uLong GetSizeBytes() const;
77 BitmapChecksum GetChecksum() const;
78
79public:
80 void Convert(BmpConversion eConversion);
81 bool ReduceColors(sal_uInt16 nNewColorCount);
82
83 bool Invert();
84 void Mirror(BmpMirrorFlags nMirrorFlags);
85 void Adjust(short nLuminancePercent, short nContrastPercent, short nChannelRPercent,
86 short nChannelGPercent, short nChannelBPercent, double fGamma = 1.0,
87 bool bInvert = false);
88
89 friend SvStream& ReadAnimation(SvStream& rIStream, Animation& rAnimation);
90 friend SvStream& WriteAnimation(SvStream& rOStream, const Animation& rAnimation);
91
92public:
93 SAL_DLLPRIVATE static void ImplIncAnimCount() { mnAnimCount++; }
94 SAL_DLLPRIVATE static void ImplDecAnimCount() { mnAnimCount--; }
95 SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnFrameIndex; }
96
97private:
98 SAL_DLLPRIVATE static sal_uLong mnAnimCount;
99
100 std::vector<std::unique_ptr<AnimationFrame>> maFrames;
101 std::vector<std::unique_ptr<AnimationRenderer>> maRenderers;
102
107 sal_uInt32 mnLoopCount;
108 sal_uInt32 mnLoops;
112
113 SAL_DLLPRIVATE std::vector<std::unique_ptr<AnimationData>> CreateAnimationDataItems();
114 SAL_DLLPRIVATE void PopulateRenderers();
115 SAL_DLLPRIVATE void RenderNextFrameInAllRenderers();
116 SAL_DLLPRIVATE void PruneMarkedRenderers();
117 SAL_DLLPRIVATE bool IsAnyRendererActive();
118
119 SAL_DLLPRIVATE void ImplRestartTimer(sal_uLong nTimeout);
120 DECL_DLLPRIVATE_LINK(ImplTimeoutHdl, Timer*, void);
121};
122
123#endif // INCLUDED_VCL_ANIMATE_ANIMATION_HXX
124
125/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvStream & ReadAnimation(SvStream &rIStm, Animation &rAnimation)
Definition: Animation.cxx:634
SvStream & WriteAnimation(SvStream &rOStm, const Animation &rAnimation)
Definition: Animation.cxx:588
sal_uInt64 BitmapChecksum
Definition: checksum.hxx:30
const BitmapEx & GetBitmapEx() const
Definition: Animation.hxx:60
static SAL_DLLPRIVATE sal_uLong mnAnimCount
Definition: Animation.hxx:98
SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const
Definition: Animation.hxx:95
size_t Count() const
Definition: Animation.hxx:71
static SAL_DLLPRIVATE void ImplIncAnimCount()
Definition: Animation.hxx:93
const Size & GetDisplaySizePixel() const
Definition: Animation.hxx:57
size_t mnFrameIndex
Definition: Animation.hxx:109
void SetBitmapEx(const BitmapEx &rBmpEx)
Definition: Animation.hxx:61
std::vector< std::unique_ptr< AnimationRenderer > > maRenderers
Definition: Animation.hxx:101
DECL_DLLPRIVATE_LINK(ImplTimeoutHdl, Timer *, void)
bool mbIsInAnimation
Definition: Animation.hxx:110
sal_uInt32 mnLoopCount
Definition: Animation.hxx:107
const Link< Animation *, void > & GetNotifyHdl() const
Definition: Animation.hxx:68
bool operator!=(const Animation &rAnimation) const
Definition: Animation.hxx:42
BitmapEx maBitmapEx
Definition: Animation.hxx:104
Timer maTimer
Definition: Animation.hxx:105
Size maGlobalSize
Definition: Animation.hxx:106
std::vector< std::unique_ptr< AnimationFrame > > & GetAnimationFrames()
Definition: Animation.hxx:70
bool mbLoopTerminated
Definition: Animation.hxx:111
sal_uInt32 GetLoopCount() const
Definition: Animation.hxx:63
void SetDisplaySizePixel(const Size &rSize)
Definition: Animation.hxx:58
static SAL_DLLPRIVATE void ImplDecAnimCount()
Definition: Animation.hxx:94
void SetNotifyHdl(const Link< Animation *, void > &rLink)
Definition: Animation.hxx:67
Link< Animation *, void > maNotifyLink
Definition: Animation.hxx:103
std::vector< std::unique_ptr< AnimationFrame > > maFrames
Definition: Animation.hxx:100
sal_uInt32 mnLoops
Definition: Animation.hxx:108
bool IsInAnimation() const
Definition: Animation.hxx:54
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
Definition: timer.hxx:27
virtual void Insert(SotClipboardFormatId nFormat, const OUString &rFormatName) override
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
aCursorMoveIdle Stop()
BmpMirrorFlags
::std::size_t mnLoopCount
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
void Clear(EHistoryType eHistory)
long Long
sal_uIntPtr sal_uLong
bool operator==(const ItalicMatrix &a, const ItalicMatrix &b)
Definition: vclenum.hxx:182