1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_HXX
21 #define INCLUDED_VCL_ANIMATE_HXX
23 #include <vcl/dllapi.h>
24 #include <vcl/timer.hxx>
25 #include <vcl/bitmapex.hxx>
26 #include <vcl/vclptr.hxx>
28 #define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
37 struct VCL_DLLPUBLIC AnimationBitmap
48 , eDisposal(Disposal::Not
)
53 const BitmapEx
& rBmpEx
,
57 Disposal _eDisposal
= Disposal::Not
61 aSizePix ( rSizePix
),
63 eDisposal ( _eDisposal
),
67 bool operator==( const AnimationBitmap
& rAnimBmp
) const
69 return( rAnimBmp
.aBmpEx
== aBmpEx
&&
70 rAnimBmp
.aPosPix
== aPosPix
&&
71 rAnimBmp
.aSizePix
== aSizePix
&&
72 rAnimBmp
.nWait
== nWait
&&
73 rAnimBmp
.eDisposal
== eDisposal
&&
74 rAnimBmp
.bUserInput
== bUserInput
);
77 bool operator!=( const AnimationBitmap
& rAnimBmp
) const
78 { return !( *this == rAnimBmp
); }
81 BitmapChecksum
GetChecksum() const;
86 class VCL_DLLPUBLIC Animation
90 Animation( const Animation
& rAnimation
);
93 Animation
& operator=( const Animation
& rAnimation
);
94 bool operator==( const Animation
& rAnimation
) const;
95 bool operator!=( const Animation
& rAnimation
) const
96 { return !(*this==rAnimation
); }
101 OutputDevice
* pOutDev
,
102 const Point
& rDestPt
,
105 OutputDevice
* pFirstFrameOutDev
);
107 void Stop( OutputDevice
* pOutDev
= nullptr, long nExtraData
= 0 );
109 void Draw( OutputDevice
* pOutDev
, const Point
& rDestPt
) const;
110 void Draw( OutputDevice
* pOutDev
, const Point
& rDestPt
, const Size
& rDestSz
) const;
112 bool IsInAnimation() const { return mbIsInAnimation
; }
113 bool IsTransparent() const;
115 const Size
& GetDisplaySizePixel() const { return maGlobalSize
; }
116 void SetDisplaySizePixel( const Size
& rSize
) { maGlobalSize
= rSize
; }
118 const BitmapEx
& GetBitmapEx() const { return maBitmapEx
; }
119 void SetBitmapEx( const BitmapEx
& rBmpEx
) { maBitmapEx
= rBmpEx
; }
121 sal_uLong
GetLoopCount() const { return mnLoopCount
; }
122 void SetLoopCount( const sal_uLong nLoopCount
);
123 void ResetLoopCount();
125 void SetNotifyHdl( const Link
<Animation
*,void>& rLink
) { maNotifyLink
= rLink
; }
126 const Link
<Animation
*,void>& GetNotifyHdl() const { return maNotifyLink
; }
128 size_t Count() const { return maList
.size(); }
129 bool Insert( const AnimationBitmap
& rAnimationBitmap
);
130 const AnimationBitmap
&
131 Get( sal_uInt16 nAnimation
) const;
132 void Replace( const AnimationBitmap
& rNewAnimationBmp
, sal_uInt16 nAnimation
);
134 sal_uLong
GetSizeBytes() const;
135 BitmapChecksum
GetChecksum() const;
139 bool Convert( BmpConversion eConversion
);
140 bool ReduceColors( sal_uInt16 nNewColorCount
);
143 bool Mirror( BmpMirrorFlags nMirrorFlags
);
145 short nLuminancePercent
,
146 short nContrastPercent
,
147 short nChannelRPercent
,
148 short nChannelGPercent
,
149 short nChannelBPercent
,
151 bool bInvert
= false );
155 const BmpFilterParam
* pFilterParam
= nullptr );
157 friend VCL_DLLPUBLIC SvStream
& ReadAnimation( SvStream
& rIStream
, Animation
& rAnimation
);
158 friend VCL_DLLPUBLIC SvStream
& WriteAnimation( SvStream
& rOStream
, const Animation
& rAnimation
);
162 SAL_DLLPRIVATE
static void
163 ImplIncAnimCount() { mnAnimCount
++; }
164 SAL_DLLPRIVATE
static void
165 ImplDecAnimCount() { mnAnimCount
--; }
166 SAL_DLLPRIVATE sal_uLong
167 ImplGetCurPos() const { return mnPos
; }
170 SAL_DLLPRIVATE
static sal_uLong mnAnimCount
;
172 std::vector
< AnimationBitmap
* > maList
;
173 std::vector
< ImplAnimView
* > maViewList
;
175 Link
<Animation
*,void> maNotifyLink
;
182 bool mbIsInAnimation
;
183 bool mbLoopTerminated
;
185 SAL_DLLPRIVATE
void ImplRestartTimer( sal_uLong nTimeout
);
186 DECL_DLLPRIVATE_LINK( ImplTimeoutHdl
, Timer
*, void );
190 #endif // INCLUDED_VCL_ANIMATE_HXX
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */