SpecialTyp.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2016 RWS Inc, All Rights Reserved
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of version 2 of the GNU General Public License as published by
  7. // the Free Software Foundation
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License along
  15. // with this program; if not, write to the Free Software Foundation, Inc.,
  16. // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. //
  18. //////////////////////////////////////////////////////////////////////
  19. //
  20. // SPECIALTYP.H
  21. //
  22. // Created on 09/28/96 JRD
  23. // Implemented on 09/28/96 JRD
  24. //
  25. // 09/28/96 JRD Started this file with the defines for the extended
  26. // types of images and palettes.
  27. //
  28. // 10/24/96 JRD Added FSPR1 version 5 format
  29. //
  30. // 10/25/96 JRD Adding FSPR8 version 3 (in progress)
  31. //
  32. //
  33. // This allows (if desired) user access to special image types,
  34. // as well as needed extra parameters during the conversion process.
  35. // The file declares the form of pSpecial for each type, as well as
  36. // any needed extensions to other standard RImage functions in
  37. // accommodation of special types.
  38. //
  39. //////////////////////////////////////////////////////////////////////
  40. #ifndef SPECIAL_TYP_H
  41. #define SPECIAL_TYP_H
  42. // This currently depends only on "system.h"
  43. //*******************************************************************
  44. //***** NOTE: In the same convention as m_pData,
  45. //***** m_pSpecial points to the possibly aligned special
  46. //***** data, and m_pSpecialMem refers EITHER to the
  47. //***** originally newed/calloced memory OR is NULL to
  48. //***** indicate that this Image is a COPY and should not free
  49. //***** its own pSpecial.
  50. //*******************************************************************
  51. //===================================================================
  52. // Current Plug and Play list:
  53. //
  54. //(FSPR8,ConvertToFSPR8,ConvertFromFSPR8,LoadFSPR8,SaveFSPR8,NULL,DeleteFSPR8)
  55. //(FSPR1,ConvertToFSPR1,ConvertFromFSPR1,LoadFSPR1,SaveFSPR1,NULL,DeleteFSPR1)
  56. //===================================================================
  57. //*************************************************
  58. //****** FSPR1 => high speed monochrome **********
  59. //****** used for text and masks **********
  60. //*************************************************
  61. //------------- Installed RImage Plugins: -------------------------
  62. // ConvertTo: YES => from any 8-bit
  63. // ConvertFrom: YES => to any 8-bit
  64. // Load: YES
  65. // Save: YES
  66. // Alloc: NO
  67. // Delete: YES
  68. // Copy: NO
  69. //-----------------------------------------------------------------
  70. //
  71. // CONVERION NOTE: Will jettison the palette, as all color info is lost.
  72. // Therefore, DO NOT use an FSPR1 as a "palette holder"
  73. //
  74. class RSpecialFSPR1
  75. {
  76. public:
  77. UCHAR* m_pCode; // actual FSPR1 data
  78. S32 m_lSize; // actual size of FSPR1 data
  79. U16 m_u16ASCII; // allow extended character sets
  80. S16 m_s16KernL; // move left position
  81. U16 m_u16Width; // physical width of image, SHOULD = lWidth!
  82. S16 m_s16KernR; // offset from right side
  83. RImage::Type m_OldType;// previous type
  84. S16* m_psKernList;// Used in printing only
  85. // When you implement m_psKernList, please augment the destructor!
  86. RSpecialFSPR1()
  87. {
  88. m_pCode = NULL;
  89. m_psKernList = NULL;
  90. m_s16KernL = m_s16KernR = (S16)0;
  91. m_u16ASCII = m_u16Width = (U16)0;
  92. m_lSize = (S32)0;
  93. }
  94. ~RSpecialFSPR1()
  95. {
  96. // using calloc / free!!!
  97. if (m_pCode) free (m_pCode);
  98. m_pCode = NULL;
  99. }
  100. };
  101. //=======================================================
  102. //========= Convert extensions for FSPR1: ===============
  103. //=======================================================
  104. // Note: ASCII and kerning information is used and stored
  105. // by CFNT, and is NOT used in raw blitting!
  106. // NOTE: does NOT trim! (use rspLasso)
  107. //
  108. extern void SetConvertToFSPR1
  109. (
  110. U32 u32TransparentColor = 0, // Make transparent
  111. S16 sX = -1, // Convert only from this...
  112. S16 sY = -1, // rectangle. Default values ...
  113. S16 sW = -1, // move to edges of image.
  114. S16 sH = -1, // Use (-1) to use image edge
  115. // If you make a copy, the original RImage will NOT be
  116. // altered! **pimCopy will
  117. RImage** ppimCopy = NULL // To make a copy
  118. );
  119. extern void SetConvertFromFSPR1
  120. (
  121. U32 u32ForeColor, // Make it this color
  122. S16 sTransparent = TRUE, // 1 or 2 color?
  123. U32 u32BackColor = (U32)0 // matters only if sTransparent = FALSE
  124. );
  125. //*************************************************
  126. //****** FSPR8 => high speed color **********
  127. //****** used for sprites **********
  128. //*************************************************
  129. //------------- Installed RImage Plugins: -------------------------
  130. // ConvertTo: YES => from any 8-bit
  131. // ConvertFrom: YES => to any 8-bit
  132. // Load: YES
  133. // Save: YES
  134. // Alloc: NO
  135. // Delete: YES
  136. // Copy: NO
  137. //-----------------------------------------------------------------
  138. //
  139. class RSpecialFSPR8
  140. {
  141. public:
  142. USHORT m_usCompType; // = FSPR8 image type
  143. ULONG m_lBufSize; // Size of the opaque pixel data
  144. ULONG m_lCodeSize; // Size of the control block (compression codes)
  145. USHORT m_usSourceType;// uncompressed Image pre-compressed type
  146. UCHAR* m_pCompBuf; // Compressed picture data, 128bit-aligned
  147. UCHAR* m_pCompMem; // For alignment
  148. UCHAR* m_pCodeBuf; // 32-aligned compression codes
  149. UCHAR** m_pBufArry; // 32-aligned, arry of ptrs to m_pCompBuf scanlines
  150. UCHAR** m_pCodeArry; // 32-aligned, arry of ptrs into m_pCodeBuf scanlines
  151. RSpecialFSPR8()
  152. {
  153. m_usCompType = m_usSourceType = 0;
  154. m_pCompBuf = m_pCompMem = m_pCodeBuf = NULL;
  155. m_pBufArry = m_pCodeArry = NULL;
  156. m_lBufSize = m_lCodeSize = 0;
  157. }
  158. ~RSpecialFSPR8()
  159. {
  160. if (m_pCompMem) free(m_pCompMem);
  161. if (m_pCodeBuf) free(m_pCodeBuf);
  162. if (m_pBufArry) free(m_pBufArry);
  163. if (m_pCodeArry) free(m_pCodeArry);
  164. }
  165. };
  166. //=======================================================
  167. //========= Convert extensions for FSPR8: ===============
  168. //=======================================================
  169. // CURENTLY, NO EXTRA CONTROL IS GIVEN WITH FSPR8 CONVERSIONS
  170. //*************************************************
  171. //****** ROTBUF => texture buffer **********
  172. //****** also used for rotation **********
  173. //*************************************************
  174. // Curently, the normal extensions of Image are
  175. // being used for textures and such.
  176. //=======================================================
  177. //========= Convert extensions for ROTBUF: ===============
  178. //=======================================================
  179. //===================
  180. #endif // special type