Palettes.pas 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. {
  2. File: Palettes.p
  3. Contains: Palette Manager Interfaces.
  4. Version: Technology: Mac OS 8
  5. Release: Universal Interfaces 3.4.2
  6. Copyright: © 1987-2002 by Apple Computer, Inc., all rights reserved
  7. Bugs?: For bug reports, consult the following page on
  8. the World Wide Web:
  9. http://www.freepascal.org/bugs.html
  10. }
  11. {
  12. Modified for use with Free Pascal
  13. Version 200
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$CALLING MWPASCAL}
  21. unit Palettes;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,Quickdraw;
  92. {$ALIGN MAC68K}
  93. const
  94. pmCourteous = 0; { Record use of color on each device touched. }
  95. pmDithered = $0001;
  96. pmTolerant = $0002; { render ciRGB if ciTolerance is exceeded by best match. }
  97. pmAnimated = $0004; { reserve an index on each device touched and render ciRGB. }
  98. pmExplicit = $0008; { no reserve, no render, no record; stuff index into port. }
  99. pmWhite = $0010;
  100. pmBlack = $0020;
  101. pmInhibitG2 = $0100;
  102. pmInhibitC2 = $0200;
  103. pmInhibitG4 = $0400;
  104. pmInhibitC4 = $0800;
  105. pmInhibitG8 = $1000;
  106. pmInhibitC8 = $2000; { NSetPalette Update Constants }
  107. pmNoUpdates = $8000; { no updates }
  108. pmBkUpdates = $A000; { background updates only }
  109. pmFgUpdates = $C000; { foreground updates only }
  110. pmAllUpdates = $E000; { all updates }
  111. type
  112. ColorInfoPtr = ^ColorInfo;
  113. ColorInfo = record
  114. ciRGB: RGBColor; { true RGB values }
  115. ciUsage: SInt16; { color usage }
  116. ciTolerance: SInt16; { tolerance value }
  117. ciDataFields: array [0..2] of SInt16; { private fields }
  118. end;
  119. ColorInfoHandle = ^ColorInfoPtr;
  120. PalettePtr = ^Palette;
  121. Palette = record
  122. pmEntries: SInt16; { entries in pmTable }
  123. pmDataFields: array [0..6] of SInt16; { private fields }
  124. pmInfo: array [0..0] of ColorInfo;
  125. end;
  126. PaletteHandle = ^PalettePtr;
  127. {
  128. * InitPalettes()
  129. *
  130. * Availability:
  131. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  132. * CarbonLib: in CarbonLib 1.0 and later
  133. * Mac OS X: in version 10.0 and later
  134. }
  135. procedure InitPalettes; external name '_InitPalettes';
  136. {
  137. * NewPalette()
  138. *
  139. * Availability:
  140. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  141. * CarbonLib: in CarbonLib 1.0 and later
  142. * Mac OS X: in version 10.0 and later
  143. }
  144. function NewPalette(entries: SInt16; srcColors: CTabHandle; srcUsage: SInt16; srcTolerance: SInt16): PaletteHandle; external name '_NewPalette';
  145. {
  146. * GetNewPalette()
  147. *
  148. * Availability:
  149. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  150. * CarbonLib: in CarbonLib 1.0 and later
  151. * Mac OS X: in version 10.0 and later
  152. }
  153. function GetNewPalette(PaletteID: SInt16): PaletteHandle; external name '_GetNewPalette';
  154. {
  155. * DisposePalette()
  156. *
  157. * Availability:
  158. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  159. * CarbonLib: in CarbonLib 1.0 and later
  160. * Mac OS X: in version 10.0 and later
  161. }
  162. procedure DisposePalette(srcPalette: PaletteHandle); external name '_DisposePalette';
  163. {
  164. * ActivatePalette()
  165. *
  166. * Availability:
  167. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  168. * CarbonLib: in CarbonLib 1.0 and later
  169. * Mac OS X: in version 10.0 and later
  170. }
  171. procedure ActivatePalette(srcWindow: WindowRef); external name '_ActivatePalette';
  172. {
  173. * SetPalette()
  174. *
  175. * Availability:
  176. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  177. * CarbonLib: in CarbonLib 1.0 and later
  178. * Mac OS X: in version 10.0 and later
  179. }
  180. procedure SetPalette(dstWindow: WindowRef; srcPalette: PaletteHandle; cUpdates: boolean); external name '_SetPalette';
  181. {
  182. * NSetPalette()
  183. *
  184. * Availability:
  185. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  186. * CarbonLib: in CarbonLib 1.0 and later
  187. * Mac OS X: in version 10.0 and later
  188. }
  189. procedure NSetPalette(dstWindow: WindowRef; srcPalette: PaletteHandle; nCUpdates: SInt16); external name '_NSetPalette';
  190. {
  191. * GetPalette()
  192. *
  193. * Availability:
  194. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  195. * CarbonLib: in CarbonLib 1.0 and later
  196. * Mac OS X: in version 10.0 and later
  197. }
  198. function GetPalette(srcWindow: WindowRef): PaletteHandle; external name '_GetPalette';
  199. {
  200. * CopyPalette()
  201. *
  202. * Availability:
  203. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  204. * CarbonLib: in CarbonLib 1.0 and later
  205. * Mac OS X: in version 10.0 and later
  206. }
  207. procedure CopyPalette(srcPalette: PaletteHandle; dstPalette: PaletteHandle; srcEntry: SInt16; dstEntry: SInt16; dstLength: SInt16); external name '_CopyPalette';
  208. {
  209. * PmForeColor()
  210. *
  211. * Availability:
  212. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  213. * CarbonLib: in CarbonLib 1.0 and later
  214. * Mac OS X: in version 10.0 and later
  215. }
  216. procedure PmForeColor(dstEntry: SInt16); external name '_PmForeColor';
  217. {
  218. * PmBackColor()
  219. *
  220. * Availability:
  221. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  222. * CarbonLib: in CarbonLib 1.0 and later
  223. * Mac OS X: in version 10.0 and later
  224. }
  225. procedure PmBackColor(dstEntry: SInt16); external name '_PmBackColor';
  226. {
  227. * AnimateEntry()
  228. *
  229. * Availability:
  230. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  231. * CarbonLib: in CarbonLib 1.0 and later
  232. * Mac OS X: in version 10.0 and later
  233. }
  234. procedure AnimateEntry(dstWindow: WindowRef; dstEntry: SInt16; const (*var*) srcRGB: RGBColor); external name '_AnimateEntry';
  235. {
  236. * [Mac]AnimatePalette()
  237. *
  238. * Availability:
  239. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  240. * CarbonLib: in CarbonLib 1.0 and later
  241. * Mac OS X: in version 10.0 and later
  242. }
  243. procedure AnimatePalette(dstWindow: WindowRef; srcCTab: CTabHandle; srcIndex: SInt16; dstEntry: SInt16; dstLength: SInt16); external name '_AnimatePalette';
  244. {
  245. * GetEntryColor()
  246. *
  247. * Availability:
  248. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  249. * CarbonLib: in CarbonLib 1.0 and later
  250. * Mac OS X: in version 10.0 and later
  251. }
  252. procedure GetEntryColor(srcPalette: PaletteHandle; srcEntry: SInt16; var dstRGB: RGBColor); external name '_GetEntryColor';
  253. {
  254. * SetEntryColor()
  255. *
  256. * Availability:
  257. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  258. * CarbonLib: in CarbonLib 1.0 and later
  259. * Mac OS X: in version 10.0 and later
  260. }
  261. procedure SetEntryColor(dstPalette: PaletteHandle; dstEntry: SInt16; const (*var*) srcRGB: RGBColor); external name '_SetEntryColor';
  262. {
  263. * GetEntryUsage()
  264. *
  265. * Availability:
  266. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  267. * CarbonLib: in CarbonLib 1.0 and later
  268. * Mac OS X: in version 10.0 and later
  269. }
  270. procedure GetEntryUsage(srcPalette: PaletteHandle; srcEntry: SInt16; var dstUsage: SInt16; var dstTolerance: SInt16); external name '_GetEntryUsage';
  271. {
  272. * SetEntryUsage()
  273. *
  274. * Availability:
  275. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  276. * CarbonLib: in CarbonLib 1.0 and later
  277. * Mac OS X: in version 10.0 and later
  278. }
  279. procedure SetEntryUsage(dstPalette: PaletteHandle; dstEntry: SInt16; srcUsage: SInt16; srcTolerance: SInt16); external name '_SetEntryUsage';
  280. {
  281. * CTab2Palette()
  282. *
  283. * Availability:
  284. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  285. * CarbonLib: in CarbonLib 1.0 and later
  286. * Mac OS X: in version 10.0 and later
  287. }
  288. procedure CTab2Palette(srcCTab: CTabHandle; dstPalette: PaletteHandle; srcUsage: SInt16; srcTolerance: SInt16); external name '_CTab2Palette';
  289. {
  290. * Palette2CTab()
  291. *
  292. * Availability:
  293. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  294. * CarbonLib: in CarbonLib 1.0 and later
  295. * Mac OS X: in version 10.0 and later
  296. }
  297. procedure Palette2CTab(srcPalette: PaletteHandle; dstCTab: CTabHandle); external name '_Palette2CTab';
  298. {
  299. * Entry2Index()
  300. *
  301. * Availability:
  302. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  303. * CarbonLib: in CarbonLib 1.0 and later
  304. * Mac OS X: in version 10.0 and later
  305. }
  306. function Entry2Index(entry: SInt16): SInt32; external name '_Entry2Index';
  307. {
  308. * RestoreDeviceClut()
  309. *
  310. * Availability:
  311. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  312. * CarbonLib: in CarbonLib 1.0 and later
  313. * Mac OS X: in version 10.0 and later
  314. }
  315. procedure RestoreDeviceClut(gd: GDHandle); external name '_RestoreDeviceClut';
  316. {
  317. * [Mac]ResizePalette()
  318. *
  319. * Availability:
  320. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  321. * CarbonLib: in CarbonLib 1.0 and later
  322. * Mac OS X: in version 10.0 and later
  323. }
  324. procedure ResizePalette(p: PaletteHandle; size: SInt16); external name '_ResizePalette';
  325. {
  326. * SaveFore()
  327. *
  328. * Availability:
  329. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  330. * CarbonLib: in CarbonLib 1.0 and later
  331. * Mac OS X: in version 10.0 and later
  332. }
  333. procedure SaveFore(var c: ColorSpec); external name '_SaveFore';
  334. {
  335. * SaveBack()
  336. *
  337. * Availability:
  338. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  339. * CarbonLib: in CarbonLib 1.0 and later
  340. * Mac OS X: in version 10.0 and later
  341. }
  342. procedure SaveBack(var c: ColorSpec); external name '_SaveBack';
  343. {
  344. * RestoreFore()
  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. procedure RestoreFore(const (*var*) c: ColorSpec); external name '_RestoreFore';
  352. {
  353. * RestoreBack()
  354. *
  355. * Availability:
  356. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  357. * CarbonLib: in CarbonLib 1.0 and later
  358. * Mac OS X: in version 10.0 and later
  359. }
  360. procedure RestoreBack(const (*var*) c: ColorSpec); external name '_RestoreBack';
  361. {
  362. * SetDepth()
  363. *
  364. * Availability:
  365. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  366. * CarbonLib: in CarbonLib 1.0 and later
  367. * Mac OS X: in version 10.0 and later
  368. }
  369. function SetDepth(gd: GDHandle; depth: SInt16; whichFlags: SInt16; flags: SInt16): OSErr; external name '_SetDepth';
  370. {
  371. * HasDepth()
  372. *
  373. * Availability:
  374. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  375. * CarbonLib: in CarbonLib 1.0 and later
  376. * Mac OS X: in version 10.0 and later
  377. }
  378. function HasDepth(gd: GDHandle; depth: SInt16; whichFlags: SInt16; flags: SInt16): SInt16; external name '_HasDepth';
  379. {
  380. * PMgrVersion()
  381. *
  382. * Availability:
  383. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  384. * CarbonLib: in CarbonLib 1.0 and later
  385. * Mac OS X: in version 10.0 and later
  386. }
  387. function PMgrVersion: SInt16; external name '_PMgrVersion';
  388. {
  389. * SetPaletteUpdates()
  390. *
  391. * Availability:
  392. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  393. * CarbonLib: in CarbonLib 1.0 and later
  394. * Mac OS X: in version 10.0 and later
  395. }
  396. procedure SetPaletteUpdates(p: PaletteHandle; updates: SInt16); external name '_SetPaletteUpdates';
  397. {
  398. * GetPaletteUpdates()
  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. function GetPaletteUpdates(p: PaletteHandle): SInt16; external name '_GetPaletteUpdates';
  406. {
  407. * GetGray()
  408. *
  409. * Availability:
  410. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  411. * CarbonLib: in CarbonLib 1.0 and later
  412. * Mac OS X: in version 10.0 and later
  413. }
  414. function GetGray(device: GDHandle; const (*var*) backGround: RGBColor; var foreGround: RGBColor): boolean; external name '_GetGray';
  415. {$ALIGN MAC68K}
  416. end.