Untitled


SUBMITTED BY: Guest

DATE: Nov. 25, 2014, 7:15 a.m.

FORMAT: Text only

SIZE: 4.2 kB

HITS: 47806

  1. /* CoreGraphics - CGGradient.h
  2. Copyright (c) 2006-2011 Apple Inc.
  3. All rights reserved. */
  4. #ifndef CGGRADIENT_H_
  5. #define CGGRADIENT_H_
  6. typedef struct CGGradient *CGGradientRef;
  7. #include <stdint.h>
  8. enum {
  9. kCGGradientDrawsBeforeStartLocation = (1 << 0),
  10. kCGGradientDrawsAfterEndLocation = (1 << 1)
  11. };
  12. typedef uint32_t CGGradientDrawingOptions;
  13. #include <CoreGraphics/CGBase.h>
  14. #include <CoreGraphics/CGColorSpace.h>
  15. #include <CoreGraphics/CGContext.h>
  16. CF_IMPLICIT_BRIDGING_ENABLED
  17. /* A CGGradient defines a transition between colors. The transition is
  18. defined over a range from 0 to 1 inclusive. A gradient specifies a color
  19. at location 0, one at location 1, and possibly additional colors assigned
  20. to locations between 0 and 1.
  21. A CGGradient has a color space. When a gradient is created, all colors
  22. specified are converted to that color space, and interpolation of colors
  23. occurs using the components of that color space. See the documentation of
  24. each creation function for more details. */
  25. /* Return the CFTypeID for CGGradients. */
  26. CG_EXTERN CFTypeID CGGradientGetTypeID(void)
  27. CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
  28. /* Creates a gradient by pairing the color components provided in
  29. `components' with locations provided in `locations'. If `locations' is
  30. NULL, the first color in `colors' will be at location 0, the last color
  31. in `colors' will be at location 1, and intervening colors will be at
  32. equal intervals in between. Otherwise, each location in `locations'
  33. should be a CGFloat between 0 and 1. Each set of color components should
  34. specify a color in the color space `space' (which may not be a pattern or
  35. indexed color space). The number of locations is specified by `count';
  36. the number of color components is the product of `count' and the number
  37. of color components of `space'. If no color is provided for 0 or 1, the
  38. gradient will use the color provided at the locations closest to 0 and 1
  39. for those values. */
  40. CG_EXTERN CGGradientRef CGGradientCreateWithColorComponents(CGColorSpaceRef
  41. space, const CGFloat components[], const CGFloat locations[], size_t count)
  42. CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
  43. /* Creates a gradient by pairing the colors provided in `colors' with the
  44. locations provided in `locations'. `colors' should be a non-empty array
  45. of CGColor objects. The colors may be in any color space other than a
  46. pattern or indexed color space. If `space' is non-NULL, each color will
  47. be converted to that color space and the gradient will drawn in that
  48. space; otherwise, each color will be converted to and drawn in the
  49. "Generic" RGB color space. If `space' is specified, it may not be a
  50. pattern or indexed color space. If `locations' is NULL, the first color
  51. in `colors' will be at location 0, the last color in `colors' will be at
  52. location 1, and intervening colors will be at equal intervals in between.
  53. Otherwise, each location in `locations' should be a CGFloat between 0 and
  54. 1; the array of locations should should contain the same number of items
  55. as `colors'. If no color is provided for 0 or 1, the gradient will use
  56. the color provided at the locations closest to 0 and 1 for those
  57. values. */
  58. CG_EXTERN CGGradientRef CGGradientCreateWithColors(CGColorSpaceRef space,
  59. CFArrayRef colors, const CGFloat locations[])
  60. CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
  61. /* Equivalent to `CFRetain' except that it doesn't crash (as `CFRetain'
  62. does) if `gradient' is NULL. */
  63. CG_EXTERN CGGradientRef CGGradientRetain(CGGradientRef gradient)
  64. CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
  65. /* Equivalent to `CFRelease' except that it doesn't crash (as `CFRelease'
  66. does) if `gradient' is NULL. */
  67. CG_EXTERN void CGGradientRelease(CGGradientRef gradient)
  68. CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
  69. CF_IMPLICIT_BRIDGING_DISABLED
  70. #endif /* CGGRADIENT_H_ */

comments powered by Disqus