[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / pictures / SlideShowPicture.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2013 Team XBMC
4  *      http://www.xbmc.org
5  *
6  *  This Program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This Program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with XBMC; see the file COPYING.  If not, see
18  *  <http://www.gnu.org/licenses/>.
19  *
20  */
21
22 #include "threads/CriticalSection.h"
23 #include "guilib/gui3d.h"
24 #include "utils/StdString.h"
25 #include "guilib/DirtyRegion.h"
26
27 typedef uint32_t color_t;
28
29 class CBaseTexture;
30
31 class CSlideShowPic
32 {
33 public:
34   enum DISPLAY_EFFECT { EFFECT_NONE = 0, EFFECT_FLOAT, EFFECT_ZOOM, EFFECT_RANDOM, EFFECT_PANORAMA, EFFECT_NO_TIMEOUT };
35   enum TRANSISTION_EFFECT { TRANSISTION_NONE = 0, FADEIN_FADEOUT, CROSSFADE, TRANSISTION_ZOOM, TRANSISTION_ROTATE };
36
37   struct TRANSISTION
38   {
39     TRANSISTION_EFFECT type;
40     int start;
41     int length;
42   };
43
44   CSlideShowPic();
45   ~CSlideShowPic();
46
47   void SetTexture(int iSlideNumber, CBaseTexture* pTexture, DISPLAY_EFFECT dispEffect = EFFECT_RANDOM, TRANSISTION_EFFECT transEffect = FADEIN_FADEOUT);
48   void UpdateTexture(CBaseTexture* pTexture);
49
50   bool IsLoaded() const { return m_bIsLoaded;};
51   void UnLoad() {m_bIsLoaded = false;};
52   void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
53   void Render();
54   void Close();
55   bool IsFinished() const { return m_bIsFinished;};
56   bool DrawNextImage() const { return m_bDrawNextImage;};
57
58   int GetWidth() const { return (int)m_fWidth;};
59   int GetHeight() const { return (int)m_fHeight;};
60
61   void Keep();
62   bool StartTransistion();
63   int GetTransistionTime(int iType) const;
64   void SetTransistionTime(int iType, int iTime);
65
66   int SlideNumber() const { return m_iSlideNumber;};
67
68   void Zoom(float fZoomAmount, bool immediate = false);
69   void Rotate(float fRotateAngle, bool immediate = false);
70   void Pause(bool bPause);
71   void SetInSlideshow(bool slideshow);
72   void SetOriginalSize(int iOriginalWidth, int iOriginalHeight, bool bFullSize);
73   bool FullSize() const { return m_bFullSize;};
74   int GetOriginalWidth();
75   int GetOriginalHeight();
76
77   void Move(float dX, float dY);
78   float GetZoom() const { return m_fZoomAmount;};
79
80   bool m_bIsComic;
81   bool m_bCanMoveHorizontally;
82 private:
83   void UpdateVertices(float cur_x[4], float cur_y[4], const float new_x[4], const float new_y[4], CDirtyRegionList &dirtyregions);
84   void Render(float *x, float *y, CBaseTexture* pTexture, color_t color);
85   CBaseTexture *m_pImage;
86
87   int m_iOriginalWidth;
88   int m_iOriginalHeight;
89   int m_iSlideNumber;
90   bool m_bIsLoaded;
91   bool m_bIsFinished;
92   bool m_bDrawNextImage;
93   bool m_bIsDirty;
94   CStdString m_strFileName;
95   float m_fWidth;
96   float m_fHeight;
97   color_t m_alpha;
98   // stuff relative to middle position
99   float m_fPosX;
100   float m_fPosY;
101   float m_fPosZ;
102   float m_fVelocityX;
103   float m_fVelocityY;
104   float m_fVelocityZ;
105   float m_fZoomAmount;
106   float m_fZoomLeft;
107   float m_fZoomTop;
108   float m_ax[4], m_ay[4];
109   float m_sx[4], m_sy[4];
110   float m_bx[4], m_by[4];
111   float m_ox[4], m_oy[4];
112
113   // transistion and display effects
114   DISPLAY_EFFECT m_displayEffect;
115   TRANSISTION m_transistionStart;
116   TRANSISTION m_transistionEnd;
117   TRANSISTION m_transistionTemp; // used for rotations + zooms
118   float m_fAngle; // angle (between 0 and 2pi to display the image)
119   float m_fTransistionAngle;
120   float m_fTransistionZoom;
121   int m_iCounter;
122   int m_iTotalFrames;
123   bool m_bPause;
124   bool m_bNoEffect;
125   bool m_bFullSize;
126   bool m_bTransistionImmediately;
127
128   CCriticalSection m_textureAccess;
129 };