Bump version to 6.4-15
[LibreOffice.git] / include / vcl / animate / Animation.hxx
blobc606fb7a85fea4bf2378fd851cafb084fb039ea4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_ANIMATE_ANIMATION_HXX
21 #define INCLUDED_VCL_ANIMATE_ANIMATION_HXX
23 #include <vcl/dllapi.h>
24 #include <vcl/timer.hxx>
25 #include <vcl/animate/AnimationBitmap.hxx>
27 #define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
29 class ImplAnimView;
31 class VCL_DLLPUBLIC Animation
33 public:
34 Animation();
35 Animation(const Animation& rAnimation);
36 ~Animation();
38 Animation& operator=(const Animation& rAnimation);
39 bool operator==(const Animation& rAnimation) const;
40 bool operator!=(const Animation& rAnimation) const { return !(*this == rAnimation); }
42 void Clear();
44 bool Start(OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz, long nExtraData,
45 OutputDevice* pFirstFrameOutDev);
47 void Stop(OutputDevice* pOutDev = nullptr, long nExtraData = 0);
49 void Draw(OutputDevice* pOutDev, const Point& rDestPt) const;
50 void Draw(OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz) const;
52 bool IsInAnimation() const { return mbIsInAnimation; }
53 bool IsTransparent() const;
55 const Size& GetDisplaySizePixel() const { return maGlobalSize; }
56 void SetDisplaySizePixel(const Size& rSize) { maGlobalSize = rSize; }
58 const BitmapEx& GetBitmapEx() const { return maBitmapEx; }
59 void SetBitmapEx(const BitmapEx& rBmpEx) { maBitmapEx = rBmpEx; }
61 sal_uInt32 GetLoopCount() const { return mnLoopCount; }
62 void SetLoopCount(const sal_uInt32 nLoopCount);
63 void ResetLoopCount();
65 void SetNotifyHdl(const Link<Animation*, void>& rLink) { maNotifyLink = rLink; }
66 const Link<Animation*, void>& GetNotifyHdl() const { return maNotifyLink; }
68 std::vector<std::unique_ptr<AnimationBitmap>>& GetAnimationFrames() { return maList; }
69 size_t Count() const { return maList.size(); }
70 bool Insert(const AnimationBitmap& rAnimationBitmap);
71 const AnimationBitmap& Get(sal_uInt16 nAnimation) const;
72 void Replace(const AnimationBitmap& rNewAnimationBmp, sal_uInt16 nAnimation);
74 sal_uLong GetSizeBytes() const;
75 BitmapChecksum GetChecksum() const;
77 public:
78 void Convert(BmpConversion eConversion);
79 bool ReduceColors(sal_uInt16 nNewColorCount);
81 bool Invert();
82 void Mirror(BmpMirrorFlags nMirrorFlags);
83 void Adjust(short nLuminancePercent, short nContrastPercent, short nChannelRPercent,
84 short nChannelGPercent, short nChannelBPercent, double fGamma = 1.0,
85 bool bInvert = false);
87 friend SvStream& ReadAnimation(SvStream& rIStream, Animation& rAnimation);
88 friend SvStream& WriteAnimation(SvStream& rOStream, const Animation& rAnimation);
90 public:
91 SAL_DLLPRIVATE static void ImplIncAnimCount() { mnAnimCount++; }
92 SAL_DLLPRIVATE static void ImplDecAnimCount() { mnAnimCount--; }
93 SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnPos; }
95 private:
96 SAL_DLLPRIVATE static sal_uLong mnAnimCount;
98 std::vector<std::unique_ptr<AnimationBitmap>> maList;
99 std::vector<std::unique_ptr<ImplAnimView>> maViewList;
101 Link<Animation*, void> maNotifyLink;
102 BitmapEx maBitmapEx;
103 Timer maTimer;
104 Size maGlobalSize;
105 sal_uInt32 mnLoopCount;
106 sal_uInt32 mnLoops;
107 size_t mnPos;
108 bool mbIsInAnimation;
109 bool mbLoopTerminated;
111 SAL_DLLPRIVATE void ImplRestartTimer(sal_uLong nTimeout);
112 DECL_DLLPRIVATE_LINK(ImplTimeoutHdl, Timer*, void);
115 #endif // INCLUDED_VCL_ANIMATE_ANIMATION_HXX
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */