Merge pull request #4687 from ruuk/textboxgettext
[vuplus_xbmc] / xbmc / guilib / XBTF.h
1 /*
2  *      Copyright (C) 2005-2013 Team XBMC
3  *      http://xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, see
17  *  <http://www.gnu.org/licenses/>.
18  *
19  */
20 #ifndef XBTF_H_
21 #define XBTF_H_
22
23 #include <string>
24 #include <vector>
25 #include <stdint.h>
26
27 #define XBTF_MAGIC "XBTF"
28 #define XBTF_VERSION "2"
29
30 #define XB_FMT_MASK   0xffff ///< mask for format info - other flags are outside this
31 #define XB_FMT_DXT_MASK   15
32 #define XB_FMT_UNKNOWN     0
33 #define XB_FMT_DXT1        1
34 #define XB_FMT_DXT3        2
35 #define XB_FMT_DXT5        4
36 #define XB_FMT_DXT5_YCoCg  8
37 #define XB_FMT_A8R8G8B8   16 // texture.xbt byte order (matches BGRA8)
38 #define XB_FMT_A8         32
39 #define XB_FMT_RGBA8      64
40 #define XB_FMT_RGB8      128
41 #define XB_FMT_OPAQUE  65536
42
43 class CXBTFFrame
44 {
45 public:
46   CXBTFFrame();
47   uint32_t GetWidth() const;
48   void SetWidth(uint32_t width);
49   uint32_t GetFormat(bool raw = false) const;
50   void SetFormat(uint32_t format);
51   uint32_t GetHeight() const;
52   void SetHeight(uint32_t height);
53   uint64_t GetUnpackedSize() const;
54   void SetUnpackedSize(uint64_t size);
55   uint64_t GetPackedSize() const;
56   void SetPackedSize(uint64_t size);
57   uint64_t GetOffset() const;
58   void SetOffset(uint64_t offset);
59   uint64_t GetHeaderSize() const;
60   uint32_t GetDuration() const;
61   void SetDuration(uint32_t duration);
62   bool IsPacked() const;
63   bool HasAlpha() const;
64
65 private:
66   uint32_t m_width;
67   uint32_t m_height;
68   uint32_t m_format;
69   uint64_t m_packedSize;
70   uint64_t m_unpackedSize;
71   uint64_t m_offset;
72   uint32_t m_duration;
73 };
74
75 class CXBTFFile
76 {
77 public:
78   CXBTFFile();
79   CXBTFFile(const CXBTFFile& ref);
80   char* GetPath();
81   void SetPath(const std::string& path);
82   uint32_t GetLoop() const;
83   void SetLoop(uint32_t loop);
84   std::vector<CXBTFFrame>& GetFrames();
85   uint64_t GetHeaderSize() const;
86
87 private:
88   char         m_path[256];
89   uint32_t     m_loop;
90   std::vector<CXBTFFrame> m_frames;
91 };
92
93 class CXBTF
94 {
95 public:
96   CXBTF();
97   uint64_t GetHeaderSize() const;
98   std::vector<CXBTFFile>& GetFiles();
99
100 private:
101   std::vector<CXBTFFile> m_files;
102 };
103
104 #endif