BLIT.H 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  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. //******************** USER FUNCTION SUMMARY **********************
  19. //
  20. // BLiT.LIB depends on BLUE.LIB and IMAGE.LIB
  21. //
  22. // You only need to include BLiT.H
  23. //
  24. // See "BLiT.DOC" for detailed function descriptions.
  25. //
  26. /********************************************************************
  27. --------------------- USEFUL BLUE EXTENSIONS ----------------------
  28. BASIC TYPES: RRect, PRect = {sX,sY,sW,sH}
  29. INTEGER TYPES: U64,S64,U128,S128 integer types
  30. STANDARD TEMPLATE EXTENSIONS to blue MACROS: SQR / ABS / ABS2 / MIN / MAX / SGN
  31. short rspSetWindowColors() - Restore Windows System Colors
  32. void rspWaitForClick(sButton = 3) - Wait for down andup of specified button
  33. void rspSetBMPColors(pim,sStart,sNum) - Insert BMP colors into palette
  34. -------------------- USEFUL GRAPHICS FUNCTIONS -------------------
  35. short rspLasso(anyColor,pimSrc,sX,sY,sW,sH,iFlagL=1,iFlagR=1,iFlagT=1,iFlagB=1)
  36. - deluxe function for locating images somewhere inside of a buffer
  37. void rspPlot(anyColor,pimDst,sX,sY) - convenient plotter
  38. short rspRect(u32Color,pimDst,sX,sY,sW,sH,prClip=NULL) - high speed solid rectangle
  39. short rspRect(sThickness,u32Color,pimDst,sX,sY,sW,sH,prClip=NULL) - high speed hollow rectangle
  40. short rspCrop(pimSrc,sX,sY,sW,sH,[sAlign],[pimDst])
  41. short rspPad(pimSrc,sX,sY,sW,sH,[sAlign],[pimDst])
  42. ---------------------- VITAL BLiT FUNCTIONS -----------------------
  43. short rspLockScreen() - optimize your screen access
  44. short rspUnlockScreen()
  45. void rspNameBuffers(ppimMemBuf,ppimFrontVid=NULL,ppimBackVid=NULL)
  46. - needed to BLiT to "official" buffers and screens
  47. ----------------------- BLiTting OPERATIONS -----------------------
  48. short rspBlit(pimSrc,pimDst,sSrcX,sSrcY,sDstX,sDstY,sW,sH,prDst=NULL,prSrc=NULL)
  49. - opaque copy for any uncompressed buffer
  50. short rspBlit(pimSrc,pimDst,sX,sY,prDst=NULL)
  51. - transparent copy from any compressed buffer
  52. short rspBlitA(pimSrc,pimDst,sX,sY,sW,sH,const RRect* prDst=NULL,RRect* prSrc=NULL)
  53. - an opaque, auto-aligned "punch through" BLiT with double clipping.
  54. rspBlit(pixForeColor,pixBackColor,pimSrc,pimDst,sDstX,sDstY,prDst = NULL,sAddW = 0)
  55. - monochrome FSPR1 BLiTting...
  56. CStrafe => pImage,sHotX,sHotY,psLinkX,psLinkY = one NODE of a strafe
  57. short rspStrafeRotate(pvReturnArray,pimSrc,sCenterX,sCenterY,dScale,sNumFrames,
  58. [ dStartDeg=0,dDegInc=0,
  59. sNumLinks=0,psX=NULL,psY=NULL ])
  60. - Create an array of rotated images.
  61. ------------------ Image Type Conversion Functions ----------------
  62. Image extensions:
  63. FSPR8 - ConvertFrom, ConvertTo, Delete
  64. FSPR1 - ConvertFrom, ConvertTo, Delete:
  65. rspSetConvertToFSPR1(ulLassoBackCol=0,ulComprBackCol=0,sTrimT=0,sTrimB=0)
  66. rspSetConvertFromFSPR1(ulFrontCol,ulBackCol=0)
  67. FSPR16,FSPR32 - NYI
  68. ROTBUF - ConvertFrom, ConvertTo, Delete:
  69. rspSetConvertToROTBUF(sCenterX,sCenterY);
  70. ----------------------------- PRINTING text -------------------------
  71. < This is a BLiT96 patch >
  72. RFont fntMyFont; // instantiate a font
  73. RPrint pntBuf; // instantiate a printing buffer
  74. fntMyFont.Load(pszPath,pszName); // Will ADD a ".fnt"!
  75. RPrint pntBuf; // instantiate a printing buffer
  76. pntBuf.set(&fntMyFont,sCellHeight); // set font and size
  77. pntBuf.SetColor(sLetterColor,sBackColor); // set colors
  78. pntBuf | "Input Text and " | sNumbers | " or anything.\n");
  79. pntBuf.print(sX,sY,pimDst); // PRINT IT!
  80. ----------------
  81. pntBuf.printC(sX,sY,sW,pimDst); // Centers text in box
  82. pntBuf.GetWidth(); // returns width in pixels of entire text buffer
  83. pntBuf.GetCell(sASCII,sW,sH); // Sets (sW,sH) to size of character
  84. ----------------
  85. pntBuf.SetColumn(sX,sY,sW,sH,pimDst); // Autowrap is crude right now
  86. pntBuf.Clear(); // Clear the print buffer early
  87. //******************************************************************/
  88. // Depends only on image
  89. #ifndef BLIT_H
  90. #define BLIT_H
  91. /////////////////////////////////////////////////////////////////////
  92. // 07/19/96 JMI Altered to allow use of simple RSPiX root base path
  93. // plus RSPiX/Blue path. This should also allow this
  94. // header to be used on the Mac if it is necessary.
  95. // JEFF: Changed this block of code FROM:
  96. //#include "image/image.h"
  97. //#include "Blue.h"
  98. // TO:
  99. #include "Blue.h"
  100. // If PATHS_IN_INCLUDES macro is defined, we can utilized relative
  101. // paths to a header file. In this case we generally go off of our
  102. // RSPiX root directory. System.h MUST be included before this macro
  103. // is evaluated. System.h is the header that, based on the current
  104. // platform (or more so in this case on the compiler), defines
  105. // PATHS_IN_INCLUDES. Blue.h includes system.h so you can include
  106. // that instead.
  107. #ifdef PATHS_IN_INCLUDES
  108. #include "GREEN/Image/Image.h"
  109. #include "GREEN/Image/SpecialTyp.h"
  110. #else
  111. #include "Image.h"
  112. #include "SpecialTyp.h"
  113. #endif // PATHS_IN_INCLUDES
  114. //END//CHANGES//BY//JON//////////////////////////////////////////////
  115. // This is the user header for all 2D sprite operations.
  116. // If you already have a short version, then you can use it, too!
  117. class RRect
  118. {
  119. public:
  120. short sX;
  121. short sY;
  122. short sW;
  123. short sH;
  124. // Returns -1 if clipped completely out,
  125. // It clips your rect to the input rect
  126. // If clipped completely, sets rect to 0
  127. // & sets this rect to {0,0,0,0}
  128. //
  129. short ClipTo(RRect *prClipTo);
  130. RRect(){};
  131. RRect(short sXi,short sYi,short sWi=0,short sHi=0)
  132. { sX = sXi,sY = sYi,sW = sWi,sH = sHi; }
  133. ~RRect(){};
  134. }; // used for clipping!
  135. // templated forms of common functions:
  136. // Name your screen references...
  137. extern void rspNameBuffers(RImage** ppimMemBuf,RImage** ppimVidBuf = NULL,
  138. RImage** ppimBackBuf = NULL);
  139. // For your convenience...
  140. extern short rspSetWindowColors(); // restore system colors
  141. // For your convenience...
  142. extern void rspWaitForClick(short sButton = 3);
  143. // For your convenience...
  144. extern void rspSetBMPColors(RImage* pim,short sStartIndex,short sNum);
  145. extern short rspBlit(RImage* pimSrc,RImage* pimDst,short sSrcX,short sSrcY,short sDstX,
  146. short sDstY,short sW,short sH,const RRect* prDst=NULL,const RRect* prSrc=NULL);
  147. // This does the compressed transparent BLiTting
  148. // Currently only 8-bit mode.
  149. //
  150. extern short rspBlit(RImage* pimSrc,RImage* pimDst,short sX,short sY,const RRect* prDst=NULL);
  151. extern short rspBlitT(RImage* pimSrc,RImage* pimDst,short sSrcX,short sSrcY,short sDstX,
  152. short sDstY,short sW,short sH,const RRect* prDst,const RRect* prSrc);
  153. // Used only to punch a rectangle between two 128-bit aligned buffers.
  154. // Source and Destination (X,Y) must be the same.
  155. // Will widen your rectangle to take advantage of your bus!
  156. //
  157. extern short rspBlitA(RImage* pimSrc,RImage* pimDst,short sX,short sY,
  158. short sW,short sH,const RRect* prDst=NULL,const RRect* prSrc=NULL);
  159. // This is not currently designed for 24-bit mode.
  160. // Returns 0 if something found...
  161. // The direction flags are non-zero to operate a direction. They refer to
  162. // the side shrinking.
  163. //
  164. #ifdef WIN32
  165. template <class PIXSIZE>
  166. extern short rspLasso(PIXSIZE ignoreColor,RImage* pimSrc,short &x,short &y,short &w,short &h,
  167. int lFlag=1,int rFlag=1,int tFlag=1,int bFlag=1);
  168. #else // MAC
  169. template <class PIXSIZE>
  170. short rspLasso(PIXSIZE ignoreColor,RImage* pimSrc,short &x,short &y,short &w,short &h,
  171. int lFlag=1,int rFlag=1,int tFlag=1,int bFlag=1);
  172. #endif
  173. /* no restrictions
  174. #ifdef WIN32
  175. template <class PIXSIZE>
  176. extern void rspPlot(PIXSIZE color, RImage* pimDst,short sX,short sY);
  177. #else // MAC
  178. template <class PIXSIZE>
  179. void rspPlot(PIXSIZE color, RImage* pimDst,short sX,short sY);
  180. #endif
  181. */
  182. #define rspPlot(color,pimDst,sX,sY) do { const RRect rspPlotTempRect(0,0,pimDst->m_sWidth,pimDst->m_sHeight); rspClipPlot(color,pimDst,sX,sY,&rspPlotTempRect); } while (0)
  183. // no restrictions
  184. #ifdef WIN32
  185. template <class PIXSIZE>
  186. extern void rspClipPlot(PIXSIZE color, RImage* pimDst,short sX,short sY,const RRect* prClip);
  187. #else // MAC
  188. template <class PIXSIZE>
  189. void rspClipPlot(PIXSIZE color, RImage* pimDst,short sX,short sY,const RRect* prClip);
  190. #endif
  191. extern short rspRect(U32 color,RImage* pimDst,short sX,short sY,short sW,short sH,RRect* prClip=NULL);
  192. extern short rspRect(short sThickness,U32 color,RImage* pimDst,short sX,short sY,short sW,short sH,RRect* prClip=NULL);
  193. extern short rspLockBuffer();
  194. extern short rspLockScreen();
  195. extern short rspUnlockBuffer();
  196. extern short rspUnlockScreen();
  197. extern short rspGeneralLock(RImage* pimDst);
  198. extern short rspGeneralUnlock(RImage* pimDst);
  199. /* archaic
  200. extern void rspSetConvertToFSPR1(ULONG ulLassoBackCol = 0,ULONG ulComprBackCol = 0,
  201. short sTrimT = 0,short sMaxH = 0,UCHAR ucASCII = 0);
  202. extern void rspSetConvertFromFSPR1(ULONG ulFrontCol,ULONG ulBackCol = 1);
  203. */
  204. /* Archaic
  205. extern short rspBlit(ULONG ulForeColor,ULONG ulBackColor,RImage* pimSrc,RImage* pimDst,
  206. short sDstX,short sDstY,const RRect* prDst = NULL,short sAddW = 0);
  207. extern short rspBlit(ULONG ulForeColor,ULONG ulBackColor,RImage* pimSrc,RImage* pimDst,
  208. short sDstX,short sDstY,short sDstW,short sDstH,const RRect* prDst=NULL,short sAddW=0,
  209. short *psItalics=NULL);
  210. */
  211. //============================ The modern version FSPR1 =================================
  212. extern short rspBlit(
  213. ULONG ulForeColor, // will draw in color 0!
  214. RImage* pimSrc,
  215. RImage* pimDst,
  216. short sDstX,
  217. short sDstY,
  218. const RRect* prDst = NULL
  219. ); // no scaling, clipping, or text effects.
  220. extern short rspBlit(
  221. ULONG ulForeColor, // will draw color 0
  222. RImage* pimSrc,
  223. RImage* pimDst,
  224. short sDstX,
  225. short sDstY,
  226. short sDstW,
  227. short sDstH,
  228. const RRect* prDst = NULL
  229. ); // no clipping or text effects, but scaling.
  230. extern short rspBlit(
  231. ULONG ulForeColor,
  232. RImage* pimSrc,
  233. RImage* pimDst,
  234. short sDstX,
  235. short sDstY,
  236. short* psLineOffset // Must be as long as the height!
  237. ); // No clipping ever, text effects, no scaling.
  238. extern short rspBlit(
  239. ULONG ulForeColor, // will draw color 0
  240. RImage* pimSrc,
  241. RImage* pimDst,
  242. short sDstX,
  243. short sDstY,
  244. short sDstW,
  245. short sDstH,
  246. short* psLineOffset // Must be as long as the height!
  247. ); // No clipping ever, text effects, scaling
  248. //========================================================================================
  249. extern short rspCrop(RImage* pimSrc,short sX,short sY,short sW,short sH,
  250. short sAlign = 16);
  251. extern short rspPad(RImage* pimSrc,short sX,short sY,short sW,short sH,
  252. short sAlign = 16);
  253. extern short rspRemovePadding(RImage* pimSrc);
  254. extern short rspAddRotationPadding(RImage* pimSrc,short sHotX,short sHotY);
  255. /* archaic
  256. extern short _rspBlit(ULONG ulClrLTR,ULONG ulClrBKD,RImage* pimSrc,RImage* pimDst,
  257. short sDstX,short sDstY,short sW,short sH,
  258. short sAddW=0,u16Frac* frSkipY=NULL,u16Frac* frSkipX=NULL);
  259. extern short _rspBlit(ULONG ulForeColor,ULONG ulBackColor,RImage* pimSrc,RImage* pimDst,
  260. short sDstX,short sDstY,const RRect* prDst = NULL,short sAddW = 0);
  261. extern short _rspBlit(ULONG ulForeColor,ULONG ulBackColor,RImage* pimSrc,RImage* pimDst,
  262. short sDstX,short sDstY,short sDstW,short sDstH,
  263. const RRect* prDst = NULL,short sAddW = 0);
  264. */
  265. extern short rspRectToMono(ULONG ulColor,RImage* pimDst,short sX,short sY,
  266. short sW,short sH);
  267. //****************************************************************************************
  268. //****************************************************************************************
  269. //=============================== Silly Font Test Stuff! =================================
  270. //****************************************************************************************
  271. //****************************************************************************************
  272. typedef struct tagFont
  273. {
  274. short sCellHeight;
  275. short sUnproportionalWidth;
  276. RImage* pLetters[256]; // ptr to letters or NULL
  277. tagFont* pNext;
  278. } FontNode;
  279. // put in header...
  280. class RFontOld
  281. {
  282. public:
  283. char* m_pszFontName;
  284. short m_sMaxCellHeight; // maximum original size
  285. FontNode* m_pHead; // last created font...
  286. FontNode* m_pFontList;
  287. //================== initialization:
  288. RFontOld();
  289. RFontOld(char* pszName);
  290. ~RFontOld();
  291. //===================================================
  292. //=========== Font Installation:
  293. //===================================================
  294. void AddLetter(RImage* pimLetter);
  295. short Save(char* pszPath); // only 5 chars standard...
  296. short Save(RFile* pFile);
  297. short Load(char* pszPath,char* pszName); // only 5 chars standard...
  298. short Load(char* pszName); // only 5 chars standard...
  299. };
  300. // This IS currently 8=bit color hard wired!
  301. // flags for formatting: (FORMATTING NYI)
  302. const short TXT_LEFT = 1;
  303. const short TXT_CENTER = 2;
  304. const short TXT_WORDWRAP = 4;
  305. const short TXT_WORDJUST = 8; // change space size
  306. const short TXT_CHARJUST = 16;
  307. const short TXT_MULTILINE = 32; // allow multiple lines
  308. // flags for attributes:
  309. // (Tab and Spacing are always considered ON at default values.)
  310. const short TXT_BOLD = 1;
  311. const short TXT_ITALIC = 2;
  312. const short TXT_WIDE = 4;
  313. const short cgsMAX_FONT_SIZE = 256; // may need to adjust!
  314. /*
  315. class RPrint
  316. {
  317. public:
  318. RPrint();
  319. ~RPrint();
  320. //===========================================
  321. void Clear();
  322. void SetColumn(short sX,short sY,short sW=0,short sH=0,RImage* pimDst = NULL);
  323. void SetFont(RFontOld* pFnt,short sHeight);
  324. void SetStretch(float fWide); // 1.0 = normal
  325. void SetItalic(float fItalic); // 0.0 = normal
  326. void SetItalic(short sItalic); // 0 = normal, absolute pixel offset.
  327. void SetBold(short sBold); // actual pixel effect, fine control, 0 = normal
  328. void SetBold(float fBold); // 1.0 = normal, length in Cell Heights
  329. void SetColor(short sLetter,short sBkd = 0);
  330. void SetTab(short sPixNum);
  331. void SetTab(float fPixNum);
  332. void SetSpace(short sPix); // additional
  333. void SetSpace(float fSpace); // in Cell heights
  334. void set(RFontOld* pFnt,short sHeight){SetFont(pFnt,sHeight);} // backwards
  335. short GetWidth(); // returns width in pixels of current buffer...
  336. void GetCell(short sASCII,short &w,short &h); // does NOT include AddW
  337. //===========================================
  338. //========= Let's Print!!! ===============
  339. //===========================================
  340. void print(short sX,short sY,RImage* pimDst = NULL);
  341. void printC(short sX,short sY,short sW,RImage* pimDst = NULL);
  342. RFontOld* GetFont(){return m_fnCurrent;}
  343. RPrint& print();
  344. RPrint& operator|(char* psz);
  345. RPrint& operator<<(char* psz);
  346. RPrint& operator|(short in);
  347. RPrint& operator|(long in);
  348. RPrint& operator|(float in);
  349. RPrint& operator|(double in);
  350. RPrint& operator|(char in);
  351. RPrint& debug();
  352. short m_sCellH; // Current font cell height
  353. short m_sCurX;
  354. short m_sCurY;
  355. public:
  356. short LineFeed();
  357. short GetChar();
  358. void GetCell(RImage* pimLetter,short* psCellH = NULL,
  359. short* psCellW = NULL,short* psStretchW = NULL); // does NOT include AddW!
  360. //***************************************
  361. //****** The curent state of the font!
  362. //***************************************
  363. private:
  364. short m_sTabW;
  365. float m_fTabW;
  366. float m_fBold; // state of bold, relative to cell Height
  367. short m_sBold; // bold pixels added per run
  368. float m_fItalic; // state of italic, relative to cell height
  369. short m_sItalic; // Number pixels slant
  370. float m_fWide; // 1.0 = true aspect ratio
  371. // No absolute width because it varies by character
  372. float m_fSpace; // Extra space between pixels based on chosen height.
  373. short m_sSpace; // Extra kerning space in pixels
  374. UCHAR m_clrBKD; // current color
  375. UCHAR m_clrFGD;
  376. RFontOld* m_fnCurrent; // Current font
  377. FontNode* m_pFontSize; // Base font template
  378. u16Frac* m_pCurFracX; // to aid in the scaling process!
  379. u16Frac* m_pCurFracY; // to aid in the scaling process!
  380. char m_buffer[4096];
  381. char m_temp[256];
  382. char* m_pBuf; // open stack
  383. char* m_pCurBuf;
  384. RImage* m_pimTarget; // Destination
  385. short m_sL,m_sT,m_sW,m_sH; // Column Rectangle...
  386. // if (sW < 0) then rect is disabled!
  387. short m_sFORMAT; // formatting flags
  388. short m_sATTRIB; // letter attributes
  389. short m_psItalic[cgsMAX_FONT_SIZE]; // store by line...
  390. public: // for development ONLY
  391. void PrintLine(short sNumChar,short sJustDelta = 0,short sJustFraction = 0,
  392. short sDen = 1);
  393. };
  394. */
  395. typedef class CStrafe
  396. {
  397. public:
  398. CStrafe()
  399. {
  400. sHotX = sHotY = NULL;
  401. psLinkX = psLinkY = NULL;
  402. pImage = NULL;
  403. }
  404. ~CStrafe()
  405. {
  406. if (pImage) delete pImage;
  407. if (psLinkX) free(psLinkX);
  408. if (psLinkY) free(psLinkY);
  409. }
  410. RImage* pImage;
  411. short sHotX; // subtract from coord
  412. short sHotY;
  413. short *psLinkX; // a var length array
  414. short *psLinkY; // a var length array
  415. } *PStrafe;
  416. // ARCHAIC Backwards support for BLT_STRAFE:
  417. // User will use a Strafe to hold the data!
  418. //
  419. typedef struct
  420. {
  421. RImage* pfspr; // must be altered!
  422. short sHotX;
  423. short sHotY;
  424. short sCurDeg;
  425. short *psLinkX;
  426. short *psLinkY;
  427. } StrafeFrame; // archaic
  428. typedef struct
  429. {
  430. short sNumFrames;
  431. short sNumLinks;
  432. CStrafe *pFrame;
  433. } Strafe; // archaic!
  434. /*
  435. extern Strafe* BLT_RotStrafe(RImage* pimSrc,short sHotX,short sHotY,short sNumInc,
  436. short sDstH,short sNumLinks,short *psX, short* psY);
  437. */
  438. //extern void BLT_FreeStrafe(Strafe* pKill);
  439. extern void rspSetConvertToROTBUF(short sCenterX,short sCenterY);
  440. extern void _RotateShrink(float fDeg,RImage* pimSrc,RImage* pimDst,
  441. short sDstX,short sDstY,short sDstW,short sDstH,
  442. short sFlipCode = 0);
  443. extern short rspStrafeRotate(void *pReturnArray, // Output
  444. RImage* pimSrc,short sCenterX,short sCenterY,double dScale, // Input
  445. short sNumFrames,double dStartDeg = 0.0,double dDegInc = 0.0,
  446. short sNumLinks=0,short *psX=NULL,short *psY=NULL, // input
  447. // generic user stucture must be an array:
  448. RImage* pIm = NULL, short *psHotX = NULL, short *psHotY = NULL,
  449. short **ppsX = NULL,short **ppsY = NULL,
  450. long lStructSize = sizeof(CStrafe));
  451. extern short rspBlitToMono(
  452. RImage* pimSrc,
  453. RImage* pimDst,
  454. short sDstX,
  455. short sDstY,
  456. short sDstW,
  457. short sDstH
  458. );
  459. //*****************************************************************************
  460. // This is the main controller... It clips in pixels, then thinks in bytes:
  461. // if prSrc == NULL, no source clipping will occure
  462. // if prDst == NULL, it will clip to the RImage
  463. //
  464. extern short rspBlitT(ULONG ucTransparent,RImage* pimSrc,RImage* pimDst,short sSrcX,short sSrcY,short sDstX,
  465. short sDstY,short sW,short sH,const RRect* prDst,const RRect* prSrc);
  466. extern short rspBlitT(RImage* pimSrc,RImage* pimDst,short sDstX,short sDstY,
  467. short sDstW,short sDstH,const RRect* prDstClip=NULL);
  468. extern short rspBlitT(RImage* pimSrc,RImage* pimDst,RRect* prSrc,const RRect* prDst,
  469. const RRect* prDstClip=NULL,const RRect* prSrcClip=NULL);
  470. extern short rspBlitT(RImage* pimSrc,RImage* pimDst,short sDstX,short sDstY,
  471. double dRatW = 1.0,double dRatH = 1.0,const RRect* prDstClip = NULL);
  472. extern short rspBlitRot(short sDeg,RImage* pimSrc,RImage* pimDst,
  473. short sDstX,short sDstY,short sDstW,short sDstH,
  474. const RRect* prDstClip = NULL);
  475. extern short rspBlitRot(short sDeg,RImage* pimSrc,RImage* pimDst,
  476. short sDstX,short sDstY,double dScaleX,double dScaleY,
  477. const RRect* prDstClip = NULL);
  478. extern void rspLine(UCHAR ucColor,RImage* pimDst,short sX1,short sY1,short sX2,short sY2,
  479. const RRect* prClip = NULL);
  480. extern short rspRand(short sMax);
  481. extern short rspMonoRect(short rspBrightness,RImage* pimDst,short sX,short sY,short sW,short sH,
  482. const RRect* prClip = NULL);
  483. extern short rspMonoRectLightenTo(short rspBrightness,RImage* pimDst,short sX,short sY,short sW,short sH,
  484. const RRect* prClip = NULL);
  485. extern short rspMonoRectDarkenTo(short rspBrightness,RImage* pimDst,short sX,short sY,short sW,short sH,
  486. const RRect* prClip = NULL);
  487. extern short rspClipBrightness(short sNum,short sLev);
  488. extern short rspMonoRect(short sThickness,short rspBrightness,RImage* pimDst,short sX,short sY,short sW,short sH,
  489. const RRect* prClip = NULL);
  490. extern short rspMonoRectLightenTo(short sThickness,short rspBrightness,RImage* pimDst,short sX,short sY,short sW,short sH,
  491. const RRect* prClip = NULL);
  492. extern short rspMonoRectDarkenTo(short sThickness,short rspBrightness,RImage* pimDst,short sX,short sY,short sW,short sH,
  493. const RRect* prClip = NULL);
  494. extern short rspGetBrightness(short sIndex,UCHAR* pR,UCHAR* pG,UCHAR* pB,long lInc = 4);
  495. //********************************** FAST CONVERTS: *******************************
  496. //----- BYTE dpeth to shift amount:
  497. static const short gsByteToShift[] = {0,0,1,0,2,0,0,0,3,0,0,0,0,0,0,0,4};
  498. // BYTES: 0 1 2 3 4 5 6 7 8 9 a b c d e f *
  499. static const short gsBitsToShift[] =
  500. {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2};
  501. //BIT: 0 1 2 3 4 5 6 7 8 9 a b c d e f 0 1 2 3 4 5 6 7 8 9 a b c d e f *
  502. //***********************************************************************************
  503. // Safety code:
  504. #ifndef NULL
  505. #define NULL 0
  506. #endif
  507. //====================================
  508. #ifdef PATHS_IN_INCLUDES
  509. #include "GREEN/BLiT/Cfnt.h"
  510. #include "GREEN/BLiT/RPrint.h"
  511. #include "ORANGE/QuickMath/QuickMath.h"
  512. #else
  513. #include "QuickMath.h"
  514. #include "Cfnt.h"
  515. #include "RPrint.h"
  516. #endif // PATHS_IN_INCLUDES
  517. //====================================
  518. #endif