LCOV - code coverage report
Current view: top level - include/vcl - animate.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 32 0.0 %
Date: 2014-04-14 Functions: 0 21 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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_HXX
      21             : #define INCLUDED_VCL_ANIMATE_HXX
      22             : 
      23             : #include <vcl/dllapi.h>
      24             : #include <vcl/timer.hxx>
      25             : #include <vcl/bitmapex.hxx>
      26             : 
      27             : #define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
      28             : 
      29             : enum Disposal
      30             : {
      31             :     DISPOSE_NOT,
      32             :     DISPOSE_BACK,
      33             :     DISPOSE_FULL,
      34             :     DISPOSE_PREVIOUS
      35             : };
      36             : 
      37             : enum CycleMode
      38             : {
      39             :     CYCLE_NOT,
      40             :     CYCLE_NORMAL,
      41             :     CYCLE_FALLBACK,
      42             :     CYCLE_REVERS,
      43             :     CYCLE_REVERS_FALLBACK
      44             : };
      45             : 
      46           0 : struct VCL_DLLPUBLIC AnimationBitmap
      47             : {
      48             :     BitmapEx    aBmpEx;
      49             :     Point       aPosPix;
      50             :     Size        aSizePix;
      51             :     long        nWait;
      52             :     Disposal    eDisposal;
      53             :     bool    bUserInput;
      54             : 
      55           0 :                 AnimationBitmap()
      56             :                     : nWait(0)
      57             :                     , eDisposal(DISPOSE_NOT)
      58           0 :                     , bUserInput(false)
      59             :                 {
      60           0 :                 }
      61             : 
      62           0 :                 AnimationBitmap(
      63             :                     const BitmapEx& rBmpEx,
      64             :                     const Point& rPosPix,
      65             :                     const Size& rSizePix,
      66             :                     long _nWait = 0L,
      67             :                     Disposal _eDisposal = DISPOSE_NOT
      68             :                 ) :
      69             :                     aBmpEx      ( rBmpEx ),
      70             :                     aPosPix     ( rPosPix ),
      71             :                     aSizePix    ( rSizePix ),
      72             :                     nWait       ( _nWait ),
      73             :                     eDisposal   ( _eDisposal ),
      74           0 :                     bUserInput  ( false )
      75           0 :                 {}
      76             : 
      77           0 :     bool    operator==( const AnimationBitmap& rAnimBmp ) const
      78             :                 {
      79           0 :                     return( rAnimBmp.aBmpEx == aBmpEx &&
      80           0 :                             rAnimBmp.aPosPix == aPosPix &&
      81           0 :                             rAnimBmp.aSizePix == aSizePix &&
      82           0 :                             rAnimBmp.nWait == nWait &&
      83           0 :                             rAnimBmp.eDisposal == eDisposal &&
      84           0 :                             rAnimBmp.bUserInput == bUserInput );
      85             :                 }
      86             : 
      87           0 :     bool    operator!=( const AnimationBitmap& rAnimBmp ) const
      88           0 :                 { return !( *this == rAnimBmp ); }
      89             : 
      90             :     bool    IsEqual( const AnimationBitmap& rAnimBmp ) const
      91             :                 {
      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 ) );
      98             :                 }
      99             : 
     100             :     sal_uLong   GetChecksum() const;
     101             : };
     102             : 
     103           0 : struct AInfo
     104             : {
     105             :     Bitmap          aLastSaveBitmap;
     106             :     Bitmap          aBackBitmap;
     107             :     Rectangle       aClipRect;
     108             :     Size            aLastSaveSize;
     109             :     Point           aLastSavePoint;
     110             :     Point           aStartOrg;
     111             :     Size            aStartSize;
     112             :     OutputDevice*   pOutDev;
     113             :     void*           pViewData;
     114             :     long            nExtraData;
     115             :     bool        bWithSize;
     116             :     bool        bPause;
     117             : 
     118           0 :                     AInfo() : pOutDev( NULL ),
     119             :                               pViewData( NULL ),
     120             :                               nExtraData( 0L ),
     121             :                               bWithSize( false ),
     122           0 :                               bPause( false ) {}
     123             : };
     124             : 
     125             : class ImplAnimView;
     126             : typedef ::std::vector< AnimationBitmap* > AnimationBitmapList_impl;
     127             : typedef ::std::vector< ImplAnimView* > AnimViewList_impl;
     128             : 
     129             : class VCL_DLLPUBLIC Animation
     130             : {
     131             :     SAL_DLLPRIVATE static sal_uLong     mnAnimCount;
     132             : 
     133             :     AnimationBitmapList_impl    maList;
     134             :     AnimViewList_impl           maViewList;
     135             :     Link                    maNotifyLink;
     136             :     BitmapEx                maBitmapEx;
     137             :     Timer                   maTimer;
     138             :     Size                    maGlobalSize;
     139             :     long                    mnLoopCount;
     140             :     long                    mnLoops;
     141             :     size_t                  mnPos;
     142             :     CycleMode               meCycleMode;
     143             :     bool                mbIsInAnimation;
     144             :     bool                mbLoopTerminated;
     145             :     bool                mbIsWaiting;
     146             : 
     147             : 
     148             :     SAL_DLLPRIVATE void     ImplRestartTimer( sal_uLong nTimeout );
     149             :     DECL_DLLPRIVATE_LINK(   ImplTimeoutHdl, void* );
     150             : 
     151             : public:
     152             : 
     153           0 :     SAL_DLLPRIVATE static void  ImplIncAnimCount() { mnAnimCount++; }
     154           0 :     SAL_DLLPRIVATE static void  ImplDecAnimCount() { mnAnimCount--; }
     155           0 :     SAL_DLLPRIVATE sal_uLong    ImplGetCurPos() const { return mnPos; }
     156             : 
     157             : 
     158             : public:
     159             :                             Animation();
     160             :                             Animation( const Animation& rAnimation );
     161             :                             ~Animation();
     162             : 
     163             :     Animation&              operator=( const Animation& rAnimation );
     164             :     bool                operator==( const Animation& rAnimation ) const;
     165             :     bool                operator!=( const Animation& rAnimation ) const
     166             :                             { return !(*this==rAnimation); }
     167             : 
     168             :     void                    Clear();
     169             : 
     170             :     bool                Start(
     171             :                                 OutputDevice* pOutDev,
     172             :                                 const Point& rDestPt,
     173             :                                 const Size& rDestSz,
     174             :                                 long nExtraData = 0,
     175             :                                 OutputDevice* pFirstFrameOutDev = NULL
     176             :                             );
     177             :     void                    Stop( OutputDevice* pOutDev = NULL, long nExtraData = 0 );
     178             : 
     179             :     void                    Draw( OutputDevice* pOutDev, const Point& rDestPt ) const;
     180             :     void                    Draw( OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz ) const;
     181             : 
     182           0 :     bool                IsInAnimation() const { return mbIsInAnimation; }
     183             :     bool                IsTransparent() const;
     184             :     bool                IsTerminated() const { return mbLoopTerminated; }
     185             : 
     186           0 :     const Size&             GetDisplaySizePixel() const { return maGlobalSize; }
     187           0 :     void                    SetDisplaySizePixel( const Size& rSize ) { maGlobalSize = rSize; }
     188             : 
     189           0 :     const BitmapEx&         GetBitmapEx() const { return maBitmapEx; }
     190           0 :     void                    SetBitmapEx( const BitmapEx& rBmpEx ) { maBitmapEx = rBmpEx; }
     191             : 
     192           0 :     sal_uLong               GetLoopCount() const { return mnLoopCount; }
     193             :     void                    SetLoopCount( const sal_uLong nLoopCount );
     194             :     void                    ResetLoopCount();
     195             : 
     196             :     void                    SetCycleMode( CycleMode eMode );
     197           0 :     CycleMode               GetCycleMode() const { return meCycleMode; }
     198             : 
     199           0 :     void                    SetNotifyHdl( const Link& rLink ) { maNotifyLink = rLink; }
     200           0 :     const Link&             GetNotifyHdl() const { return maNotifyLink; }
     201             : 
     202           0 :     size_t                  Count() const { return maList.size(); }
     203             :     bool                Insert( const AnimationBitmap& rAnimationBitmap );
     204             :     const AnimationBitmap&  Get( sal_uInt16 nAnimation ) const;
     205             :     void                    Replace( const AnimationBitmap& rNewAnimationBmp, sal_uInt16 nAnimation );
     206             : 
     207             :     sal_uLong               GetSizeBytes() const;
     208             :     sal_uLong               GetChecksum() const;
     209             : 
     210             : public:
     211             : 
     212             :     bool                Convert( BmpConversion eConversion );
     213             :     bool                ReduceColors(
     214             :                                 sal_uInt16 nNewColorCount,
     215             :                                 BmpReduce eReduce = BMP_REDUCE_SIMPLE
     216             :                             );
     217             :     bool                Invert();
     218             :     bool                Mirror( sal_uLong nMirrorFlags );
     219             :     bool                Adjust(
     220             :                                 short nLuminancePercent = 0,
     221             :                                 short nContrastPercent = 0,
     222             :                                 short nChannelRPercent = 0,
     223             :                                 short nChannelGPercent = 0,
     224             :                                 short nChannelBPercent = 0,
     225             :                                 double fGamma = 1.0,
     226             :                                 bool bInvert = false
     227             :                             );
     228             :     bool                Filter(
     229             :                                 BmpFilter eFilter,
     230             :                                 const BmpFilterParam* pFilterParam = NULL,
     231             :                                 const Link* pProgress = NULL
     232             :                             );
     233             : 
     234             :     friend VCL_DLLPUBLIC SvStream&  ReadAnimation( SvStream& rIStream, Animation& rAnimation );
     235             :     friend VCL_DLLPUBLIC SvStream&  WriteAnimation( SvStream& rOStream, const Animation& rAnimation );
     236             : };
     237             : 
     238             : #endif // INCLUDED_VCL_ANIMATE_HXX
     239             : 
     240             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10