ImageInfo.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. // FILE: ImageInfo.h //////////////////////////////////////////////////////////
  19. //-----------------------------------------------------------------------------
  20. //
  21. // Westwood Studios Pacific.
  22. //
  23. // Confidential Information
  24. // Copyright (C) 2001 - All Rights Reserved
  25. //
  26. //-----------------------------------------------------------------------------
  27. //
  28. // Project: ImagePacker
  29. //
  30. // File name: ImageInfo.h
  31. //
  32. // Created: Colin Day, August 2001
  33. //
  34. // Desc: Image descriptor for the image packer
  35. //
  36. //-----------------------------------------------------------------------------
  37. ///////////////////////////////////////////////////////////////////////////////
  38. #pragma once
  39. #ifndef __IMAGEINFO_H_
  40. #define __IMAGEINFO_H_
  41. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  42. // USER INCLUDES //////////////////////////////////////////////////////////////
  43. #include "Lib/BaseType.h"
  44. ///////////////////////////////////////////////////////////////////////////////
  45. // FORWARD REFERENCES /////////////////////////////////////////////////////////
  46. ///////////////////////////////////////////////////////////////////////////////
  47. class TexturePage;
  48. // TYPE DEFINES ///////////////////////////////////////////////////////////////
  49. // ImageInfo ------------------------------------------------------------------
  50. /** Image file information */
  51. //-----------------------------------------------------------------------------
  52. class ImageInfo
  53. {
  54. public:
  55. enum
  56. {
  57. UNPACKED = 0x00000001, ///< this image has not yet been packed
  58. PACKED = 0x00000002, ///< this image has been packed and is done
  59. TOOBIG = 0x00000004, ///< this image was too big to process
  60. ROTATED90C = 0x00000008, ///< image is fitted after 90 clockwise rotation
  61. CANTPROCESS = 0x00000010, ///< can't be processed
  62. INVALIDCOLORDEPTH = 0x00000020, ///< unsupported source image format
  63. };
  64. enum
  65. {
  66. FIT_XGUTTER = 0x00000001, ///< x gutter is present in fit region
  67. FIT_YGUTTER = 0x00000002, ///< y gutter is present in fit region
  68. FIT_XBORDER_RIGHT = 0x00000004, ///< x border of 1 pixel on right side of region
  69. FIT_XBORDER_LEFT = 0x00000008, ///< x border of 1 pixel on left side of region
  70. FIT_YBORDER_TOP = 0x00000010, ///< y border of 1 pixel on top of region
  71. FIT_YBORDER_BOTTOM = 0x00000020, ///< y border of 1 pixel on bottom of image
  72. };
  73. public:
  74. ImageInfo();
  75. ~ImageInfo();
  76. char *m_path; ///< path to file
  77. char *m_filenameOnly; ///< filename with extension only (no path information)
  78. char *m_filenameOnlyNoExt; ///< filename without extension and no path info
  79. Int m_colorDepth; ///< bits per pixel
  80. UnsignedInt m_area; ///< width and height area
  81. ICoord2D m_size; ///< width and height of image
  82. UnsignedInt m_status; ///< status bits for image
  83. TexturePage *m_page; ///< pointer to page this image is now packed on
  84. ImageInfo *m_nextPageImage; ///< next image on texture page
  85. ImageInfo *m_prevPageImage; ///< previous image on texture page
  86. IRegion2D m_pagePos; /** once placed on a texture page this has the
  87. coords of the image on the page, it does not include
  88. any padding from stretching borders and gutters */
  89. UnsignedInt m_fitBits; /**< bit flags of the region used to fit this image on
  90. a page and therefore to create m_pagePos */
  91. ICoord2D m_gutterUsed; ///< the gutter size actually used in this image fit
  92. };
  93. // INLINING ///////////////////////////////////////////////////////////////////
  94. // EXTERNALS //////////////////////////////////////////////////////////////////
  95. #endif // __IMAGEINFO_H_