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 _SV_ANIMATE_HXX
21 #define _SV_ANIMATE_HXX
23 #include <vcl/dllapi.h>
24 #include <vcl/timer.hxx>
25 #include <vcl/bitmapex.hxx>
27 #define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
46 struct VCL_DLLPUBLIC AnimationBitmap
57 const BitmapEx
& rBmpEx
,
61 Disposal _eDisposal
= DISPOSE_NOT
65 aSizePix ( rSizePix
),
67 eDisposal ( _eDisposal
),
68 bUserInput ( sal_False
)
71 sal_Bool
operator==( const AnimationBitmap
& rAnimBmp
) const
73 return( rAnimBmp
.aBmpEx
== aBmpEx
&&
74 rAnimBmp
.aPosPix
== aPosPix
&&
75 rAnimBmp
.aSizePix
== aSizePix
&&
76 rAnimBmp
.nWait
== nWait
&&
77 rAnimBmp
.eDisposal
== eDisposal
&&
78 rAnimBmp
.bUserInput
== bUserInput
);
81 sal_Bool
operator!=( const AnimationBitmap
& rAnimBmp
) const
82 { return !( *this == rAnimBmp
); }
84 sal_Bool
IsEqual( const AnimationBitmap
& rAnimBmp
) const
86 return( rAnimBmp
.aPosPix
== aPosPix
&&
87 rAnimBmp
.aSizePix
== aSizePix
&&
88 rAnimBmp
.nWait
== nWait
&&
89 rAnimBmp
.eDisposal
== eDisposal
&&
90 rAnimBmp
.bUserInput
== bUserInput
&&
91 rAnimBmp
.aBmpEx
.IsEqual( aBmpEx
) );
94 sal_uLong
GetChecksum() const;
99 Bitmap aLastSaveBitmap
;
103 Point aLastSavePoint
;
106 OutputDevice
* pOutDev
;
112 AInfo() : pOutDev( NULL
),
115 bWithSize( sal_False
),
116 bPause( sal_False
) {}
120 typedef ::std::vector
< AnimationBitmap
* > AnimationBitmapList_impl
;
121 typedef ::std::vector
< ImplAnimView
* > AnimViewList_impl
;
123 class VCL_DLLPUBLIC Animation
125 SAL_DLLPRIVATE
static sal_uLong mnAnimCount
;
127 AnimationBitmapList_impl maList
;
128 AnimViewList_impl maViewList
;
137 Disposal meLastDisposal
;
138 CycleMode meCycleMode
;
140 sal_Bool mbIsInAnimation
;
142 sal_Bool mbLoopTerminated
;
143 sal_Bool mbIsWaiting
;
146 SAL_DLLPRIVATE
void ImplRestartTimer( sal_uLong nTimeout
);
147 DECL_DLLPRIVATE_LINK( ImplTimeoutHdl
, void* );
151 SAL_DLLPRIVATE
static void ImplIncAnimCount() { mnAnimCount
++; }
152 SAL_DLLPRIVATE
static void ImplDecAnimCount() { mnAnimCount
--; }
153 SAL_DLLPRIVATE sal_uLong
ImplGetCurPos() const { return mnPos
; }
158 Animation( const Animation
& rAnimation
);
161 Animation
& operator=( const Animation
& rAnimation
);
162 sal_Bool
operator==( const Animation
& rAnimation
) const;
163 sal_Bool
operator!=( const Animation
& rAnimation
) const
164 { return !(*this==rAnimation
); }
169 OutputDevice
* pOutDev
,
170 const Point
& rDestPt
,
173 OutputDevice
* pFirstFrameOutDev
= NULL
175 void Stop( OutputDevice
* pOutDev
= NULL
, long nExtraData
= 0 );
177 void Draw( OutputDevice
* pOutDev
, const Point
& rDestPt
) const;
178 void Draw( OutputDevice
* pOutDev
, const Point
& rDestPt
, const Size
& rDestSz
) const;
180 sal_Bool
IsInAnimation() const { return mbIsInAnimation
; }
181 sal_Bool
IsTransparent() const;
182 sal_Bool
IsTerminated() const { return mbLoopTerminated
; }
184 const Size
& GetDisplaySizePixel() const { return maGlobalSize
; }
185 void SetDisplaySizePixel( const Size
& rSize
) { maGlobalSize
= rSize
; }
187 const BitmapEx
& GetBitmapEx() const { return maBitmapEx
; }
188 void SetBitmapEx( const BitmapEx
& rBmpEx
) { maBitmapEx
= rBmpEx
; }
190 sal_uLong
GetLoopCount() const { return mnLoopCount
; }
191 void SetLoopCount( const sal_uLong nLoopCount
);
192 void ResetLoopCount();
194 void SetCycleMode( CycleMode eMode
);
195 CycleMode
GetCycleMode() const { return meCycleMode
; }
197 void SetNotifyHdl( const Link
& rLink
) { maNotifyLink
= rLink
; }
198 const Link
& GetNotifyHdl() const { return maNotifyLink
; }
200 size_t Count() const { return maList
.size(); }
201 sal_Bool
Insert( const AnimationBitmap
& rAnimationBitmap
);
202 const AnimationBitmap
& Get( sal_uInt16 nAnimation
) const;
203 void Replace( const AnimationBitmap
& rNewAnimationBmp
, sal_uInt16 nAnimation
);
205 sal_uLong
GetSizeBytes() const;
206 sal_uLong
GetChecksum() const;
210 sal_Bool
Convert( BmpConversion eConversion
);
211 sal_Bool
ReduceColors(
212 sal_uInt16 nNewColorCount
,
213 BmpReduce eReduce
= BMP_REDUCE_SIMPLE
216 sal_Bool
Mirror( sal_uLong nMirrorFlags
);
218 short nLuminancePercent
= 0,
219 short nContrastPercent
= 0,
220 short nChannelRPercent
= 0,
221 short nChannelGPercent
= 0,
222 short nChannelBPercent
= 0,
224 sal_Bool bInvert
= sal_False
228 const BmpFilterParam
* pFilterParam
= NULL
,
229 const Link
* pProgress
= NULL
232 friend VCL_DLLPUBLIC SvStream
& operator>>( SvStream
& rIStream
, Animation
& rAnimation
);
233 friend VCL_DLLPUBLIC SvStream
& operator<<( SvStream
& rOStream
, const Animation
& rAnimation
);
236 #endif // _SV_ANIMATE_HXX
238 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */