usershape.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /// @file
  2. /// @ingroup public_apis
  3. /// @ingroup common_render
  4. /*************************************************************************
  5. * Copyright (c) 2011 AT&T Intellectual Property
  6. * All rights reserved. This program and the accompanying materials
  7. * are made available under the terms of the Eclipse Public License v1.0
  8. * which accompanies this distribution, and is available at
  9. * https://www.eclipse.org/legal/epl-v10.html
  10. *
  11. * Contributors: Details at https://graphviz.org
  12. *************************************************************************/
  13. #pragma once
  14. #include "cdt.h"
  15. #include <stdbool.h>
  16. #include <stdio.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. typedef enum { FT_NULL,
  21. FT_BMP, FT_GIF, FT_PNG, FT_JPEG,
  22. FT_PDF, FT_PS, FT_EPS, FT_SVG, FT_XML,
  23. FT_RIFF, FT_WEBP, FT_ICO, FT_TIFF
  24. } imagetype_t;
  25. typedef enum {
  26. IMAGESCALE_FALSE, /* no image scaling */
  27. IMAGESCALE_TRUE, /* scale image to fit but keep aspect ratio */
  28. IMAGESCALE_WIDTH, /* scale image width to fit, keep height fixed */
  29. IMAGESCALE_HEIGHT, /* scale image height to fit, keep width fixed */
  30. IMAGESCALE_BOTH /* scale image to fit without regard for aspect ratio */
  31. } imagescale_t;
  32. typedef enum {
  33. IMAGEPOS_TOP_LEFT, /* top left */
  34. IMAGEPOS_TOP_CENTER, /* top center */
  35. IMAGEPOS_TOP_RIGHT, /* top right */
  36. IMAGEPOS_MIDDLE_LEFT, /* middle left */
  37. IMAGEPOS_MIDDLE_CENTER, /* middle center (true center, the default)*/
  38. IMAGEPOS_MIDDLE_RIGHT, /* middle right */
  39. IMAGEPOS_BOTTOM_LEFT, /* bottom left */
  40. IMAGEPOS_BOTTOM_CENTER, /* bottom center */
  41. IMAGEPOS_BOTTOM_RIGHT /* bottom right */
  42. } imagepos_t;
  43. typedef struct usershape_s usershape_t;
  44. struct usershape_s {
  45. Dtlink_t link;
  46. const char *name;
  47. int macro_id;
  48. bool must_inline;
  49. bool nocache;
  50. FILE *f;
  51. imagetype_t type;
  52. char *stringtype;
  53. double x, y, w, h;
  54. int dpi;
  55. void *data; /* data loaded by a renderer */
  56. size_t datasize; /* size of data (if mmap'ed) */
  57. void (*datafree)(usershape_t *us); /* renderer's function for freeing data */
  58. };
  59. #ifdef __cplusplus
  60. }
  61. #endif