texturethumbnail.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  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 3 of the License, or
  8. ** (at your option) 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 this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef TEXTURETHUMBNAIL_H
  19. #define TEXTURETHUMBNAIL_H
  20. #if defined(_MSC_VER)
  21. #pragma once
  22. #endif
  23. #include "always.h"
  24. #include "wwstring.h"
  25. // ----------------------------------------------------------------------------
  26. class ThumbnailClass
  27. {
  28. StringClass Name;
  29. unsigned char* Bitmap;
  30. unsigned Width;
  31. unsigned Height;
  32. bool Allocated; // if true, destructor will free the memory
  33. public:
  34. ThumbnailClass(const char* name, unsigned char* bitmap, unsigned w, unsigned h, bool allocated);
  35. ThumbnailClass(const StringClass& filename);
  36. ~ThumbnailClass();
  37. unsigned char* Peek_Bitmap() { return Bitmap; }
  38. unsigned Get_Width() const { return Width; }
  39. unsigned Get_Height() const { return Height; }
  40. const StringClass& Get_Name() const { return Name; }
  41. static ThumbnailClass* Peek_Instance(const StringClass& name);
  42. static void Init();
  43. static void Deinit();
  44. };
  45. // ----------------------------------------------------------------------------
  46. #endif