Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

507 lines
14 KiB

  1. /*
  2. File: QDOffscreen.h
  3. Contains: Quickdraw Offscreen GWorld Interfaces.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1985-2003 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __QDOFFSCREEN__
  11. #define __QDOFFSCREEN__
  12. #ifndef __MACERRORS__
  13. #include <MacErrors.h>
  14. #endif
  15. #ifndef __QUICKDRAW__
  16. #include <Quickdraw.h>
  17. #endif
  18. #if PRAGMA_ONCE
  19. #pragma once
  20. #endif
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. #if PRAGMA_IMPORT
  25. #pragma import on
  26. #endif
  27. enum {
  28. pixPurgeBit = 0,
  29. noNewDeviceBit = 1,
  30. useTempMemBit = 2,
  31. keepLocalBit = 3,
  32. useDistantHdwrMemBit = 4,
  33. useLocalHdwrMemBit = 5,
  34. pixelsPurgeableBit = 6,
  35. pixelsLockedBit = 7,
  36. mapPixBit = 16,
  37. newDepthBit = 17,
  38. alignPixBit = 18,
  39. newRowBytesBit = 19,
  40. reallocPixBit = 20,
  41. clipPixBit = 28,
  42. stretchPixBit = 29,
  43. ditherPixBit = 30,
  44. gwFlagErrBit = 31
  45. };
  46. enum {
  47. pixPurge = 1L << pixPurgeBit,
  48. noNewDevice = 1L << noNewDeviceBit,
  49. useTempMem = 1L << useTempMemBit,
  50. keepLocal = 1L << keepLocalBit,
  51. useDistantHdwrMem = 1L << useDistantHdwrMemBit,
  52. useLocalHdwrMem = 1L << useLocalHdwrMemBit,
  53. pixelsPurgeable = 1L << pixelsPurgeableBit,
  54. pixelsLocked = 1L << pixelsLockedBit,
  55. kAllocDirectDrawSurface = 1L << 14,
  56. mapPix = 1L << mapPixBit,
  57. newDepth = 1L << newDepthBit,
  58. alignPix = 1L << alignPixBit,
  59. newRowBytes = 1L << newRowBytesBit,
  60. reallocPix = 1L << reallocPixBit,
  61. clipPix = 1L << clipPixBit,
  62. stretchPix = 1L << stretchPixBit,
  63. ditherPix = 1L << ditherPixBit,
  64. gwFlagErr = 1L << gwFlagErrBit
  65. };
  66. typedef unsigned long GWorldFlags;
  67. /* Type definition of a GWorldPtr */
  68. typedef CGrafPtr GWorldPtr;
  69. /*
  70. * NewGWorld()
  71. *
  72. * Availability:
  73. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  74. * CarbonLib: in CarbonLib 1.0 and later
  75. * Mac OS X: in version 10.0 and later
  76. */
  77. EXTERN_API( QDErr )
  78. NewGWorld(
  79. GWorldPtr * offscreenGWorld,
  80. short PixelDepth,
  81. const Rect * boundsRect,
  82. CTabHandle cTable, /* can be NULL */
  83. GDHandle aGDevice, /* can be NULL */
  84. GWorldFlags flags) FOURWORDINLINE(0x203C, 0x0016, 0x0000, 0xAB1D);
  85. /* GDevice attribute bits for Carbon and QuickTime 3.0*/
  86. enum {
  87. deviceIsIndirect = (1L << 0),
  88. deviceNeedsLock = (1L << 1),
  89. deviceIsStatic = (1L << 2),
  90. deviceIsExternalBuffer = (1L << 3),
  91. deviceIsDDSurface = (1L << 4),
  92. deviceIsDCISurface = (1L << 5),
  93. deviceIsGDISurface = (1L << 6),
  94. deviceIsAScreen = (1L << 7),
  95. deviceIsOverlaySurface = (1L << 8),
  96. pixMapIsDoubleBuffered = (1L << 9)
  97. };
  98. #if TARGET_OS_WIN32
  99. #if CALL_NOT_IN_CARBON
  100. /*
  101. * GetGDeviceSurface()
  102. *
  103. * Availability:
  104. * Non-Carbon CFM: not available
  105. * CarbonLib: not available
  106. * Mac OS X: not available
  107. */
  108. EXTERN_API( void * )
  109. GetGDeviceSurface(GDHandle gdh);
  110. /*
  111. * GetGDeviceAttributes()
  112. *
  113. * Availability:
  114. * Non-Carbon CFM: not available
  115. * CarbonLib: not available
  116. * Mac OS X: not available
  117. */
  118. EXTERN_API( unsigned long )
  119. GetGDeviceAttributes(GDHandle gdh);
  120. /* to allocate non-mac-rgb GWorlds use QTNewGWorld (ImageCompression.h) */
  121. /*
  122. * NewGWorldFromHBITMAP()
  123. *
  124. * Availability:
  125. * Non-Carbon CFM: not available
  126. * CarbonLib: not available
  127. * Mac OS X: not available
  128. */
  129. EXTERN_API( QDErr )
  130. NewGWorldFromHBITMAP(
  131. GWorldPtr * offscreenGWorld,
  132. CTabHandle cTable,
  133. GDHandle aGDevice,
  134. GWorldFlags flags,
  135. void * newHBITMAP,
  136. void * newHDC);
  137. #endif /* CALL_NOT_IN_CARBON */
  138. #endif /* TARGET_OS_WIN32 */
  139. /*
  140. * NewGWorldFromPtr()
  141. *
  142. * Availability:
  143. * Non-Carbon CFM: not available
  144. * CarbonLib: in CarbonLib 1.1 and later
  145. * Mac OS X: in version 10.0 and later
  146. */
  147. EXTERN_API( QDErr )
  148. NewGWorldFromPtr(
  149. GWorldPtr * offscreenGWorld,
  150. unsigned long PixelFormat,
  151. const Rect * boundsRect,
  152. CTabHandle cTable, /* can be NULL */
  153. GDHandle aGDevice, /* can be NULL */
  154. GWorldFlags flags,
  155. Ptr newBuffer,
  156. long rowBytes);
  157. /*
  158. * LockPixels()
  159. *
  160. * Availability:
  161. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  162. * CarbonLib: in CarbonLib 1.0 and later
  163. * Mac OS X: in version 10.0 and later
  164. */
  165. EXTERN_API( Boolean )
  166. LockPixels(PixMapHandle pm) FOURWORDINLINE(0x203C, 0x0004, 0x0001, 0xAB1D);
  167. /*
  168. * UnlockPixels()
  169. *
  170. * Availability:
  171. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  172. * CarbonLib: in CarbonLib 1.0 and later
  173. * Mac OS X: in version 10.0 and later
  174. */
  175. EXTERN_API( void )
  176. UnlockPixels(PixMapHandle pm) FOURWORDINLINE(0x203C, 0x0004, 0x0002, 0xAB1D);
  177. /*
  178. * UpdateGWorld()
  179. *
  180. * Availability:
  181. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  182. * CarbonLib: in CarbonLib 1.0 and later
  183. * Mac OS X: in version 10.0 and later
  184. */
  185. EXTERN_API( GWorldFlags )
  186. UpdateGWorld(
  187. GWorldPtr * offscreenGWorld,
  188. short pixelDepth,
  189. const Rect * boundsRect,
  190. CTabHandle cTable,
  191. GDHandle aGDevice, /* can be NULL */
  192. GWorldFlags flags) FOURWORDINLINE(0x203C, 0x0016, 0x0003, 0xAB1D);
  193. /*
  194. * DisposeGWorld()
  195. *
  196. * Availability:
  197. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  198. * CarbonLib: in CarbonLib 1.0 and later
  199. * Mac OS X: in version 10.0 and later
  200. */
  201. EXTERN_API( void )
  202. DisposeGWorld(GWorldPtr offscreenGWorld) FOURWORDINLINE(0x203C, 0x0004, 0x0004, 0xAB1D);
  203. /*
  204. * GetGWorld()
  205. *
  206. * Availability:
  207. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  208. * CarbonLib: in CarbonLib 1.0 and later
  209. * Mac OS X: in version 10.0 and later
  210. */
  211. EXTERN_API( void )
  212. GetGWorld(
  213. CGrafPtr * port,
  214. GDHandle * gdh) FOURWORDINLINE(0x203C, 0x0008, 0x0005, 0xAB1D);
  215. /*
  216. * SetGWorld()
  217. *
  218. * Availability:
  219. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  220. * CarbonLib: in CarbonLib 1.0 and later
  221. * Mac OS X: in version 10.0 and later
  222. */
  223. EXTERN_API( void )
  224. SetGWorld(
  225. CGrafPtr port,
  226. GDHandle gdh) FOURWORDINLINE(0x203C, 0x0008, 0x0006, 0xAB1D);
  227. /*
  228. * CTabChanged()
  229. *
  230. * Availability:
  231. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  232. * CarbonLib: in CarbonLib 1.0 and later
  233. * Mac OS X: in version 10.0 and later
  234. */
  235. EXTERN_API( void )
  236. CTabChanged(CTabHandle ctab) FOURWORDINLINE(0x203C, 0x0004, 0x0007, 0xAB1D);
  237. /*
  238. * PixPatChanged()
  239. *
  240. * Availability:
  241. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  242. * CarbonLib: in CarbonLib 1.0 and later
  243. * Mac OS X: in version 10.0 and later
  244. */
  245. EXTERN_API( void )
  246. PixPatChanged(PixPatHandle ppat) FOURWORDINLINE(0x203C, 0x0004, 0x0008, 0xAB1D);
  247. /*
  248. * PortChanged()
  249. *
  250. * Availability:
  251. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  252. * CarbonLib: in CarbonLib 1.0 and later
  253. * Mac OS X: in version 10.0 and later
  254. */
  255. EXTERN_API( void )
  256. PortChanged(GrafPtr port) FOURWORDINLINE(0x203C, 0x0004, 0x0009, 0xAB1D);
  257. /*
  258. * GDeviceChanged()
  259. *
  260. * Availability:
  261. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  262. * CarbonLib: in CarbonLib 1.0 and later
  263. * Mac OS X: in version 10.0 and later
  264. */
  265. EXTERN_API( void )
  266. GDeviceChanged(GDHandle gdh) FOURWORDINLINE(0x203C, 0x0004, 0x000A, 0xAB1D);
  267. /*
  268. * AllowPurgePixels()
  269. *
  270. * Availability:
  271. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  272. * CarbonLib: in CarbonLib 1.0 and later
  273. * Mac OS X: in version 10.0 and later
  274. */
  275. EXTERN_API( void )
  276. AllowPurgePixels(PixMapHandle pm) FOURWORDINLINE(0x203C, 0x0004, 0x000B, 0xAB1D);
  277. /*
  278. * NoPurgePixels()
  279. *
  280. * Availability:
  281. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  282. * CarbonLib: in CarbonLib 1.0 and later
  283. * Mac OS X: in version 10.0 and later
  284. */
  285. EXTERN_API( void )
  286. NoPurgePixels(PixMapHandle pm) FOURWORDINLINE(0x203C, 0x0004, 0x000C, 0xAB1D);
  287. /*
  288. * GetPixelsState()
  289. *
  290. * Availability:
  291. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  292. * CarbonLib: in CarbonLib 1.0 and later
  293. * Mac OS X: in version 10.0 and later
  294. */
  295. EXTERN_API( GWorldFlags )
  296. GetPixelsState(PixMapHandle pm) FOURWORDINLINE(0x203C, 0x0004, 0x000D, 0xAB1D);
  297. /*
  298. * SetPixelsState()
  299. *
  300. * Availability:
  301. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  302. * CarbonLib: in CarbonLib 1.0 and later
  303. * Mac OS X: in version 10.0 and later
  304. */
  305. EXTERN_API( void )
  306. SetPixelsState(
  307. PixMapHandle pm,
  308. GWorldFlags state) FOURWORDINLINE(0x203C, 0x0008, 0x000E, 0xAB1D);
  309. /*
  310. * GetPixBaseAddr()
  311. *
  312. * Availability:
  313. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  314. * CarbonLib: in CarbonLib 1.0 and later
  315. * Mac OS X: in version 10.0 and later
  316. */
  317. EXTERN_API( Ptr )
  318. GetPixBaseAddr(PixMapHandle pm) FOURWORDINLINE(0x203C, 0x0004, 0x000F, 0xAB1D);
  319. /*
  320. * GetPixRowBytes()
  321. *
  322. * Availability:
  323. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  324. * CarbonLib: in CarbonLib 1.0 and later
  325. * Mac OS X: in version 10.0 and later
  326. */
  327. EXTERN_API( long )
  328. GetPixRowBytes(PixMapHandle pm) FOURWORDINLINE(0x203C, 0x0004, 0x0018, 0xAB1D);
  329. /*
  330. * NewScreenBuffer()
  331. *
  332. * Availability:
  333. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  334. * CarbonLib: in CarbonLib 1.0 and later
  335. * Mac OS X: in version 10.0 and later
  336. */
  337. EXTERN_API( QDErr )
  338. NewScreenBuffer(
  339. const Rect * globalRect,
  340. Boolean purgeable,
  341. GDHandle * gdh,
  342. PixMapHandle * offscreenPixMap) FOURWORDINLINE(0x203C, 0x000E, 0x0010, 0xAB1D);
  343. /*
  344. * DisposeScreenBuffer()
  345. *
  346. * Availability:
  347. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  348. * CarbonLib: in CarbonLib 1.0 and later
  349. * Mac OS X: in version 10.0 and later
  350. */
  351. EXTERN_API( void )
  352. DisposeScreenBuffer(PixMapHandle offscreenPixMap) FOURWORDINLINE(0x203C, 0x0004, 0x0011, 0xAB1D);
  353. /*
  354. * GetGWorldDevice()
  355. *
  356. * Availability:
  357. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  358. * CarbonLib: in CarbonLib 1.0 and later
  359. * Mac OS X: in version 10.0 and later
  360. */
  361. EXTERN_API( GDHandle )
  362. GetGWorldDevice(GWorldPtr offscreenGWorld) FOURWORDINLINE(0x203C, 0x0004, 0x0012, 0xAB1D);
  363. /*
  364. * QDDone()
  365. *
  366. * Availability:
  367. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  368. * CarbonLib: in CarbonLib 1.0 and later
  369. * Mac OS X: in version 10.0 and later
  370. */
  371. EXTERN_API( Boolean )
  372. QDDone(GrafPtr port) FOURWORDINLINE(0x203C, 0x0004, 0x0013, 0xAB1D);
  373. /*
  374. * OffscreenVersion()
  375. *
  376. * Availability:
  377. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  378. * CarbonLib: in CarbonLib 1.0 and later
  379. * Mac OS X: in version 10.0 and later
  380. */
  381. EXTERN_API( long )
  382. OffscreenVersion(void) TWOWORDINLINE(0x7014, 0xAB1D);
  383. /*
  384. * NewTempScreenBuffer()
  385. *
  386. * Availability:
  387. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  388. * CarbonLib: in CarbonLib 1.0 and later
  389. * Mac OS X: in version 10.0 and later
  390. */
  391. EXTERN_API( QDErr )
  392. NewTempScreenBuffer(
  393. const Rect * globalRect,
  394. Boolean purgeable,
  395. GDHandle * gdh,
  396. PixMapHandle * offscreenPixMap) FOURWORDINLINE(0x203C, 0x000E, 0x0015, 0xAB1D);
  397. /*
  398. * PixMap32Bit()
  399. *
  400. * Availability:
  401. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  402. * CarbonLib: in CarbonLib 1.0 and later
  403. * Mac OS X: in version 10.0 and later
  404. */
  405. EXTERN_API( Boolean )
  406. PixMap32Bit(PixMapHandle pmHandle) FOURWORDINLINE(0x203C, 0x0004, 0x0016, 0xAB1D);
  407. /*
  408. * GetGWorldPixMap()
  409. *
  410. * Availability:
  411. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  412. * CarbonLib: in CarbonLib 1.0 and later
  413. * Mac OS X: in version 10.0 and later
  414. */
  415. EXTERN_API( PixMapHandle )
  416. GetGWorldPixMap(GWorldPtr offscreenGWorld) FOURWORDINLINE(0x203C, 0x0004, 0x0017, 0xAB1D);
  417. #ifdef PRAGMA_IMPORT_OFF
  418. #pragma import off
  419. #elif PRAGMA_IMPORT
  420. #pragma import reset
  421. #endif
  422. #ifdef __cplusplus
  423. }
  424. #endif
  425. #endif /* __QDOFFSCREEN__ */