gvplugin_quartz.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*************************************************************************
  2. * Copyright (c) 2011 AT&T Intellectual Property
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * https://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors: Details at https://graphviz.org
  9. *************************************************************************/
  10. #pragma once
  11. #include <Availability.h>
  12. #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
  13. #include <CoreGraphics/CoreGraphics.h>
  14. #elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
  15. #include <ApplicationServices/ApplicationServices.h>
  16. #endif
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. typedef enum {
  21. FORMAT_NONE,
  22. FORMAT_CGIMAGE,
  23. FORMAT_BMP,
  24. FORMAT_EXR,
  25. FORMAT_GIF,
  26. FORMAT_ICNS,
  27. FORMAT_ICO,
  28. FORMAT_JPEG,
  29. FORMAT_JPEG2000,
  30. FORMAT_PDF,
  31. FORMAT_PICT,
  32. FORMAT_PNG,
  33. FORMAT_PSD,
  34. FORMAT_SGI,
  35. FORMAT_TIFF,
  36. FORMAT_TGA
  37. } format_type;
  38. static const int BYTE_ALIGN = 15; /* align to 16 bytes */
  39. static const int BITS_PER_COMPONENT = 8; /* bits per color component */
  40. static const int BYTES_PER_PIXEL = 4; /* bytes per pixel */
  41. #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040 || __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 40000
  42. CFStringRef format_to_uti(format_type format);
  43. #endif
  44. extern CGDataConsumerCallbacks device_data_consumer_callbacks;
  45. /* gvtextlayout_quartz.c in Mac OS X: layout is a CoreText CTLineRef */
  46. /* GVTextLayout.m in iPhoneOS: layout is a custom Objective-C GVTextLayout */
  47. void *quartz_new_layout(char* fontname, double fontsize, char* text);
  48. void quartz_size_layout(void *layout, double* width, double* height, double* yoffset_layout);
  49. void quartz_draw_layout(void *layout, CGContextRef context, CGPoint position);
  50. void quartz_free_layout(void *layout);
  51. #ifdef __cplusplus
  52. }
  53. #endif