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.

307 lines
6.7 KiB

  1. /*
  2. File: CGDirectPalette.h
  3. Contains: CoreGraphics direct palette
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 2000-2001 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 CGDIRECTPALETTE_H_
  11. #define CGDIRECTPALETTE_H_
  12. #ifndef __CGDIRECTDISPLAY__
  13. #include <CGDirectDisplay.h>
  14. #endif
  15. #if PRAGMA_ONCE
  16. #pragma once
  17. #endif
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #if PRAGMA_IMPORT
  22. #pragma import on
  23. #endif
  24. #if PRAGMA_STRUCT_ALIGN
  25. #pragma options align=mac68k
  26. #elif PRAGMA_STRUCT_PACKPUSH
  27. #pragma pack(push, 2)
  28. #elif PRAGMA_STRUCT_PACK
  29. #pragma pack(2)
  30. #endif
  31. typedef float CGPaletteBlendFraction;
  32. /*
  33. * Convenient device color representation
  34. *
  35. * Values should be in the range from 0.0 to 1.0, where 0.0 is black, and 1.0
  36. * is full on for each channel.
  37. */
  38. struct CGDeviceColor {
  39. float red;
  40. float green;
  41. float blue;
  42. };
  43. typedef struct CGDeviceColor CGDeviceColor;
  44. struct CGDeviceByteColor {
  45. CGByteValue red;
  46. CGByteValue green;
  47. CGByteValue blue;
  48. };
  49. typedef struct CGDeviceByteColor CGDeviceByteColor;
  50. /*
  51. * Create a new palette object representing the default 8 bit color palette.
  52. * Release the palette using CGPaletteRelease().
  53. */
  54. /*
  55. * CGPaletteCreateDefaultColorPalette()
  56. *
  57. * Availability:
  58. * Non-Carbon CFM: not available
  59. * CarbonLib: not available
  60. * Mac OS X: in version 10.0 and later
  61. */
  62. EXTERN_API_C( CGDirectPaletteRef )
  63. CGPaletteCreateDefaultColorPalette(void);
  64. /*
  65. * Create a copy of the display's current palette, if any.
  66. * Returns NULL if the current display mode does not support a palette.
  67. * Release the palette using CGPaletteRelease().
  68. */
  69. /*
  70. * CGPaletteCreateWithDisplay()
  71. *
  72. * Availability:
  73. * Non-Carbon CFM: not available
  74. * CarbonLib: not available
  75. * Mac OS X: in version 10.0 and later
  76. */
  77. EXTERN_API_C( CGDirectPaletteRef )
  78. CGPaletteCreateWithDisplay(CGDirectDisplayID display);
  79. /*
  80. * Create a new palette with a capacity as specified. Entries are initialized from
  81. * the default color palette. Release the palette using CGPaletteRelease().
  82. */
  83. /*
  84. * CGPaletteCreateWithCapacity()
  85. *
  86. * Availability:
  87. * Non-Carbon CFM: not available
  88. * CarbonLib: not available
  89. * Mac OS X: in version 10.0 and later
  90. */
  91. EXTERN_API_C( CGDirectPaletteRef )
  92. CGPaletteCreateWithCapacity(CGTableCount capacity);
  93. /*
  94. * Create a new palette with a capacity and contents as specified.
  95. * Release the palette using CGPaletteRelease().
  96. */
  97. /*
  98. * CGPaletteCreateWithSamples()
  99. *
  100. * Availability:
  101. * Non-Carbon CFM: not available
  102. * CarbonLib: not available
  103. * Mac OS X: in version 10.0 and later
  104. */
  105. EXTERN_API_C( CGDirectPaletteRef )
  106. CGPaletteCreateWithSamples(
  107. CGDeviceColor * sampleTable,
  108. CGTableCount sampleCount);
  109. /*
  110. * Convenience function:
  111. * Create a new palette with a capacity and contents as specified.
  112. * Release the palette using CGPaletteRelease().
  113. */
  114. /*
  115. * CGPaletteCreateWithByteSamples()
  116. *
  117. * Availability:
  118. * Non-Carbon CFM: not available
  119. * CarbonLib: not available
  120. * Mac OS X: in version 10.0 and later
  121. */
  122. EXTERN_API_C( CGDirectPaletteRef )
  123. CGPaletteCreateWithByteSamples(
  124. CGDeviceByteColor * sampleTable,
  125. CGTableCount sampleCount);
  126. /*
  127. * Release a palette
  128. */
  129. /*
  130. * CGPaletteRelease()
  131. *
  132. * Availability:
  133. * Non-Carbon CFM: not available
  134. * CarbonLib: not available
  135. * Mac OS X: in version 10.0 and later
  136. */
  137. EXTERN_API_C( void )
  138. CGPaletteRelease(CGDirectPaletteRef palette);
  139. /*
  140. * Get the color value at the specified index
  141. */
  142. /*
  143. * CGPaletteGetColorAtIndex()
  144. *
  145. * Availability:
  146. * Non-Carbon CFM: not available
  147. * CarbonLib: not available
  148. * Mac OS X: in version 10.0 and later
  149. */
  150. EXTERN_API_C( CGDeviceColor )
  151. CGPaletteGetColorAtIndex(
  152. CGDirectPaletteRef palette,
  153. CGTableCount index);
  154. /*
  155. * Get the index for the specified color value
  156. * The index returned is for a palette color with the
  157. * lowest RMS error to the specified color.
  158. */
  159. /*
  160. * CGPaletteGetIndexForColor()
  161. *
  162. * Availability:
  163. * Non-Carbon CFM: not available
  164. * CarbonLib: not available
  165. * Mac OS X: in version 10.0 and later
  166. */
  167. EXTERN_API_C( CGTableCount )
  168. CGPaletteGetIndexForColor(
  169. CGDirectPaletteRef palette,
  170. CGDeviceColor color);
  171. /*
  172. * Get the number of samples in the palette
  173. */
  174. /*
  175. * CGPaletteGetNumberOfSamples()
  176. *
  177. * Availability:
  178. * Non-Carbon CFM: not available
  179. * CarbonLib: not available
  180. * Mac OS X: in version 10.0 and later
  181. */
  182. EXTERN_API_C( CGTableCount )
  183. CGPaletteGetNumberOfSamples(CGDirectPaletteRef palette);
  184. /*
  185. * Set the color value at the specified index
  186. */
  187. /*
  188. * CGPaletteSetColorAtIndex()
  189. *
  190. * Availability:
  191. * Non-Carbon CFM: not available
  192. * CarbonLib: not available
  193. * Mac OS X: in version 10.0 and later
  194. */
  195. EXTERN_API_C( void )
  196. CGPaletteSetColorAtIndex(
  197. CGDirectPaletteRef palette,
  198. CGDeviceColor color,
  199. CGTableCount index);
  200. /*
  201. * Copy a palette
  202. */
  203. /*
  204. * CGPaletteCreateCopy()
  205. *
  206. * Availability:
  207. * Non-Carbon CFM: not available
  208. * CarbonLib: not available
  209. * Mac OS X: in version 10.0 and later
  210. */
  211. EXTERN_API_C( CGDirectPaletteRef )
  212. CGPaletteCreateCopy(CGDirectPaletteRef palette);
  213. /*
  214. * Compare two palettes
  215. */
  216. /*
  217. * CGPaletteIsEqualToPalette()
  218. *
  219. * Availability:
  220. * Non-Carbon CFM: not available
  221. * CarbonLib: not available
  222. * Mac OS X: in version 10.0 and later
  223. */
  224. EXTERN_API_C( Boolean )
  225. CGPaletteIsEqualToPalette(
  226. CGDirectPaletteRef palette1,
  227. CGDirectPaletteRef palette2);
  228. /*
  229. * Create a new palette blended with a fraction of a device color.
  230. * Free the resulting palette with CGPaletteRelease()
  231. */
  232. /*
  233. * CGPaletteCreateFromPaletteBlendedWithColor()
  234. *
  235. * Availability:
  236. * Non-Carbon CFM: not available
  237. * CarbonLib: not available
  238. * Mac OS X: in version 10.0 and later
  239. */
  240. EXTERN_API_C( CGDirectPaletteRef )
  241. CGPaletteCreateFromPaletteBlendedWithColor(
  242. CGDirectPaletteRef palette,
  243. CGPaletteBlendFraction fraction,
  244. CGDeviceColor color);
  245. #if PRAGMA_STRUCT_ALIGN
  246. #pragma options align=reset
  247. #elif PRAGMA_STRUCT_PACKPUSH
  248. #pragma pack(pop)
  249. #elif PRAGMA_STRUCT_PACK
  250. #pragma pack()
  251. #endif
  252. #ifdef PRAGMA_IMPORT_OFF
  253. #pragma import off
  254. #elif PRAGMA_IMPORT
  255. #pragma import reset
  256. #endif
  257. #ifdef __cplusplus
  258. }
  259. #endif
  260. #endif /* CGDIRECTPALETTE_H_ */