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
47 struct VCL_DLLPUBLIC AnimationBitmap
58 , eDisposal(DISPOSE_NOT
)
63 const BitmapEx
& rBmpEx
,
67 Disposal _eDisposal
= DISPOSE_NOT
71 aSizePix ( rSizePix
),
73 eDisposal ( _eDisposal
),
77 bool operator==( const AnimationBitmap
& rAnimBmp
) const
79 return( rAnimBmp
.aBmpEx
== aBmpEx
&&
80 rAnimBmp
.aPosPix
== aPosPix
&&
81 rAnimBmp
.aSizePix
== aSizePix
&&
82 rAnimBmp
.nWait
== nWait
&&
83 rAnimBmp
.eDisposal
== eDisposal
&&
84 rAnimBmp
.bUserInput
== bUserInput
);
87 bool operator!=( const AnimationBitmap
& rAnimBmp
) const
88 { return !( *this == rAnimBmp
); }
90 bool IsEqual( const AnimationBitmap
& rAnimBmp
) const
92 return( rAnimBmp
.aPosPix
== aPosPix
&&
93 rAnimBmp
.aSizePix
== aSizePix
&&
94 rAnimBmp
.nWait
== nWait
&&
95 rAnimBmp
.eDisposal
== eDisposal
&&
96 rAnimBmp
.bUserInput
== bUserInput
&&
97 rAnimBmp
.aBmpEx
.IsEqual( aBmpEx
) );
100 BitmapChecksum
GetChecksum() const;
105 Bitmap aLastSaveBitmap
;
109 Point aLastSavePoint
;
112 VclPtr
<OutputDevice
> pOutDev
;
123 class VCL_DLLPUBLIC Animation
127 Animation( const Animation
& rAnimation
);
130 Animation
& operator=( const Animation
& rAnimation
);
131 bool operator==( const Animation
& rAnimation
) const;
132 bool operator!=( const Animation
& rAnimation
) const
133 { return !(*this==rAnimation
); }
138 OutputDevice
* pOutDev
,
139 const Point
& rDestPt
,
142 OutputDevice
* pFirstFrameOutDev
= NULL
);
144 void Stop( OutputDevice
* pOutDev
= NULL
, long nExtraData
= 0 );
146 void Draw( OutputDevice
* pOutDev
, const Point
& rDestPt
) const;
147 void Draw( OutputDevice
* pOutDev
, const Point
& rDestPt
, const Size
& rDestSz
) const;
149 bool IsInAnimation() const { return mbIsInAnimation
; }
150 bool IsTransparent() const;
151 bool IsTerminated() const { return mbLoopTerminated
; }
153 const Size
& GetDisplaySizePixel() const { return maGlobalSize
; }
154 void SetDisplaySizePixel( const Size
& rSize
) { maGlobalSize
= rSize
; }
156 const BitmapEx
& GetBitmapEx() const { return maBitmapEx
; }
157 void SetBitmapEx( const BitmapEx
& rBmpEx
) { maBitmapEx
= rBmpEx
; }
159 sal_uLong
GetLoopCount() const { return mnLoopCount
; }
160 void SetLoopCount( const sal_uLong nLoopCount
);
161 void ResetLoopCount();
163 void SetCycleMode( CycleMode eMode
);
164 CycleMode
GetCycleMode() const { return meCycleMode
; }
166 void SetNotifyHdl( const Link
<>& rLink
) { maNotifyLink
= rLink
; }
167 const Link
<>& GetNotifyHdl() const { return maNotifyLink
; }
169 size_t Count() const { return maList
.size(); }
170 bool Insert( const AnimationBitmap
& rAnimationBitmap
);
171 const AnimationBitmap
&
172 Get( sal_uInt16 nAnimation
) const;
173 void Replace( const AnimationBitmap
& rNewAnimationBmp
, sal_uInt16 nAnimation
);
175 sal_uLong
GetSizeBytes() const;
176 BitmapChecksum
GetChecksum() const;
180 bool Convert( BmpConversion eConversion
);
182 sal_uInt16 nNewColorCount
,
183 BmpReduce eReduce
= BMP_REDUCE_SIMPLE
);
186 bool Mirror( BmpMirrorFlags nMirrorFlags
);
188 short nLuminancePercent
= 0,
189 short nContrastPercent
= 0,
190 short nChannelRPercent
= 0,
191 short nChannelGPercent
= 0,
192 short nChannelBPercent
= 0,
194 bool bInvert
= false );
198 const BmpFilterParam
* pFilterParam
= NULL
,
199 const Link
<>* pProgress
= NULL
);
201 friend VCL_DLLPUBLIC SvStream
& ReadAnimation( SvStream
& rIStream
, Animation
& rAnimation
);
202 friend VCL_DLLPUBLIC SvStream
& WriteAnimation( SvStream
& rOStream
, const Animation
& rAnimation
);
206 SAL_DLLPRIVATE
static void
207 ImplIncAnimCount() { mnAnimCount
++; }
208 SAL_DLLPRIVATE
static void
209 ImplDecAnimCount() { mnAnimCount
--; }
210 SAL_DLLPRIVATE sal_uLong
211 ImplGetCurPos() const { return mnPos
; }
214 SAL_DLLPRIVATE
static sal_uLong mnAnimCount
;
216 std::vector
< AnimationBitmap
* > maList
;
217 std::vector
< ImplAnimView
* > maViewList
;
226 CycleMode meCycleMode
;
227 bool mbIsInAnimation
;
228 bool mbLoopTerminated
;
231 SAL_DLLPRIVATE
void ImplRestartTimer( sal_uLong nTimeout
);
232 DECL_DLLPRIVATE_LINK_TYPED( ImplTimeoutHdl
, Timer
*, void );
236 #endif // INCLUDED_VCL_ANIMATE_HXX
238 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */