xbmc
TextureBundleXBT.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include <cstdint>
12 #include <ctime>
13 #include <memory>
14 #include <string>
15 #include <utility>
16 #include <vector>
17 
18 class CTexture;
19 class CXBTFReader;
20 class CXBTFFrame;
21 
23 {
24 public:
26  explicit CTextureBundleXBT(bool themeBundle);
28 
29  void SetThemeBundle(bool themeBundle);
30  bool HasFile(const std::string& Filename);
31  std::vector<std::string> GetTexturesFromPath(const std::string& path);
32  static std::string Normalize(std::string name);
33 
37  bool LoadTexture(const std::string& filename,
38  std::unique_ptr<CTexture>& texture,
39  int& width,
40  int& height);
41 
45  bool LoadAnim(const std::string& filename,
46  std::vector<std::pair<std::unique_ptr<CTexture>, int>>& textures,
47  int& width,
48  int& height,
49  int& nLoops);
50 
52  static std::vector<uint8_t> UnpackFrame(const CXBTFReader& reader, const CXBTFFrame& frame);
53 
54  void CloseBundle();
55 
56 private:
57  bool OpenBundle();
58  bool ConvertFrameToTexture(const std::string& name,
59  const CXBTFFrame& frame,
60  std::unique_ptr<CTexture>& texture);
61 
62  time_t m_TimeStamp;
63 
64  bool m_themeBundle;
65  std::string m_path;
66  std::shared_ptr<CXBTFReader> m_XBTFReader;
67 };
68 
69 
Definition: XBTF.h:23
Definition: TextureBundleXBT.h:22
Base texture class, subclasses of which depend on the render spec (DX, GL etc.)
Definition: Texture.h:34
bool LoadAnim(const std::string &filename, std::vector< std::pair< std::unique_ptr< CTexture >, int >> &textures, int &width, int &height, int &nLoops)
See CTextureBundle::LoadAnim.
Definition: TextureBundleXBT.cpp:177
bool LoadTexture(const std::string &filename, std::unique_ptr< CTexture > &texture, int &width, int &height)
See CTextureBundle::LoadTexture.
Definition: TextureBundleXBT.cpp:151
static std::vector< uint8_t > UnpackFrame(const CXBTFReader &reader, const CXBTFFrame &frame)
Definition: TextureBundleXBT.cpp:266
Definition: XBTFReader.h:18