Debian Codegraph @

sys/GraphicsP.h

raw symbols SCIP
1 #cxx . . $ `<file>/sys/GraphicsP.h`/ifndef _GraphicsP_h_
2 #define _GraphicsP_h_cxx . . $ `sys/GraphicsP.h:2:9`!
3 /* GraphicsP.h
4 *
5 * Copyright (C) 1992-2020,2022,2023 Paul Boersma, 2013 Tom Naughton
6 *
7 * This code is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
11 *
12 * This code is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 * See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this work. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "Graphics.h"cxx . . $ `<file>/sys/Graphics.h`/
22 #include "Gui.h"cxx . . $ `<file>/sys/Gui.h`/
23
24 #if defined (_WIN32)
25 #include <windowsx.h>
26 #include <gdiplus.h>
27 #endif
28
29 void Graphics_initcxx . . $ Graphics_init(9abe41586e87648d). (Graphicscxx . . $ Graphics# me, int resolution);
30 /*
31 Postconditions:
32 my font == Graphics_FONT_HELVETICA;
33 my fontSize == 9;
34 my fontStyle == Graphics_NORMAL;
35 */
36
37 #define kGraphics_font_SYMBOLcxx . . $ `sys/GraphicsP.h:37:9`! ((int) kGraphics_font::MAX + 1)
38 #define kGraphics_font_IPATIMEScxx . . $ `sys/GraphicsP.h:38:9`! ((int) kGraphics_font::MAX + 2)
39 #define kGraphics_font_IPAPALATINOcxx . . $ `sys/GraphicsP.h:39:9`! ((int) kGraphics_font::MAX + 3)
40 #define kGraphics_font_CHEROKEEcxx . . $ `sys/GraphicsP.h:40:9`! ((int) kGraphics_font::MAX + 4)
41 #define kGraphics_font_DINGBATScxx . . $ `sys/GraphicsP.h:41:9`! ((int) kGraphics_font::MAX + 5)
42 #define kGraphics_font_CHINESEcxx . . $ `sys/GraphicsP.h:42:9`! ((int) kGraphics_font::MAX + 6)
43 #define kGraphics_font_JAPANESEcxx . . $ `sys/GraphicsP.h:43:9`! ((int) kGraphics_font::MAX + 7)
44
45 /*
46 Honour the NO_GRAPHICS compiler switch.
47 */
48 #if defined (NO_GRAPHICS)
49 #define cairo 0
50 #define gdi 0
51 #define direct2d 0
52 #define quartz 0
53 #elif defined (UNIXcxx . . $ `<built-in>:479:9`!) /* include graphics even if there is no GUI, in order to be able to save PNG files */
54 #define cairocxx . . $ `sys/GraphicsP.h:54:10`! 1 /* Cairo, including Pango */
55 #define gdicxx . . $ `sys/GraphicsP.h:55:10`! 0
56 #define direct2dcxx . . $ `sys/GraphicsP.h:56:10`! 0
57 #define quartzcxx . . $ `sys/GraphicsP.h:57:10`! 0
58 #elif motif
59 #define cairo 0
60 #define gdi 1 /* to be discontinued when we no longer have to support Windows XP */
61 #define direct2d 0 /* for the future: Direct2D, including DirectWrite */
62 #define quartz 0
63 #elif cocoa
64 #define cairo 0
65 #define gdi 0
66 #define direct2d 0
67 #define quartz 1 /* Quartz, including CoreText */
68 #else
69 /*
70 Unknown platforms have no graphics.
71 */
72 #define cairo 0
73 #define gdi 0
74 #define direct2d 0
75 #define quartz 0
76 #endif
77
78 Thing_definecxx . . $ autoSomeThing# (GraphicsScreen, Graphics) {
79 bool d_isPngcxx . . $ structGraphicsScreen#d_isPng.;
80 structMelderFilecxx . . $ structMelderFile# d_filecxx . . $ structGraphicsScreen#d_file.;
81 #if defined (NO_GRAPHICS)
82 #elif cairocxx . . $ `sys/GraphicsP.h:54:10`!
83 #if gtkcxx . . $ `sys/Gui.h:33:10`!
84 GdkDisplay *d_displaycxx . . $ structGraphicsScreen#d_display.;
85 GdkWindow *d_windowcxx . . $ structGraphicsScreen#d_window.;
86 #endif
87 cairo_surface_t *d_cairoSurfacecxx . . $ structGraphicsScreen#d_cairoSurface.;
88 cairo_t *d_cairoGraphicsContextcxx . . $ structGraphicsScreen#d_cairoGraphicsContext.;
89 #elif gdi
90 HWND d_winWindow;
91 HDC d_gdiGraphicsContext;
92 COLORREF d_winForegroundColour;
93 HPEN d_winPen;
94 HBRUSH d_winBrush;
95 HDC d_savedDC;
96 bool d_useGdiplus;
97 HBITMAP d_gdiBitmap;
98 Gdiplus::Bitmap *d_gdiplusBitmap;
99 #elif quartz
100 NSView *d_macView;
101 int d_macFont, d_macStyle;
102 int d_depth;
103 uint8 *d_bits;
104 CGContextRef d_macGraphicsContext;
105 #endif
106
107 void v9_destroycxx . . $ structGraphicsScreen#v9_destroy(ced63f7c635d850d). () noexcept
108 override;
109 void v_polylinecxx . . $ structGraphicsScreen#v_polyline(5b88901669941a0f). (integercxx . . $ integer# numberOfPoints, double *xyDC, bool close)
110 override;
111 void v_fillAreacxx . . $ structGraphicsScreen#v_fillArea(e8815fae10d81e98). (integercxx . . $ integer# numberOfPoints, double *xyDC)
112 override;
113 void v_rectanglecxx . . $ structGraphicsScreen#v_rectangle(52a61fa14d44b641). (double x1DC, double x2DC, double y1DC, double y2DC)
114 override;
115 void v_fillRectanglecxx . . $ structGraphicsScreen#v_fillRectangle(52a61fa14d44b641). (double x1DC, double x2DC, double y1DC, double y2DC)
116 override;
117 void v_circlecxx . . $ structGraphicsScreen#v_circle(98dd472ac7e5c3d4). (double xDC, double yDC, double rDC)
118 override;
119 void v_ellipsecxx . . $ structGraphicsScreen#v_ellipse(52a61fa14d44b641). (double x1DC, double x2DC, double y1DC, double y2DC)
120 override;
121 void v_arccxx . . $ structGraphicsScreen#v_arc(a8d73491ea06a585). (double xDC, double yDC, double rDC, double fromAngle, double toAngle)
122 override;
123 void v_fillCirclecxx . . $ structGraphicsScreen#v_fillCircle(98dd472ac7e5c3d4). (double xDC, double yDC, double rDC)
124 override;
125 void v_fillEllipsecxx . . $ structGraphicsScreen#v_fillEllipse(52a61fa14d44b641). (double x1DC, double x2DC, double y1DC, double y2DC)
126 override;
127 void v_buttoncxx . . $ structGraphicsScreen#v_button(52a61fa14d44b641). (double x1DC, double x2DC, double y1DC, double y2DC)
128 override;
129 void v_roundedRectanglecxx . . $ structGraphicsScreen#v_roundedRectangle(a8d73491ea06a585). (double x1DC, double x2DC, double y1DC, double y2DC, double r)
130 override;
131 void v_arrowHeadcxx . . $ structGraphicsScreen#v_arrowHead(98dd472ac7e5c3d4). (double xDC, double yDC, double angle)
132 override;
133 void v_clearWscxx . . $ structGraphicsScreen#v_clearWs(49f6e7a06ebc5aa8). ()
134 override;
135 void v_updateWscxx . . $ structGraphicsScreen#v_updateWs(49f6e7a06ebc5aa8). ()
136 override;
137 };
138
139 Thing_definecxx . . $ autoGraphicsPostscript# (GraphicsPostscript, Graphics) {
140 FILE *d_filecxx . . $ structGraphicsPostscript#d_file.;
141 int (*d_printfcxx . . $ structGraphicsPostscript#d_printf.) (void *stream, const char *format, ...);
142 int languageLevelcxx . . $ structGraphicsPostscript#languageLevel.;
143 int photocopyablecxx . . $ structGraphicsPostscript#photocopyable., spotsDensitycxx . . $ structGraphicsPostscript#spotsDensity., spotsAnglecxx . . $ structGraphicsPostscript#spotsAngle.;
144 bool loadedXipacxx . . $ structGraphicsPostscript#loadedXipa., useSilipaPScxx . . $ structGraphicsPostscript#useSilipaPS., landscapecxx . . $ structGraphicsPostscript#landscape., includeFontscxx . . $ structGraphicsPostscript#includeFonts.;
145 double magnificationcxx . . $ structGraphicsPostscript#magnification.;
146 char *fontInfoscxx . . $ structGraphicsPostscript#fontInfos. [1 + kGraphics_font_DINGBATScxx . . $ kGraphics_font#] [1 + Graphics_BOLD_ITALICcxx . . $ `sys/Graphics.h:264:9`!];
147 const char *lastFidcxx . . $ structGraphicsPostscript#lastFid.;
148 int pageNumbercxx . . $ structGraphicsPostscript#pageNumber., lastSizecxx . . $ structGraphicsPostscript#lastSize.;
149 bool jobcxx . . $ structGraphicsPostscript#job., epscxx . . $ structGraphicsPostscript#eps.;
150
151 void v9_destroycxx . . $ structGraphicsPostscript#v9_destroy(ced63f7c635d850d). () noexcept
152 override;
153 void v_polylinecxx . . $ structGraphicsPostscript#v_polyline(5b88901669941a0f). (integercxx . . $ integer# numberOfPoints, double *xyDC, bool close)
154 override;
155 void v_fillAreacxx . . $ structGraphicsPostscript#v_fillArea(e8815fae10d81e98). (integercxx . . $ integer# numberOfPoints, double *xyDC)
156 override;
157 void v_rectanglecxx . . $ structGraphicsPostscript#v_rectangle(52a61fa14d44b641). (double x1DC, double x2DC, double y1DC, double y2DC)
158 override;
159 void v_fillRectanglecxx . . $ structGraphicsPostscript#v_fillRectangle(52a61fa14d44b641). (double x1DC, double x2DC, double y1DC, double y2DC)
160 override;
161 void v_circlecxx . . $ structGraphicsPostscript#v_circle(98dd472ac7e5c3d4). (double xDC, double yDC, double rDC)
162 override;
163 void v_ellipsecxx . . $ structGraphicsPostscript#v_ellipse(52a61fa14d44b641). (double x1DC, double x2DC, double y1DC, double y2DC)
164 override;
165 void v_arccxx . . $ structGraphicsPostscript#v_arc(a8d73491ea06a585). (double xDC, double yDC, double rDC, double fromAngle, double toAngle)
166 override;
167 void v_fillCirclecxx . . $ structGraphicsPostscript#v_fillCircle(98dd472ac7e5c3d4). (double xDC, double yDC, double rDC)
168 override;
169 void v_fillEllipsecxx . . $ structGraphicsPostscript#v_fillEllipse(52a61fa14d44b641). (double x1DC, double x2DC, double y1DC, double y2DC)
170 override;
171 void v_arrowHeadcxx . . $ structGraphicsPostscript#v_arrowHead(98dd472ac7e5c3d4). (double xDC, double yDC, double angle)
172 override;
173 };
174
175 /* Opcodes for recording. */
176
177 double * _Graphics_checkcxx . . $ _Graphics_check(735eb71fbf9ef8fb). (Graphicscxx . . $ Graphics# me, integercxx . . $ integer# number);
178 #define putcxx . . $ `sys/GraphicsP.h:178:9`!(f) * ++ p = (double) (f)
179 #define opcxx . . $ `sys/GraphicsP.h:179:9`!(opcode,number) double *p = _Graphics_check (me, number); if (! p) return; putcxx . . $ `sys/GraphicsP.h:178:9`! (opcode); putcxx . . $ `sys/GraphicsP.h:178:9`! (number)
180 #define mputcxx . . $ `sys/GraphicsP.h:180:9`!(n,a) { const double *f = a; for (integer l = 0; l < n; l ++) putcxx . . $ `sys/GraphicsP.h:178:9`! (f [l]); }
181 #define sputcxx . . $ `sys/GraphicsP.h:181:9`!(s,l) { put (l); strcpy ((char *) (p + 1), s); p += l; }
182
183 /* When adding opcodes in the following list, add them at the end. */
184 /* Otherwise, old picture files will become incompatible with the current Graphics. */
185 enum opcodecxx . . $ opcode# { SET_VIEWPORTcxx . . $ SET_VIEWPORT. = 101, SET_INNERcxx . . $ SET_INNER., UNSET_INNERcxx . . $ UNSET_INNER., SET_WINDOWcxx . . $ SET_WINDOW.,
186 /* 105 */ TEXTcxx . . $ TEXT., POLYLINEcxx . . $ POLYLINE., LINEcxx . . $ LINE., ARROWcxx . . $ ARROW., FILL_AREAcxx . . $ FILL_AREA., FUNCTIONcxx . . $ FUNCTION., RECTANGLEcxx . . $ RECTANGLE., FILL_RECTANGLEcxx . . $ FILL_RECTANGLE.,
187 /* 113 */ CIRCLEcxx . . $ CIRCLE., FILL_CIRCLEcxx . . $ FILL_CIRCLE., ARCcxx . . $ ARC., ARC_ARROWcxx . . $ ARC_ARROW., HIGHLIGHTcxx . . $ HIGHLIGHT., CELL_ARRAYcxx . . $ CELL_ARRAY.,
188 /* 119 */ SET_FONTcxx . . $ SET_FONT., SET_FONT_SIZEcxx . . $ SET_FONT_SIZE., SET_FONT_STYLEcxx . . $ SET_FONT_STYLE.,
189 /* 122 */ SET_TEXT_ALIGNMENTcxx . . $ SET_TEXT_ALIGNMENT., SET_TEXT_ROTATIONcxx . . $ SET_TEXT_ROTATION.,
190 /* 124 */ SET_LINE_TYPEcxx . . $ SET_LINE_TYPE., SET_LINE_WIDTHcxx . . $ SET_LINE_WIDTH.,
191 /* 126 */ SET_STANDARD_COLOURcxx . . $ SET_STANDARD_COLOUR., SET_GREYcxx . . $ SET_GREY.,
192 /* 128 */ MARK_GROUPcxx . . $ MARK_GROUP., ELLIPSEcxx . . $ ELLIPSE., FILL_ELLIPSEcxx . . $ FILL_ELLIPSE., CIRCLE_MMcxx . . $ CIRCLE_MM., FILL_CIRCLE_MMcxx . . $ FILL_CIRCLE_MM., IMAGE8cxx . . $ IMAGE8.,
193 /* 134 */ UNHIGHLIGHTcxx . . $ UNHIGHLIGHT., XOR_ONcxx . . $ XOR_ON., XOR_OFFcxx . . $ XOR_OFF., RECTANGLE_MMcxx . . $ RECTANGLE_MM., FILL_RECTANGLE_MMcxx . . $ FILL_RECTANGLE_MM.,
194 /* 139 */ SET_WS_WINDOWcxx . . $ SET_WS_WINDOW., SET_WRAP_WIDTHcxx . . $ SET_WRAP_WIDTH., SET_SECOND_INDENTcxx . . $ SET_SECOND_INDENT.,
195 /* 142 */ SET_PERCENT_SIGN_IS_ITALICcxx . . $ SET_PERCENT_SIGN_IS_ITALIC., SET_NUMBER_SIGN_IS_BOLDcxx . . $ SET_NUMBER_SIGN_IS_BOLD.,
196 /* 144 */ SET_CIRCUMFLEX_IS_SUPERSCRIPTcxx . . $ SET_CIRCUMFLEX_IS_SUPERSCRIPT., SET_UNDERSCORE_IS_SUBSCRIPTcxx . . $ SET_UNDERSCORE_IS_SUBSCRIPT.,
197 /* 146 */ SET_DOLLAR_SIGN_IS_CODEcxx . . $ SET_DOLLAR_SIGN_IS_CODE., SET_AT_SIGN_IS_LINKcxx . . $ SET_AT_SIGN_IS_LINK.,
198 /* 148 */ BUTTONcxx . . $ BUTTON., ROUNDED_RECTANGLEcxx . . $ ROUNDED_RECTANGLE., FILL_ROUNDED_RECTANGLEcxx . . $ FILL_ROUNDED_RECTANGLE., FILL_ARCcxx . . $ FILL_ARC.,
199 /* 152 */ INNER_RECTANGLEcxx . . $ INNER_RECTANGLE., CELL_ARRAY8cxx . . $ CELL_ARRAY8., IMAGEcxx . . $ IMAGE., HIGHLIGHT2cxx . . $ HIGHLIGHT2., UNHIGHLIGHT2cxx . . $ UNHIGHLIGHT2.,
200 /* 157 */ SET_ARROW_SIZEcxx . . $ SET_ARROW_SIZE., DOUBLE_ARROWcxx . . $ DOUBLE_ARROW., SET_RGB_COLOURcxx . . $ SET_RGB_COLOUR., IMAGE_FROM_FILEcxx . . $ IMAGE_FROM_FILE.,
201 /* 161 */ POLYLINE_CLOSEDcxx . . $ POLYLINE_CLOSED., CELL_ARRAY_COLOURcxx . . $ CELL_ARRAY_COLOUR., IMAGE_COLOURcxx . . $ IMAGE_COLOUR., SET_COLOUR_SCALEcxx . . $ SET_COLOUR_SCALE.,
202 /* 165 */ SET_SPECKLE_SIZEcxx . . $ SET_SPECKLE_SIZE., SPECKLEcxx . . $ SPECKLE., CLEAR_WScxx . . $ CLEAR_WS., SET_BACKQUOTE_IS_VERBATIMcxx . . $ SET_BACKQUOTE_IS_VERBATIM.,
203 /* 169 */ RECTANGLE_TEXT_WRAP_AND_TRUNCATEcxx . . $ RECTANGLE_TEXT_WRAP_AND_TRUNCATE., RECTANGLE_TEXT_MAXIMAL_FITcxx . . $ RECTANGLE_TEXT_MAXIMAL_FIT.
204 };
205
206 void _GraphicsScreen_text_initcxx . . $ _GraphicsScreen_text_init(2eab33b16e3c36be). (GraphicsScreencxx . . $ GraphicsScreen# me);
207 void _Graphics_fillRectanglecxx . . $ _Graphics_fillRectangle(4ffe5bb10b2fb6bd). (Graphicscxx . . $ Graphics# me, integercxx . . $ integer# x1DC, integercxx . . $ integer# x2DC, integercxx . . $ integer# y1DC, integercxx . . $ integer# y2DC);
208 void _Graphics_setColourcxx . . $ _Graphics_setColour(eb47b9513d3f4721). (Graphicscxx . . $ Graphics# me, MelderColourcxx . . $ MelderColour# colour);
209 void _Graphics_setGreycxx . . $ _Graphics_setGrey(2514a1c07b6be5e2). (Graphicscxx . . $ Graphics# me, double grey);
210 void _Graphics_colour_initcxx . . $ _Graphics_colour_init(2d838ed765120c5d). (Graphicscxx . . $ Graphics# me);
211 bool _GraphicsMac_tryToInitializeFontscxx . . $ _GraphicsMac_tryToInitializeFonts(c9857a73d68e59ba). ();
212 bool _GraphicsLin_tryToInitializeFontscxx . . $ _GraphicsLin_tryToInitializeFonts(c9857a73d68e59ba). ();
213
214 extern enum kGraphics_cjkFontStylecxx . . $ kGraphics_cjkFontStyle# theGraphicsCjkFontStylecxx . . $ theGraphicsCjkFontStyle.;
215
216 /* End of file GraphicsP.h */
217 #endif