Debian Codegraph @

sys/Graphics_image.cpp

raw symbols SCIP
1 /* Graphics_image.cpp
2 *
3 * Copyright (C) 1992-2021,2024-2026 Paul Boersma
4 *
5 * This code is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
9 *
10 * This code is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this work. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "GraphicsP.h"cxx . . $ `<file>/sys/GraphicsP.h`/
20
21 #include "../fon/Photo.h"cxx . . $ `<file>/fon/Photo.h`/
22
23 #if gdicxx . . $ `sys/GraphicsP.h:55:10`!
24 #include <gdiplus.h>
25 #elif quartzcxx . . $ `sys/GraphicsP.h:57:10`!
26 #include <time.h>
27 #include "macport_on.h"
28 static void _mac_releaseDataCallback (void *info, const void *data, size_t size) {
29 (void) info;
30 (void) size;
31 Melder_free (data);
32 }
33 #endif
34
35 #define wdxcxx . . $ `sys/Graphics_image.cpp:35:9`!(x) ((x) * mycxx . . $ `melder/melder.h:44:9`! scaleX + mycxx . . $ `melder/melder.h:44:9`! deltaX)
36 #define wdycxx . . $ `sys/Graphics_image.cpp:36:9`!(y) ((y) * mycxx . . $ `melder/melder.h:44:9`! scaleY + mycxx . . $ `melder/melder.h:44:9`! deltaY)
37
38 static void _GraphicsScreen_cellArrayOrImagecxx . . $ _GraphicsScreen_cellArrayOrImage(c53f2774d0404b49). (GraphicsScreencxx . . $ GraphicsScreen# me,
39 constMATVUcxx . . $ constMATVU# const& z_float, constmatrixviewcxx . . $ constmatrixview# <MelderColourcxx . . $ MelderColour#> const& z_rgbt, constmatrixviewcxx . . $ constmatrixview# <unsigned char> const& z_byte,
40 integercxx . . $ integer# ix1, integercxx . . $ integer# ix2, integercxx . . $ integer# x1DC, integercxx . . $ integer# x2DC,
41 integercxx . . $ integer# iy1, integercxx . . $ integer# iy2, integercxx . . $ integer# y1DC, integercxx . . $ integer# y2DC,
42 double minimum, double maximum,
43 integercxx . . $ integer# clipx1, integercxx . . $ integer# clipx2, integercxx . . $ integer# clipy1, integercxx . . $ integer# clipy2, bool interpolate)
44 {
45 /*double t=Melder_clock();*/
46 integercxx . . $ integer# nx = ix2 - ix1 + 1; /* The number of cells along the horizontal axis. */
47 integercxx . . $ integer# ny = iy2 - iy1 + 1; /* The number of cells along the vertical axis. */
48 double dx = (double) (x2DC - x1DC) / (double) nx; /* Horizontal pixels per cell. Positive. */
49 double dy = (double) (y2DC - y1DC) / (double) ny; /* Vertical pixels per cell. Negative. */
50 double scale = 255.0 / (maximum - minimum), offset = 255.0 + minimum * scale;
51 if (x2DC <= x1DC || y1DC <= y2DC) return;
52 tracecxx . . $ `melder/melder_debug.h:60:10`! (U"scale ", scale);
53 /* Clip by the intersection of the world window and the outline of the cells. */
54 //Melder_casual (U"clipy1 ", clipy1, U" clipy2 ", clipy2);
55 if (clipx1 < x1DC) clipx1 = x1DC;
56 if (clipx2 > x2DC) clipx2 = x2DC;
57 if (clipy1 > y1DC) clipy1 = y1DC;
58 if (clipy2 < y2DC) clipy2 = y2DC;
59 /*
60 * The first decision is whether we are going to use the standard rectangle drawing
61 * (cellArray only), or whether we are going to write into a bitmap.
62 * The standard drawing is best for small numbers of cells,
63 * provided that some cells are larger than a pixel.
64 */
65 if (! interpolate && nx * ny < 3000 && (dx > 1.0 || dy < -1.0)) {
66 try {
67 /*unsigned int cellWidth = (unsigned int) dx + 1;*/
68 unsigned int cellHeight = (unsigned int) (- (int) dy) + 1;
69 integercxx . . $ integer# ix, iy;
70 #if cairocxx . . $ `sys/GraphicsP.h:54:10`!
71 cairo_pattern_t *grey [256];
72 for (int igrey = 0; igrey < sizeof (grey) / sizeof (*grey); igrey ++) {
73 double v = igrey / ((double) (sizeof (grey) / sizeof (*grey)) - 1.0);
74 grey [igrey] = cairo_pattern_create_rgb (v, v, v);
75 }
76 #elif gdi
77 static HBRUSH greyBrush [256];
78 RECT rect;
79 if (! greyBrush [0])
80 for (int igrey = 0; igrey <= 255; igrey ++)
81 greyBrush [igrey] = CreateSolidBrush (RGB (igrey, igrey, igrey)); // once
82 #elif quartz
83 CGContextSetAlpha (my d_macGraphicsContext, 1.0);
84 CGContextSetBlendMode (my d_macGraphicsContext, kCGBlendModeNormal);
85 #endif
86 autoINTVECcxx . . $ autoINTVEC# leftsBuffer = zero_INTVECcxx . . $ zero_INTVEC(dab5d3ef28d6a25). (ix2 - ix1 + 2);
87 integercxx . . $ integer# *lefts = & leftsBuffer [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1 - ix1];
88 for (ix = ix1; ix <= ix2 + 1; ix ++)
89 lefts [ix] = x1DC + (integercxx . . $ integer#) ((ix - ix1) * dx);
90 for (iy = iy1; iy <= iy2; iy ++) {
91 integercxx . . $ integer# bottom = y1DC + (integercxx . . $ integer#) ((iy - iy1) * dy), top = bottom - cellHeight;
92 if (top > clipy1 || bottom < clipy2)
93 continue;
94 Melder_clipLeftcxx . . $ Melder_clipLeft(6245cd023a7d1552). (clipy2, & top);
95 Melder_clipRightcxx . . $ Melder_clipRight(5b63ce711df1ade7). (& bottom, clipy1);
96 #if gdicxx . . $ `sys/GraphicsP.h:55:10`!
97 rect. bottom = bottom;
98 rect. top = top;
99 #endif
100 for (ix = ix1; ix <= ix2; ix ++) {
101 integercxx . . $ integer# left = lefts [ix], right = lefts [ix + 1];
102 if (right < clipx1 || left > clipx2)
103 continue;
104 Melder_clipLeftcxx . . $ Melder_clipLeft(6245cd023a7d1552). (clipx1, & left);
105 Melder_clipRightcxx . . $ Melder_clipRight(5b63ce711df1ade7). (& right, clipx2);
106 if (! NUMisEmptycxx . . $ NUMisEmpty(939f42bb6b0c0c9c). (z_rgbt)) {
107 #if cairocxx . . $ `sys/GraphicsP.h:54:10`!
108 // NYI
109 #elif gdi
110 // NYI
111 #elif quartz
112 double red = z_rgbt [iy] [ix]. red;
113 double green = z_rgbt [iy] [ix]. green;
114 double blue = z_rgbt [iy] [ix]. blue;
115 double transparency = z_rgbt [iy] [ix]. transparency;
116 Melder_clip (0.0, & red, 1.0);
117 Melder_clip (0.0, & green, 1.0);
118 Melder_clip (0.0, & blue, 1.0);
119 CGContextSetRGBFillColor (my d_macGraphicsContext, red, green, blue, 1.0 - transparency);
120 CGContextFillRect (my d_macGraphicsContext, CGRectMake (left, top, right - left, bottom - top));
121 #endif
122 } else {
123 #if cairocxx . . $ `sys/GraphicsP.h:54:10`!
124 integercxx . . $ integer# value = offset - scale * ( ! NUMisEmptycxx . . $ NUMisEmpty(939f42bb6b0c0c9c). (z_float) ? z_float [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).iy] [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ix] : z_byte [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).iy] [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ix] );
125 cairo_set_source (mycxx . . $ `melder/melder.h:44:9`! d_cairoGraphicsContextcxx . . $ structGraphicsScreen#d_cairoGraphicsContext., grey [value <= 0 ? 0 : value >= sizeof (grey) / sizeof (*grey) ? sizeof (grey) / sizeof (*grey) : value]);
126 cairo_rectangle (mycxx . . $ `melder/melder.h:44:9`! d_cairoGraphicsContextcxx . . $ structGraphicsScreen#d_cairoGraphicsContext., left, top, right - left, bottom - top);
127 cairo_fill (mycxx . . $ `melder/melder.h:44:9`! d_cairoGraphicsContextcxx . . $ structGraphicsScreen#d_cairoGraphicsContext.);
128 #elif gdi
129 integer value = offset - scale * ( ! NUMisEmpty (z_float) ? z_float [iy] [ix] : z_byte [iy] [ix] );
130 rect. left = left; rect. right = right;
131 FillRect (my d_gdiGraphicsContext, & rect, greyBrush [value <= 0 ? 0 : value >= 255 ? 255 : value]);
132 #elif quartz
133 double value = offset - scale * ( ! NUMisEmpty (z_float) ? z_float [iy] [ix] : z_byte [iy] [ix] );
134 double igrey = ( value <= 0 ? 0 : value >= 255 ? 255 : value ) / 255.0;
135 CGContextSetRGBFillColor (my d_macGraphicsContext, igrey, igrey, igrey, 1.0);
136 CGContextFillRect (my d_macGraphicsContext, CGRectMake (left, top, right - left, bottom - top));
137 #endif
138 }
139 }
140 }
141
142 #if cairocxx . . $ `sys/GraphicsP.h:54:10`!
143 for (int igrey = 0; igrey < sizeof (grey) / sizeof (*grey); igrey ++)
144 cairo_pattern_destroy (grey [igrey]);
145 #elif quartz
146 CGContextSetRGBFillColor (my d_macGraphicsContext, 0.0, 0.0, 0.0, 1.0);
147 #endif
148 } catch (MelderErrorcxx . . $ MelderError#) { }
149 } else {
150 integercxx . . $ integer# xDC, yDC;
151 integercxx . . $ integer# undersampling = 1;
152 /*
153 * Prepare for off-screen bitmap drawing.
154 */
155 #if cairocxx . . $ `sys/GraphicsP.h:54:10`!
156 integercxx . . $ integer# arrayWidth = clipx2 - clipx1;
157 integercxx . . $ integer# arrayHeight = clipy1 - clipy2;
158 tracecxx . . $ `melder/melder_debug.h:60:10`! (U"arrayWidth ", arrayWidth, U", arrayHeight ", arrayHeight);
159 cairo_surface_t *sfc = cairo_image_surface_create (CAIRO_FORMAT_RGB24, arrayWidth, arrayHeight);
160 unsigned char *bits = cairo_image_surface_get_data (sfc);
161 int scanLineLength = cairo_image_surface_get_stride (sfc);
162 unsigned char grey [256];
163 tracecxx . . $ `melder/melder_debug.h:60:10`! (
164 U"image surface address ", Melder_pointer (sfc),
165 U", bits address ", Melder_pointer (bits),
166 U", scanLineLength ", scanLineLength,
167 U", numberOfGreys ", sizeof (grey) / sizeof (*grey)
168 );
169 for (int igrey = 0; igrey < sizeof (grey) / sizeof (*grey); igrey++)
170 grey [igrey] = 255 - (unsigned char) (igrey * 255.0 / (sizeof (grey) / sizeof (*grey) - 1));
171 #elif gdi
172 integer bitmapWidth = clipx2 - clipx1, bitmapHeight = clipy1 - clipy2;
173 int igrey;
174 /*
175 * Create a device-independent bitmap, 32 bits deep.
176 */
177 struct { BITMAPINFOHEADER header; } bitmapInfo;
178 integer scanLineLength = bitmapWidth * 4; // for 24 bits: (bitmapWidth * 3 + 3) & ~3L;
179 HBITMAP bitmap;
180 unsigned char *bits; // a pointer to memory allocated by VirtualAlloc or by CreateDIBSection ()
181 bitmapInfo. header.biSize = sizeof (BITMAPINFOHEADER);
182 bitmapInfo. header.biWidth = bitmapWidth; // scanLineLength;
183 bitmapInfo. header.biHeight = bitmapHeight;
184 bitmapInfo. header.biPlanes = 1;
185 bitmapInfo. header.biBitCount = 32;
186 bitmapInfo. header.biCompression = 0;
187 bitmapInfo. header.biSizeImage = 0;
188 bitmapInfo. header.biXPelsPerMeter = 0;
189 bitmapInfo. header.biYPelsPerMeter = 0;
190 bitmapInfo. header.biClrUsed = 0;
191 bitmapInfo. header.biClrImportant = 0;
192 bitmap = CreateDIBSection (my d_gdiGraphicsContext /* ignored */, (CONST BITMAPINFO *) & bitmapInfo,
193 DIB_RGB_COLORS, (VOID **) & bits, nullptr, 0);
194 #elif quartz
195 integer bytesPerRow = (clipx2 - clipx1) * 4;
196 Melder_assert (bytesPerRow > 0);
197 integer numberOfRows = clipy1 - clipy2;
198 Melder_assert (numberOfRows > 0);
199 unsigned char *imageData = Melder_malloc_f (unsigned char, bytesPerRow * numberOfRows);
200 #endif
201 /*
202 * Draw into the bitmap.
203 */
204 #if cairocxx . . $ `sys/GraphicsP.h:54:10`!
205 #define ROW_START_ADDRESScxx . . $ `sys/Graphics_image.cpp:205:12`! (bits + (clipy1 - 1 - yDC) * scanLineLength)
206 #define PUT_PIXELcxx . . $ `sys/Graphics_image.cpp:206:12`! \
207 if (1) { \
208 unsigned char kar = value <= 0 ? 0 : value >= 255 ? 255 : (int) value; \
209 *pixelAddress ++ = kar; \
210 *pixelAddress ++ = kar; \
211 *pixelAddress ++ = kar; \
212 *pixelAddress ++ = 0; \
213 }
214 #elif gdi
215 #define ROW_START_ADDRESS (bits + (clipy1 - 1 - yDC) * scanLineLength)
216 #define PUT_PIXEL \
217 if (1) { \
218 unsigned char kar = value <= 0 ? 0 : value >= 255 ? 255 : (int) value; \
219 *pixelAddress ++ = kar; \
220 *pixelAddress ++ = kar; \
221 *pixelAddress ++ = kar; \
222 *pixelAddress ++ = 0; \
223 }
224 #elif quartz
225 #define ROW_START_ADDRESS (imageData + (clipy1 - 1 - yDC) * bytesPerRow)
226 #define PUT_PIXEL \
227 if (my colourScale == kGraphics_colourScale::GREY) { \
228 unsigned char kar = value <= 0 ? 0 : value >= 255 ? 255 : (int) value; \
229 *pixelAddress ++ = kar; \
230 *pixelAddress ++ = kar; \
231 *pixelAddress ++ = kar; \
232 *pixelAddress ++ = 255; \
233 } else if (my colourScale == kGraphics_colourScale::BLUE_TO_RED) { \
234 if (value < 0.0) { \
235 *pixelAddress ++ = 0; \
236 *pixelAddress ++ = 0; \
237 *pixelAddress ++ = 63; \
238 *pixelAddress ++ = 255; \
239 } else if (value < 64.0) { \
240 *pixelAddress ++ = 0; \
241 *pixelAddress ++ = 0; \
242 *pixelAddress ++ = (int) (value * 3 + 63.999); \
243 *pixelAddress ++ = 255; \
244 } else if (value < 128.0) { \
245 *pixelAddress ++ = (int) (value * 4 - 256.0); \
246 *pixelAddress ++ = (int) (value * 4 - 256.0); \
247 *pixelAddress ++ = 255; \
248 *pixelAddress ++ = 255; \
249 } else if (value < 192.0) { \
250 *pixelAddress ++ = 255; \
251 *pixelAddress ++ = (int) ((256.0 - value) * 4 - 256.0); \
252 *pixelAddress ++ = (int) ((256.0 - value) * 4 - 256.0); \
253 *pixelAddress ++ = 255; \
254 } else if (value < 256.0) { \
255 *pixelAddress ++ = (int) ((256.0 - value) * 3 + 63.999); \
256 *pixelAddress ++ = 0; \
257 *pixelAddress ++ = 0; \
258 *pixelAddress ++ = 255; \
259 } else { \
260 *pixelAddress ++ = 63; \
261 *pixelAddress ++ = 0; \
262 *pixelAddress ++ = 0; \
263 *pixelAddress ++ = 255; \
264 } \
265 }
266 #else
267 #define ROW_START_ADDRESS nullptr
268 #define PUT_PIXEL
269 #endif
270 if (interpolate) {
271 try {
272 autoINTVECcxx . . $ autoINTVEC# ileftBuffer = zero_INTVECcxx . . $ zero_INTVEC(dab5d3ef28d6a25). (clipx2 - clipx1 + 1);
273 autoINTVECcxx . . $ autoINTVEC# irightBuffer = zero_INTVECcxx . . $ zero_INTVEC(dab5d3ef28d6a25). (clipx2 - clipx1 + 1);
274 autoVECcxx . . $ autoVEC# leftWeightBuffer = zero_VECcxx . . $ zero_VEC(e4395f764b859b1e). (clipx2 - clipx1 + 1);
275 autoVECcxx . . $ autoVEC# rightWeightBuffer = zero_VECcxx . . $ zero_VEC(e4395f764b859b1e). (clipx2 - clipx1 + 1);
276 integercxx . . $ integer# *ileft = & ileftBuffer [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1 - clipx1];
277 integercxx . . $ integer# *iright = & irightBuffer [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1 - clipx1];
278 double *leftWeight = & leftWeightBuffer [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1 - clipx1];
279 double *rightWeight = & rightWeightBuffer [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1 - clipx1];
280 for (xDC = clipx1; xDC < clipx2; xDC += undersampling) {
281 double ix_real = ix1 - 0.5 + ((double) nx * (xDC - x1DC)) / (x2DC - x1DC);
282 ileft [xDC] = (integercxx . . $ integer#) floorcxx . . $ floor(fee4f1d22bc8e617). (ix_real), iright [xDC] = ileft [xDC] + 1;
283 rightWeight [xDC] = ix_real - ileft [xDC];
284 leftWeight [xDC] = 1.0 - rightWeight [xDC];
285 if (ileft [xDC] < ix1)
286 ileft [xDC] = ix1;
287 if (iright [xDC] > ix2)
288 iright [xDC] = ix2;
289 }
290 for (yDC = clipy2; yDC < clipy1; yDC += undersampling) {
291 double iy_real = iy2 + 0.5 - ((double) ny * (yDC - y2DC)) / (y1DC - y2DC);
292 integercxx . . $ integer# itop = Melder_iceilingcxx . . $ `melder/melder_ftoi.h:45:9`! (iy_real), ibottom = itop - 1;
293 double bottomWeight = itop - iy_real, topWeight = 1.0 - bottomWeight;
294 unsigned char *pixelAddress = ROW_START_ADDRESScxx . . $ `sys/Graphics_image.cpp:205:12`!;
295 if (itop > iy2) itop = iy2;
296 if (ibottom < iy1) ibottom = iy1;
297 if (! NUMisEmptycxx . . $ NUMisEmpty(939f42bb6b0c0c9c). (z_float)) {
298 constVECVUcxx . . $ constVECVU# ztop = z_float [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).itop], zbottom = z_float [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).ibottom];
299 for (xDC = clipx1; xDC < clipx2; xDC += undersampling) {
300 double interpol =
301 rightWeight [xDC] *
302 (topWeight * ztop [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).iright [xDC]] + bottomWeight * zbottom [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).iright [xDC]]) +
303 leftWeight [xDC] *
304 (topWeight * ztop [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ileft [xDC]] + bottomWeight * zbottom [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ileft [xDC]]);
305 double value = offset - scale * interpol;
306 PUT_PIXELcxx . . $ `sys/Graphics_image.cpp:206:12`!
307 }
308 } else if (! NUMisEmptycxx . . $ NUMisEmpty(939f42bb6b0c0c9c). (z_rgbt)) {
309 constvectorviewcxx . . $ constvectorview# <MelderColourcxx . . $ MelderColour#> ztop = z_rgbt [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).itop], zbottom = z_rgbt [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).ibottom];
310 for (xDC = clipx1; xDC < clipx2; xDC += undersampling) {
311 double red =
312 rightWeight [xDC] * (topWeight * ztop [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).iright [xDC]]. redcxx . . $ MelderColour#red. + bottomWeight * zbottom [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).iright [xDC]]. redcxx . . $ MelderColour#red.) +
313 leftWeight [xDC] * (topWeight * ztop [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ileft [xDC]]. redcxx . . $ MelderColour#red. + bottomWeight * zbottom [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ileft [xDC]]. redcxx . . $ MelderColour#red.);
314 double green =
315 rightWeight [xDC] * (topWeight * ztop [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).iright [xDC]]. greencxx . . $ MelderColour#green. + bottomWeight * zbottom [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).iright [xDC]]. greencxx . . $ MelderColour#green.) +
316 leftWeight [xDC] * (topWeight * ztop [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ileft [xDC]]. greencxx . . $ MelderColour#green. + bottomWeight * zbottom [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ileft [xDC]]. greencxx . . $ MelderColour#green.);
317 double blue =
318 rightWeight [xDC] * (topWeight * ztop [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).iright [xDC]]. bluecxx . . $ MelderColour#blue. + bottomWeight * zbottom [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).iright [xDC]]. bluecxx . . $ MelderColour#blue.) +
319 leftWeight [xDC] * (topWeight * ztop [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ileft [xDC]]. bluecxx . . $ MelderColour#blue. + bottomWeight * zbottom [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ileft [xDC]]. bluecxx . . $ MelderColour#blue.);
320 double transparency =
321 rightWeight [xDC] * (topWeight * ztop [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).iright [xDC]]. transparencycxx . . $ MelderColour#transparency. + bottomWeight * zbottom [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).iright [xDC]]. transparencycxx . . $ MelderColour#transparency.) +
322 leftWeight [xDC] * (topWeight * ztop [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ileft [xDC]]. transparencycxx . . $ MelderColour#transparency. + bottomWeight * zbottom [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ileft [xDC]]. transparencycxx . . $ MelderColour#transparency.);
323 Melder_clipcxx . . $ Melder_clip(971c667ea412f82c). (0.0, & red, 1.0);
324 Melder_clipcxx . . $ Melder_clip(971c667ea412f82c). (0.0, & green, 1.0);
325 Melder_clipcxx . . $ Melder_clip(971c667ea412f82c). (0.0, & blue, 1.0);
326 Melder_clipcxx . . $ Melder_clip(971c667ea412f82c). (0.0, & transparency, 1.0);
327
328 #if cairocxx . . $ `sys/GraphicsP.h:54:10`!
329 *pixelAddress ++ = blue * 255.0;
330 *pixelAddress ++ = green * 255.0;
331 *pixelAddress ++ = red * 255.0;
332 *pixelAddress ++ = transparency * 255.0;
333 #elif gdi
334 *pixelAddress ++ = blue * 255.0;
335 *pixelAddress ++ = green * 255.0;
336 *pixelAddress ++ = red * 255.0;
337 *pixelAddress ++ = 0;
338 #elif quartz
339 *pixelAddress ++ = red * 255.0;
340 *pixelAddress ++ = green * 255.0;
341 *pixelAddress ++ = blue * 255.0;
342 *pixelAddress ++ = (1.0 - transparency) * 255.0;
343 #endif
344 }
345 } else {
346 constvectorviewcxx . . $ constvectorview# <unsigned char> ztop = z_byte [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).itop], zbottom = z_byte [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).ibottom];
347 for (xDC = clipx1; xDC < clipx2; xDC += undersampling) {
348 double interpol =
349 rightWeight [xDC] *
350 (topWeight * ztop [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).iright [xDC]] + bottomWeight * zbottom [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).iright [xDC]]) +
351 leftWeight [xDC] *
352 (topWeight * ztop [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ileft [xDC]] + bottomWeight * zbottom [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ileft [xDC]]);
353 double value = offset - scale * interpol;
354 PUT_PIXELcxx . . $ `sys/Graphics_image.cpp:206:12`!
355 }
356 }
357 }
358 } catch (MelderErrorcxx . . $ MelderError#) {
359 Melder_clearErrorcxx . . $ Melder_clearError(49f6e7a06ebc5aa8). ();
360 }
361 } else {
362 try {
363 autoINTVECcxx . . $ autoINTVEC# ixBuffer = zero_INTVECcxx . . $ zero_INTVEC(dab5d3ef28d6a25). (clipx2 - clipx1 + 1);
364 integercxx . . $ integer# *ix = & ixBuffer [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1 - clipx1];
365 for (xDC = clipx1; xDC < clipx2; xDC += undersampling)
366 ix [xDC] = Melder_ifloorcxx . . $ `melder/melder_ftoi.h:33:9`! (ix1 + (nx * (xDC - x1DC)) / (x2DC - x1DC));
367 for (yDC = clipy2; yDC < clipy1; yDC += undersampling) {
368 integercxx . . $ integer# iy = Melder_iceilingcxx . . $ `melder/melder_ftoi.h:45:9`! (iy2 - (ny * (yDC - y2DC)) / (y1DC - y2DC));
369 unsigned char *pixelAddress = ROW_START_ADDRESScxx . . $ `sys/Graphics_image.cpp:205:12`!;
370 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (iy >= iy1 && iy <= iy2);
371 if (! NUMisEmptycxx . . $ NUMisEmpty(939f42bb6b0c0c9c). (z_float)) {
372 constVECVUcxx . . $ constVECVU# ziy = z_float [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).iy];
373 for (xDC = clipx1; xDC < clipx2; xDC += undersampling) {
374 double value = offset - scale * ziy [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ix [xDC]];
375 PUT_PIXELcxx . . $ `sys/Graphics_image.cpp:206:12`!
376 }
377 } else {
378 constvectorviewcxx . . $ constvectorview# <unsigned char> ziy = z_byte [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).iy];
379 for (xDC = clipx1; xDC < clipx2; xDC += undersampling) {
380 double value = offset - scale * ziy [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ix [xDC]];
381 PUT_PIXELcxx . . $ `sys/Graphics_image.cpp:206:12`!
382 }
383 }
384 }
385 } catch (MelderErrorcxx . . $ MelderError#) {
386 Melder_clearErrorcxx . . $ Melder_clearError(49f6e7a06ebc5aa8). ();
387 }
388 }
389 /*
390 * Copy the bitmap to the screen.
391 */
392 #if cairocxx . . $ `sys/GraphicsP.h:54:10`!
393 cairo_matrix_t clip_trans;
394 cairo_matrix_init_identity (& clip_trans);
395 cairo_matrix_scale (& clip_trans, 1, -1); // we painted in the reverse y-direction
396 cairo_matrix_translate (& clip_trans, - clipx1, - clipy1);
397 cairo_pattern_t *bitmap_pattern = cairo_pattern_create_for_surface (sfc);
398 tracecxx . . $ `melder/melder_debug.h:60:10`! (U"bitmap pattern ", Melder_pointer (bitmap_pattern));
399 if (cairo_status_t status = cairo_pattern_status (bitmap_pattern)) {
400 Melder_casualcxx . . $ Melder_casual(6298c93241566110). (U"bitmap pattern status: ", Melder_peek8to32_u (cairo_status_to_string (status)));
401 } else {
402 cairo_pattern_set_matrix (bitmap_pattern, & clip_trans);
403 cairo_save (mycxx . . $ `melder/melder.h:44:9`! d_cairoGraphicsContextcxx . . $ structGraphicsScreen#d_cairoGraphicsContext.);
404 cairo_set_source (mycxx . . $ `melder/melder.h:44:9`! d_cairoGraphicsContextcxx . . $ structGraphicsScreen#d_cairoGraphicsContext., bitmap_pattern);
405 cairo_paint (mycxx . . $ `melder/melder.h:44:9`! d_cairoGraphicsContextcxx . . $ structGraphicsScreen#d_cairoGraphicsContext.);
406 cairo_restore (mycxx . . $ `melder/melder.h:44:9`! d_cairoGraphicsContextcxx . . $ structGraphicsScreen#d_cairoGraphicsContext.);
407 }
408 cairo_pattern_destroy (bitmap_pattern);
409 #elif gdi
410 SetDIBitsToDevice (my d_gdiGraphicsContext, clipx1, clipy2, bitmapWidth, bitmapHeight, 0, 0, 0, bitmapHeight,
411 bits, (CONST BITMAPINFO *) & bitmapInfo, DIB_RGB_COLORS);
412 //StretchDIBits (my d_gdiGraphicsContext, clipx1, clipy2, bitmapWidth, bitmapHeight, 0, 0, 0, bitmapHeight,
413 // bits, (CONST BITMAPINFO *) & bitmapInfo, DIB_RGB_COLORS, SRCCOPY);
414 #elif quartz
415 CGImageRef image;
416 static CGColorSpaceRef colourSpace = nullptr;
417 if (! colourSpace) {
418 colourSpace = CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB); // used to be kCGColorSpaceUserRGB
419 Melder_assert (colourSpace != nullptr);
420 }
421 if (1) {
422 CGDataProviderRef dataProvider = CGDataProviderCreateWithData (nullptr,
423 imageData,
424 bytesPerRow * numberOfRows,
425 _mac_releaseDataCallback // we need this because we cannot release the image data immediately after drawing,
426 // because in PDF files the imageData has to stay available through EndPage
427 );
428 Melder_assert (dataProvider != nullptr);
429 image = CGImageCreate (clipx2 - clipx1, numberOfRows,
430 8, 32, bytesPerRow, colourSpace, kCGImageAlphaLast, dataProvider, nullptr, false, kCGRenderingIntentDefault);
431 CGDataProviderRelease (dataProvider);
432 } else if (0) {
433 Melder_assert (CGBitmapContextCreate != nullptr);
434 CGContextRef bitmaptest = CGBitmapContextCreate (imageData, 100, 100,
435 8, 800, colourSpace, 0);
436 Melder_assert (bitmaptest != nullptr);
437 CGContextRef bitmap = CGBitmapContextCreate (nullptr /* imageData */, clipx2 - clipx1, numberOfRows,
438 8, bytesPerRow, colourSpace, kCGImageAlphaLast);
439 Melder_assert (bitmap != nullptr);
440 image = CGBitmapContextCreateImage (bitmap);
441 // release bitmap?
442 }
443 Melder_assert (image != nullptr);
444 CGContextDrawImage (my d_macGraphicsContext, CGRectMake (clipx1, clipy2, clipx2 - clipx1, clipy1 - clipy2), image);
445 //CGColorSpaceRelease (colourSpace);
446 CGImageRelease (image);
447 #endif
448 /*
449 * Clean up.
450 */
451 #if cairocxx . . $ `sys/GraphicsP.h:54:10`!
452 cairo_surface_destroy (sfc);
453 #elif gdi
454 DeleteBitmap (bitmap);
455 #endif
456 }
457 #if gdicxx . . $ `sys/GraphicsP.h:55:10`!
458 end:
459 return;
460 #endif
461 }
462
463 static void _GraphicsPostscript_cellArrayOrImagecxx . . $ _GraphicsPostscript_cellArrayOrImage(6a06f7db96ca9d34). (GraphicsPostscriptcxx . . $ GraphicsPostscript# me,
464 constMATVUcxx . . $ constMATVU# const& z_float,
465 constmatrixviewcxx . . $ constmatrixview# <MelderColourcxx . . $ MelderColour#> const& z_rgbt,
466 constmatrixviewcxx . . $ constmatrixview# <unsigned char> const& z_byte,
467 integercxx . . $ integer# ix1, integercxx . . $ integer# ix2, integercxx . . $ integer# x1DC, integercxx . . $ integer# x2DC,
468 integercxx . . $ integer# iy1, integercxx . . $ integer# iy2, integercxx . . $ integer# y1DC, integercxx . . $ integer# y2DC,
469 double minimum, double maximum,
470 integercxx . . $ integer# clipx1, integercxx . . $ integer# clipx2, integercxx . . $ integer# clipy1, integercxx . . $ integer# clipy2, bool interpolate)
471 {
472 integercxx . . $ integer# interpolateX = 1, interpolateY = 1;
473 integercxx . . $ integer# nx = ix2 - ix1 + 1, ny = iy2 - iy1 + 1, filling = 0;
474 double scale = ( mycxx . . $ `melder/melder.h:44:9`! photocopyablecxx . . $ structGraphicsPostscript#photocopyable. ? 200.1f : 255.1f ) / (maximum - minimum);
475 double offset = 255.1f + minimum * scale;
476 int minimalGrey = mycxx . . $ `melder/melder.h:44:9`! photocopyablecxx . . $ structGraphicsPostscript#photocopyable. ? 55 : 0;
477 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "gsave N %s %s M %s %s L %s %s L %s %s L closepath clip\n",
478 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (clipx1), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (clipy1), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (clipx2 - clipx1), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (0),
479 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (0), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (clipy2 - clipy1), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (clipx1 - clipx2), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (0));
480 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "%s %s translate %s %s scale\n",
481 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (x1DC), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (y1DC), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (x2DC - x1DC), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (y2DC - y1DC));
482 if (interpolate) {
483 /* The smallest image resolution is 300 dpi. If a sample takes up more than 25.4/300 mm, the 300 dpi resolution is achieved by interpolation. */
484 const double smallestImageResolution = 300.0;
485 double colSize_pixels = (double) (x2DC - x1DC) / nx;
486 double rowSize_pixels = (double) (y2DC - y1DC) / ny;
487 double colSize_inches = colSize_pixels / mycxx . . $ `melder/melder.h:44:9`! resolutioncxx . . $ structGraphics#resolution.;
488 double rowSize_inches = rowSize_pixels / mycxx . . $ `melder/melder.h:44:9`! resolutioncxx . . $ structGraphics#resolution.;
489 interpolateX = Melder_iceilingcxx . . $ `melder/melder_ftoi.h:45:9`! (colSize_inches * smallestImageResolution); // number of interpolation points per horizontal sample
490 interpolateY = Melder_iceilingcxx . . $ `melder/melder_ftoi.h:45:9`! (rowSize_inches * smallestImageResolution); // number of interpolation points per vertical sample
491 }
492
493 if (interpolateX <= 1 && interpolateY <= 1) {
494 /* Do not interpolate. */
495 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "/picstr %s string def %s %s 8 [%s 0 0 %s 0 0]\n"
496 "{ currentfile picstr readhexstring pop } image\n",
497 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (ny), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (ny));
498 } else if (interpolateX > 1 && interpolateY > 1) {
499 /* Interpolate both horizontally and vertically. */
500 integercxx . . $ integer# nx_new = nx * interpolateX;
501 integercxx . . $ integer# ny_new = ny * interpolateY;
502 /* Interpolation between rows requires us to remember two original rows: */
503 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "/lorow %s string def /hirow %s string def\n",
504 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx));
505 /* New rows (scanlines) are longer: */
506 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "/scanline %s string def\n",
507 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx_new));
508 /* The first four arguments to the 'image' command, */
509 /* namely the new number of columns, the new number of rows, the bit depth, and the matrix: */
510 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "%s %s 8 [%s 0 0 %s 0 0]\n",
511 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx_new), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (ny_new), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx_new), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (ny_new));
512 /* Since our imageproc is going to output only one scanline at a time, */
513 /* the outer loop variable (scanline number) has to be initialized outside the imageproc: */
514 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "/irow 0 def\n");
515 /* The imageproc starts here. First, we fill one or two original rows if necessary; */
516 /* they are read as hexadecimal strings from the current file, i.e. just after the image command. */
517 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "{\n"
518 /* First test: are we in the first scanline? If so, read two original rows: */
519 "irow 0 eq { currentfile lorow readhexstring pop pop lorow hirow copy pop } if\n"
520 /* Second test: did we just pass an original data row? */
521 /* If so, */
522 /* (1) move that row backwards; */
523 /* (2) read a new one unless we just passed the last original row: */
524 "irow %s mod %s eq { hirow lorow copy pop\n"
525 "irow %s ne { currentfile hirow readhexstring pop pop } if } if\n",
526 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateY), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateY / 2),
527 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (ny_new - interpolateY + interpolateY / 2));
528 /* Where are we between those two rows? */
529 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "/rowphase irow %s add %s mod %s div def\n",
530 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateY - interpolateY / 2), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateY), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateY));
531 /* Inner loop starts here. It cycles through all new columns: */
532 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "0 1 %s {\n", Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx_new - 1));
533 /* Get the inner loop variable: */
534 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., " /icol exch def\n");
535 /* Where are the two original columns? */
536 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., " /locol icol %s sub %s idiv def\n",
537 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateX / 2), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateX));
538 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., " /hicol icol %s ge { %s } { icol %s add %s idiv } ifelse def\n",
539 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx_new - interpolateX / 2), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx - 1),
540 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateX / 2), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateX));
541 /* Where are we between those two columns? */
542 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., " /colphase icol %s add %s mod %s div def\n",
543 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateX - interpolateX / 2), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateX), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateX));
544 /* Four-point interpolation: */
545 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file.,
546 " /plow lorow locol get def\n"
547 " /phigh lorow hicol get def\n"
548 " /qlow hirow locol get def\n"
549 " /qhigh hirow hicol get def\n"
550 " /value\n"
551 " plow phigh plow sub colphase mul add 1 rowphase sub mul\n"
552 " qlow qhigh qlow sub colphase mul add rowphase mul\n"
553 " add def\n"
554 " scanline icol value 0 le { 0 } { value 255 ge { 255 } { value } ifelse } ifelse cvi put\n"
555 "} for\n"
556 "/irow irow 1 add def scanline } image\n");
557 } else if (interpolateX > 1) {
558 /* Interpolate horizontally only. */
559 integercxx . . $ integer# nx_new = nx * interpolateX;
560 /* Remember one original row: */
561 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "/row %s string def\n", Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx));
562 /* New rows (scanlines) are longer: */
563 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "/scanline %s string def\n", Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx_new));
564 /* The first four arguments to the 'image' command, */
565 /* namely the new number of columns, the number of rows, the bit depth, and the matrix: */
566 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "%s %s 8 [%s 0 0 %s 0 0]\n",
567 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx_new), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (ny), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx_new), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (ny));
568 /* The imageproc starts here. We fill one original row. */
569 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "{\n"
570 "currentfile row readhexstring pop pop\n");
571 /* Loop starts here. It cycles through all new columns: */
572 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "0 1 %s {\n", Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx_new - 1));
573 /* Get the loop variable: */
574 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., " /icol exch def\n");
575 /* Where are the two original columns? */
576 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., " /locol icol %s sub %s idiv def\n",
577 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateX / 2), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateX));
578 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., " /hicol icol %s ge { %s } { icol %s add %s idiv } ifelse def\n",
579 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx_new - interpolateX / 2), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx - 1),
580 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateX / 2), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateX));
581 /* Where are we between those two columns? */
582 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., " /colphase icol %s add %s mod %s div def\n",
583 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateX - interpolateX / 2), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateX), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateX));
584 /* Two-point interpolation: */
585 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file.,
586 " /plow row locol get def\n"
587 " /phigh row hicol get def\n"
588 " /value plow phigh plow sub colphase mul add def\n"
589 " scanline icol value 0 le { 0 } { value 255 ge { 255 } { value } ifelse } ifelse cvi put\n"
590 "} for\n"
591 "scanline } image\n");
592 } else {
593 /* Interpolate vertically only. */
594 integercxx . . $ integer# ny_new = ny * interpolateY;
595 /* Interpolation between rows requires us to remember two original rows: */
596 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "/lorow %s string def /hirow %s string def\n", Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx));
597 /* New rows (scanlines) are equally long: */
598 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "/scanline %s string def\n", Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx));
599 /* The first four arguments to the 'image' command, */
600 /* namely the number of columns, the new number of rows, the bit depth, and the matrix: */
601 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "%s %s 8 [%s 0 0 %s 0 0]\n",
602 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (ny_new), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (ny_new));
603 /* Since our imageproc is going to output only one scanline at a time, */
604 /* the outer loop variable (scanline number) has to be initialized outside the imageproc: */
605 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "/irow 0 def\n");
606 /* The imageproc starts here. First, we fill one or two original rows if necessary; */
607 /* they are read as hexadecimal strings from the current file, i.e. just after the image command. */
608 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "{\n"
609 /* First test: are we in the first scanline? If so, read two original rows: */
610 "irow 0 eq { currentfile lorow readhexstring pop pop lorow hirow copy pop } if\n"
611 /* Second test: did we just pass an original data row? */
612 /* If so, */
613 /* (1) move that row backwards; */
614 /* (2) read a new one unless we just passed the last original row: */
615 "irow %s mod %s eq { hirow lorow copy pop\n"
616 "irow %s ne { currentfile hirow readhexstring pop pop } if } if\n",
617 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateY), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateY / 2),
618 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (ny_new - interpolateY + interpolateY / 2));
619 /* Where are we between those two rows? */
620 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "/rowphase irow %s add %s mod %s div def\n",
621 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateY - interpolateY / 2),
622 Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateY), Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (interpolateY));
623 /* Inner loop starts here. It cycles through all columns: */
624 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "0 1 %s {\n", Melder8_integercxx . . $ Melder8_integer(595caefabb192cea). (nx - 1));
625 /* Get the inner loop variable: */
626 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., " /icol exch def\n");
627 /* Two-point interpolation: */
628 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file.,
629 " /p lorow icol get def\n"
630 " /q hirow icol get def\n"
631 " /value\n"
632 " p 1 rowphase sub mul\n"
633 " q rowphase mul\n"
634 " add def\n"
635 " scanline icol value 0 le { 0 } { value 255 ge { 255 } { value } ifelse } ifelse cvi put\n"
636 "} for\n"
637 "/irow irow 1 add def scanline } image\n");
638 }
639 for (integercxx . . $ integer# iy = iy1; iy <= iy2; iy ++) for (integercxx . . $ integer# ix = ix1; ix <= ix2; ix ++) {
640 int value = (int) (offset - scale * ( ! NUMisEmptycxx . . $ NUMisEmpty(939f42bb6b0c0c9c). (z_float) ? z_float [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).iy] [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ix] : z_byte [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).iy] [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).ix] ));
641 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "%.2x", value <= minimalGrey ? minimalGrey : value >= 255 ? 255 : value);
642 if (++ filling == 39) { mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "\n"); filling = 0; }
643 }
644 if (filling) mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "\n");
645 mycxx . . $ `melder/melder.h:44:9`! d_printfcxx . . $ structGraphicsPostscript#d_printf. (mycxx . . $ `melder/melder.h:44:9`! d_filecxx . . $ structGraphicsPostscript#d_file., "grestore\n");
646 }
647
648 static void _cellArrayOrImagecxx . . $ _cellArrayOrImage(2b2a17efaa0ebb2c). (Graphicscxx . . $ Graphics# me,
649 constMATVUcxx . . $ constMATVU# const& z_float, constmatrixviewcxx . . $ constmatrixview# <MelderColourcxx . . $ MelderColour#> const& z_rgbt, constmatrixviewcxx . . $ constmatrixview# <unsigned char> const& z_byte,
650 integercxx . . $ integer# ix1, integercxx . . $ integer# ix2, integercxx . . $ integer# x1DC, integercxx . . $ integer# x2DC,
651 integercxx . . $ integer# iy1, integercxx . . $ integer# iy2, integercxx . . $ integer# y1DC, integercxx . . $ integer# y2DC, double minimum, double maximum,
652 integercxx . . $ integer# clipx1, integercxx . . $ integer# clipx2, integercxx . . $ integer# clipy1, integercxx . . $ integer# clipy2, bool interpolate)
653 {
654 if (mycxx . . $ `melder/melder.h:44:9`! screencxx . . $ structGraphics#screen.) {
655 _GraphicsScreen_cellArrayOrImagecxx . . $ _GraphicsScreen_cellArrayOrImage(c53f2774d0404b49). (static_cast <GraphicsScreencxx . . $ GraphicsScreen#> (me), z_float, z_rgbt, z_byte, ix1, ix2, x1DC, x2DC, iy1, iy2, y1DC, y2DC,
656 minimum, maximum, clipx1, clipx2, clipy1, clipy2, interpolate);
657 } else if (mycxx . . $ `melder/melder.h:44:9`! postScriptcxx . . $ structGraphics#postScript.) {
658 _GraphicsPostscript_cellArrayOrImagecxx . . $ _GraphicsPostscript_cellArrayOrImage(6a06f7db96ca9d34). (static_cast <GraphicsPostscriptcxx . . $ GraphicsPostscript#> (me), z_float, z_rgbt, z_byte, ix1, ix2, x1DC, x2DC, iy1, iy2, y1DC, y2DC,
659 minimum, maximum, clipx1, clipx2, clipy1, clipy2, interpolate);
660 }
661 _Graphics_setColourcxx . . $ _Graphics_setColour(eb47b9513d3f4721). (me, mycxx . . $ `melder/melder.h:44:9`! colourcxx . . $ structGraphics#colour.);
662 }
663
664 static void _autoSizecxx . . $ _autoSize(1361ec3f7f2979f6). (
665 const constGraphicscxx . . $ constGraphics# me,
666 const double x1WC, const double x2WC, const double y1WC, const double y2WC,
667 const integercxx . . $ integer# naturalWidthDC, const integercxx . . $ integer# naturalHeightDC,
668 /* mutable out */ integercxx . . $ integer# *const x1DC, /* mutable out */ integercxx . . $ integer# *const x2DC,
669 /* mutable out */ integercxx . . $ integer# *const y1DC, /* mutable out */ integercxx . . $ integer# *const y2DC
670 ) {
671 *x1DC = wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (x1WC);
672 *x2DC = wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (x2WC);
673 *y1DC = wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (y1WC);
674 *y2DC = wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (y2WC);
675 if (x1WC == x2WC) {
676 if (y1WC == y2WC) {
677 /*
678 Horizontal and vertical autosizing.
679 */
680 const integercxx . . $ integer# width = naturalWidthDC;
681 *x1DC -= width / 2;
682 *x2DC = *x1DC + width;
683 const integercxx . . $ integer# height = naturalHeightDC;
684 if (mycxx . . $ `melder/melder.h:44:9`! yIsZeroAtTheTopcxx . . $ structGraphics#yIsZeroAtTheTop.) {
685 *y2DC -= height / 2;
686 *y1DC = *y2DC + height;
687 } else {
688 *y1DC -= height / 2;
689 *y2DC = *y1DC + height;
690 }
691 } else {
692 /*
693 Horizontal autosizing only.
694 */
695 const integercxx . . $ integer# height = ( mycxx . . $ `melder/melder.h:44:9`! yIsZeroAtTheTopcxx . . $ structGraphics#yIsZeroAtTheTop. ? *y1DC - *y2DC : *y2DC - *y1DC );
696 const integercxx . . $ integer# width = height / (double) naturalHeightDC * (double) naturalWidthDC;
697 *x1DC -= width / 2;
698 *x2DC = *x1DC + width;
699 }
700 } else if (y1WC == y2WC) {
701 /*
702 Vertical autosizing only.
703 */
704 const integercxx . . $ integer# width = *x2DC - *x1DC;
705 const integercxx . . $ integer# height = width / (double) naturalWidthDC * (double) naturalHeightDC;
706 if (mycxx . . $ `melder/melder.h:44:9`! yIsZeroAtTheTopcxx . . $ structGraphics#yIsZeroAtTheTop.) {
707 *y2DC -= height / 2;
708 *y1DC = *y2DC + height;
709 } else {
710 *y1DC -= height / 2;
711 *y2DC = *y1DC + height;
712 }
713 }
714 }
715
716 void Graphics_cellArraycxx . . $ Graphics_cellArray(a5d48eb8683d0521). (Graphicscxx . . $ Graphics# me, constMATVUcxx . . $ constMATVU# const& z,
717 double x1WC, double x2WC, double y1WC, double y2WC, double minimum, double maximum)
718 {
719 if (z.nrowcxx . . $ constmatrixview#nrow. < 1 || z.ncolcxx . . $ constmatrixview#ncol. < 1 || minimum == maximum)
720 return;
721 if (mycxx . . $ `melder/melder.h:44:9`! recordingcxx . . $ structGraphics#recording.) {
722 opcxx . . $ `sys/GraphicsP.h:179:9`! (CELL_ARRAY, 8 + z.nrow * z.ncol);
723 putcxx . . $ `sys/GraphicsP.h:178:9`! (x1WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (x2WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (y1WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (y2WC);
724 putcxx . . $ `sys/GraphicsP.h:178:9`! (minimum); putcxx . . $ `sys/GraphicsP.h:178:9`! (maximum);
725 putcxx . . $ `sys/GraphicsP.h:178:9`! (z.nrow); putcxx . . $ `sys/GraphicsP.h:178:9`! (z.ncol);
726 for (integercxx . . $ integer# irow = 1; irow <= z.nrowcxx . . $ constmatrixview#nrow.; irow ++)
727 for (integercxx . . $ integer# icol = 1; icol <= z.ncolcxx . . $ constmatrixview#ncol.; icol ++)
728 putcxx . . $ `sys/GraphicsP.h:178:9`! (z [irow] [icol]);
729 } else {
730 /* mutable delayed init */ integercxx . . $ integer# x1DC, x2DC, y1DC, y2DC;
731 _autoSizecxx . . $ _autoSize(1361ec3f7f2979f6). (me, x1WC, x2WC, y1WC, y2WC, z.ncolcxx . . $ constmatrixview#ncol., z.nrowcxx . . $ constmatrixview#nrow., & x1DC, & x2DC, & y1DC, & y2DC);
732 _cellArrayOrImagecxx . . $ _cellArrayOrImage(2b2a17efaa0ebb2c). (me, z, constmatrixviewcxx . . $ constmatrixview#constmatrixview(49f6e7a06ebc5aa8).<MelderColourcxx . . $ MelderColour#>(), constmatrixviewcxx . . $ constmatrixview#constmatrixview(49f6e7a06ebc5aa8).<unsigned char>(),
733 1, z.ncolcxx . . $ constmatrixview#ncol., x1DC, x2DC, 1, z.nrowcxx . . $ constmatrixview#nrow., y1DC, y2DC, minimum, maximum,
734 wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (mycxx . . $ `melder/melder.h:44:9`! d_x1WC), wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (mycxx . . $ `melder/melder.h:44:9`! d_x2WC), wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (mycxx . . $ `melder/melder.h:44:9`! d_y1WC), wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (mycxx . . $ `melder/melder.h:44:9`! d_y2WC), false
735 );
736 }
737 }
738
739 void Graphics_cellArray_colourcxx . . $ Graphics_cellArray_colour(5885e50e053285eb). (Graphicscxx . . $ Graphics# me, constmatrixviewcxx . . $ constmatrixview# <MelderColourcxx . . $ MelderColour#> const& z,
740 double x1WC, double x2WC, double y1WC, double y2WC, double minimum, double maximum)
741 {
742 if (z.nrowcxx . . $ constmatrixview#nrow. < 1 || z.ncolcxx . . $ constmatrixview#ncol. < 1 || minimum == maximum)
743 return;
744 if (mycxx . . $ `melder/melder.h:44:9`! recordingcxx . . $ structGraphics#recording.) {
745 opcxx . . $ `sys/GraphicsP.h:179:9`! (CELL_ARRAY_COLOUR, 8 + z.nrow * z.ncol * 4);
746 putcxx . . $ `sys/GraphicsP.h:178:9`! (x1WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (x2WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (y1WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (y2WC);
747 putcxx . . $ `sys/GraphicsP.h:178:9`! (minimum); putcxx . . $ `sys/GraphicsP.h:178:9`! (maximum);
748 putcxx . . $ `sys/GraphicsP.h:178:9`! (z.nrow); putcxx . . $ `sys/GraphicsP.h:178:9`! (z.ncol);
749 for (integercxx . . $ integer# irow = 1; irow <= z.nrowcxx . . $ constmatrixview#nrow.; irow ++) {
750 constvectorviewcxx . . $ constvectorview# <MelderColourcxx . . $ MelderColour#> row = z [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).irow];
751 for (integercxx . . $ integer# icol = 1; icol <= z.ncolcxx . . $ constmatrixview#ncol.; icol ++) {
752 putcxx . . $ `sys/GraphicsP.h:178:9`! (row [icol]. red);
753 putcxx . . $ `sys/GraphicsP.h:178:9`! (row [icol]. green);
754 putcxx . . $ `sys/GraphicsP.h:178:9`! (row [icol]. blue);
755 putcxx . . $ `sys/GraphicsP.h:178:9`! (row [icol]. transparency);
756 }
757 }
758 } else {
759 /* mutable delayed init */ integercxx . . $ integer# x1DC, x2DC, y1DC, y2DC;
760 _autoSizecxx . . $ _autoSize(1361ec3f7f2979f6). (me, x1WC, x2WC, y1WC, y2WC, z.ncolcxx . . $ constmatrixview#ncol., z.nrowcxx . . $ constmatrixview#nrow., & x1DC, & x2DC, & y1DC, & y2DC);
761 _cellArrayOrImagecxx . . $ _cellArrayOrImage(2b2a17efaa0ebb2c). (me, constMATVUcxx . . $ constmatrixview#constmatrixview(49f6e7a06ebc5aa8).(), z, constmatrixviewcxx . . $ constmatrixview#constmatrixview(49f6e7a06ebc5aa8).<unsigned char>(),
762 1, z.ncolcxx . . $ constmatrixview#ncol., x1DC, x2DC, 1, z.nrowcxx . . $ constmatrixview#nrow., y1DC, y2DC, minimum, maximum,
763 wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (mycxx . . $ `melder/melder.h:44:9`! d_x1WC), wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (mycxx . . $ `melder/melder.h:44:9`! d_x2WC), wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (mycxx . . $ `melder/melder.h:44:9`! d_y1WC), wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (mycxx . . $ `melder/melder.h:44:9`! d_y2WC), false
764 );
765 }
766 }
767
768 void Graphics_cellArray8cxx . . $ Graphics_cellArray8(1efcaa0fec57ce1b). (Graphicscxx . . $ Graphics# me, constmatrixviewcxx . . $ constmatrixview#<unsigned char> const& z,
769 double x1WC, double x2WC, double y1WC, double y2WC, unsigned char minimum, unsigned char maximum)
770 {
771 if (z.nrowcxx . . $ constmatrixview#nrow. < 1 || z.ncolcxx . . $ constmatrixview#ncol. < 1 || minimum == maximum)
772 return;
773 if (mycxx . . $ `melder/melder.h:44:9`! recordingcxx . . $ structGraphics#recording.) {
774 opcxx . . $ `sys/GraphicsP.h:179:9`! (CELL_ARRAY8, 8 + z.nrow * z.ncol);
775 putcxx . . $ `sys/GraphicsP.h:178:9`! (x1WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (x2WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (y1WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (y2WC);
776 putcxx . . $ `sys/GraphicsP.h:178:9`! (minimum); putcxx . . $ `sys/GraphicsP.h:178:9`! (maximum);
777 putcxx . . $ `sys/GraphicsP.h:178:9`! (z.nrow); putcxx . . $ `sys/GraphicsP.h:178:9`! (z.ncol);
778 for (integercxx . . $ integer# irow = 1; irow <= z.nrowcxx . . $ constmatrixview#nrow.; irow ++)
779 for (integercxx . . $ integer# icol = 1; icol <= z.ncolcxx . . $ constmatrixview#ncol.; icol ++)
780 putcxx . . $ `sys/GraphicsP.h:178:9`! (z [irow] [icol]);
781 } else {
782 /* mutable delayed init */ integercxx . . $ integer# x1DC, x2DC, y1DC, y2DC;
783 _autoSizecxx . . $ _autoSize(1361ec3f7f2979f6). (me, x1WC, x2WC, y1WC, y2WC, z.ncolcxx . . $ constmatrixview#ncol., z.nrowcxx . . $ constmatrixview#nrow., & x1DC, & x2DC, & y1DC, & y2DC);
784 _cellArrayOrImagecxx . . $ _cellArrayOrImage(2b2a17efaa0ebb2c). (me, constMATVUcxx . . $ constmatrixview#constmatrixview(49f6e7a06ebc5aa8).(), constmatrixviewcxx . . $ constmatrixview#constmatrixview(49f6e7a06ebc5aa8).<MelderColourcxx . . $ MelderColour#>(), z,
785 1, z.ncolcxx . . $ constmatrixview#ncol., x1DC, x2DC, 1, z.nrowcxx . . $ constmatrixview#nrow., y1DC, y2DC, minimum, maximum,
786 wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (mycxx . . $ `melder/melder.h:44:9`! d_x1WC), wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (mycxx . . $ `melder/melder.h:44:9`! d_x2WC), wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (mycxx . . $ `melder/melder.h:44:9`! d_y1WC), wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (mycxx . . $ `melder/melder.h:44:9`! d_y2WC), false
787 );
788 }
789 }
790
791 void Graphics_imagecxx . . $ Graphics_image(a5d48eb8683d0521). (Graphicscxx . . $ Graphics# me, constMATVUcxx . . $ constMATVU# const& z,
792 double x1WC, double x2WC, double y1WC, double y2WC, double minimum, double maximum)
793 {
794 if (z.nrowcxx . . $ constmatrixview#nrow. < 1 || z.ncolcxx . . $ constmatrixview#ncol. < 1 || minimum == maximum)
795 return;
796 if (mycxx . . $ `melder/melder.h:44:9`! recordingcxx . . $ structGraphics#recording.) {
797 opcxx . . $ `sys/GraphicsP.h:179:9`! (IMAGE, 8 + z.nrow * z.ncol);
798 putcxx . . $ `sys/GraphicsP.h:178:9`! (x1WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (x2WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (y1WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (y2WC);
799 putcxx . . $ `sys/GraphicsP.h:178:9`! (minimum); putcxx . . $ `sys/GraphicsP.h:178:9`! (maximum);
800 putcxx . . $ `sys/GraphicsP.h:178:9`! (z.nrow); putcxx . . $ `sys/GraphicsP.h:178:9`! (z.ncol);
801 for (integercxx . . $ integer# irow = 1; irow <= z.nrowcxx . . $ constmatrixview#nrow.; irow ++)
802 for (integercxx . . $ integer# icol = 1; icol <= z.ncolcxx . . $ constmatrixview#ncol.; icol ++)
803 putcxx . . $ `sys/GraphicsP.h:178:9`! (z [irow] [icol]);
804 } else {
805 /* mutable delayed init */ integercxx . . $ integer# x1DC, x2DC, y1DC, y2DC;
806 _autoSizecxx . . $ _autoSize(1361ec3f7f2979f6). (me, x1WC, x2WC, y1WC, y2WC, z.ncolcxx . . $ constmatrixview#ncol., z.nrowcxx . . $ constmatrixview#nrow., & x1DC, & x2DC, & y1DC, & y2DC);
807 _cellArrayOrImagecxx . . $ _cellArrayOrImage(2b2a17efaa0ebb2c). (me, z, constmatrixviewcxx . . $ constmatrixview#constmatrixview(49f6e7a06ebc5aa8).<MelderColourcxx . . $ MelderColour#>(), constmatrixviewcxx . . $ constmatrixview#constmatrixview(49f6e7a06ebc5aa8).<unsigned char>(),
808 1, z.ncolcxx . . $ constmatrixview#ncol., x1DC, x2DC, 1, z.nrowcxx . . $ constmatrixview#nrow., y1DC, y2DC, minimum, maximum,
809 wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (mycxx . . $ `melder/melder.h:44:9`! d_x1WC), wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (mycxx . . $ `melder/melder.h:44:9`! d_x2WC), wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (mycxx . . $ `melder/melder.h:44:9`! d_y1WC), wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (mycxx . . $ `melder/melder.h:44:9`! d_y2WC), true
810 );
811 }
812 }
813
814 void Graphics_image_colourcxx . . $ Graphics_image_colour(5885e50e053285eb). (Graphicscxx . . $ Graphics# me, constmatrixviewcxx . . $ constmatrixview# <MelderColourcxx . . $ MelderColour#> const& z,
815 double x1WC, double x2WC, double y1WC, double y2WC, double minimum, double maximum)
816 {
817 if (z.nrowcxx . . $ constmatrixview#nrow. < 1 || z.ncolcxx . . $ constmatrixview#ncol. < 1 || minimum == maximum)
818 return;
819 if (mycxx . . $ `melder/melder.h:44:9`! recordingcxx . . $ structGraphics#recording.) {
820 opcxx . . $ `sys/GraphicsP.h:179:9`! (IMAGE_COLOUR, 8 + z.nrow * z.ncol * 4);
821 putcxx . . $ `sys/GraphicsP.h:178:9`! (x1WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (x2WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (y1WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (y2WC);
822 putcxx . . $ `sys/GraphicsP.h:178:9`! (minimum); putcxx . . $ `sys/GraphicsP.h:178:9`! (maximum);
823 putcxx . . $ `sys/GraphicsP.h:178:9`! (z.nrow); putcxx . . $ `sys/GraphicsP.h:178:9`! (z.ncol);
824 for (integercxx . . $ integer# irow = 1; irow <= z.nrowcxx . . $ constmatrixview#nrow.; irow ++) {
825 constvectorviewcxx . . $ constvectorview# <MelderColourcxx . . $ MelderColour#> row = z [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).irow];
826 for (integercxx . . $ integer# icol = 1; icol <= z.ncolcxx . . $ constmatrixview#ncol.; icol ++) {
827 putcxx . . $ `sys/GraphicsP.h:178:9`! (row [icol]. red);
828 putcxx . . $ `sys/GraphicsP.h:178:9`! (row [icol]. green);
829 putcxx . . $ `sys/GraphicsP.h:178:9`! (row [icol]. blue);
830 putcxx . . $ `sys/GraphicsP.h:178:9`! (row [icol]. transparency);
831 }
832 }
833 } else {
834 /* mutable delayed init */ integercxx . . $ integer# x1DC, x2DC, y1DC, y2DC;
835 _autoSizecxx . . $ _autoSize(1361ec3f7f2979f6). (me, x1WC, x2WC, y1WC, y2WC, z.ncolcxx . . $ constmatrixview#ncol., z.nrowcxx . . $ constmatrixview#nrow., & x1DC, & x2DC, & y1DC, & y2DC);
836 _cellArrayOrImagecxx . . $ _cellArrayOrImage(2b2a17efaa0ebb2c). (me, constMATVUcxx . . $ constmatrixview#constmatrixview(49f6e7a06ebc5aa8).(), z, constmatrixviewcxx . . $ constmatrixview#constmatrixview(49f6e7a06ebc5aa8).<unsigned char>(),
837 1, z.ncolcxx . . $ constmatrixview#ncol., x1DC, x2DC, 1, z.nrowcxx . . $ constmatrixview#nrow., y1DC, y2DC, minimum, maximum,
838 wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (mycxx . . $ `melder/melder.h:44:9`! d_x1WC), wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (mycxx . . $ `melder/melder.h:44:9`! d_x2WC), wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (mycxx . . $ `melder/melder.h:44:9`! d_y1WC), wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (mycxx . . $ `melder/melder.h:44:9`! d_y2WC), true
839 );
840 }
841 }
842
843 void Graphics_image8cxx . . $ Graphics_image8(1efcaa0fec57ce1b). (Graphicscxx . . $ Graphics# me, constmatrixviewcxx . . $ constmatrixview# <unsigned char> const& z,
844 double x1WC, double x2WC, double y1WC, double y2WC, uint8cxx . . $ uint8# minimum, uint8cxx . . $ uint8# maximum)
845 {
846 if (z.nrowcxx . . $ constmatrixview#nrow. < 1 || z.ncolcxx . . $ constmatrixview#ncol. < 1 || minimum == maximum)
847 return;
848 if (mycxx . . $ `melder/melder.h:44:9`! recordingcxx . . $ structGraphics#recording.) {
849 opcxx . . $ `sys/GraphicsP.h:179:9`! (IMAGE8, 8 + z.nrow * z.ncol);
850 putcxx . . $ `sys/GraphicsP.h:178:9`! (x1WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (x2WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (y1WC); putcxx . . $ `sys/GraphicsP.h:178:9`! (y2WC);
851 putcxx . . $ `sys/GraphicsP.h:178:9`! (minimum); putcxx . . $ `sys/GraphicsP.h:178:9`! (maximum);
852 putcxx . . $ `sys/GraphicsP.h:178:9`! (z.nrow); putcxx . . $ `sys/GraphicsP.h:178:9`! (z.ncol);
853 for (integercxx . . $ integer# irow = 1; irow <= z.nrowcxx . . $ constmatrixview#nrow.; irow ++)
854 for (integercxx . . $ integer# icol = 1; icol <= z.ncolcxx . . $ constmatrixview#ncol.; icol ++)
855 putcxx . . $ `sys/GraphicsP.h:178:9`! (z [irow] [icol]);
856 } else {
857 /* mutable delayed init */ integercxx . . $ integer# x1DC, x2DC, y1DC, y2DC;
858 _autoSizecxx . . $ _autoSize(1361ec3f7f2979f6). (me, x1WC, x2WC, y1WC, y2WC, z.ncolcxx . . $ constmatrixview#ncol., z.nrowcxx . . $ constmatrixview#nrow., & x1DC, & x2DC, & y1DC, & y2DC);
859 _cellArrayOrImagecxx . . $ _cellArrayOrImage(2b2a17efaa0ebb2c). (me, constMATVUcxx . . $ constmatrixview#constmatrixview(49f6e7a06ebc5aa8).(), constmatrixviewcxx . . $ constmatrixview#constmatrixview(49f6e7a06ebc5aa8).<MelderColourcxx . . $ MelderColour#>(), z,
860 1, z.ncolcxx . . $ constmatrixview#ncol., x1DC, x2DC, 1, z.nrowcxx . . $ constmatrixview#nrow., y1DC, y2DC, minimum, maximum,
861 wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (mycxx . . $ `melder/melder.h:44:9`! d_x1WC), wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (mycxx . . $ `melder/melder.h:44:9`! d_x2WC), wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (mycxx . . $ `melder/melder.h:44:9`! d_y1WC), wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (mycxx . . $ `melder/melder.h:44:9`! d_y2WC), true
862 );
863 }
864 }
865
866 static void _GraphicsScreen_imageFromFilecxx . . $ _GraphicsScreen_imageFromFile(680903bcf895ae74). (GraphicsScreencxx . . $ GraphicsScreen# me, conststring32cxx . . $ conststring32# relativeFileName, double x1, double x2, double y1, double y2) {
867 integercxx . . $ integer# x1DC = wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (x1), x2DC = wdxcxx . . $ `sys/Graphics_image.cpp:35:9`! (x2), y1DC = wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (y1), y2DC = wdycxx . . $ `sys/Graphics_image.cpp:36:9`! (y2);
868 integercxx . . $ integer# width = x2DC - x1DC, height = mycxx . . $ `melder/melder.h:44:9`! yIsZeroAtTheTopcxx . . $ structGraphics#yIsZeroAtTheTop. ? y1DC - y2DC : y2DC - y1DC;
869 #if 0
870 structMelderFile file { };
871 Melder_relativePathToFile (relativeFileName, & file);
872 try {
873 autoPhoto photo = Photo_readFromImageFile (& file);
874 if (x1 == x2 && y1 == y2) {
875 width = photo -> nx, x1DC -= width / 2, x2DC = x1DC + width;
876 height = photo -> ny, y2DC -= height / 2, y1DC = y2DC + height;
877 } else if (x1 == x2) {
878 width = height * (double) photo -> nx / (double) photo -> ny;
879 x1DC -= width / 2, x2DC = x1DC + width;
880 } else if (y1 == y2) {
881 height = width * (double) photo -> ny / (double) photo -> nx;
882 y2DC -= height / 2, y1DC = y2DC + height;
883 }
884 automatrix <MelderColour> z = newmatrixraw <MelderColour> (photo -> ny, photo -> nx);
885 for (integer iy = 1; iy <= photo -> ny; iy ++) {
886 for (integer ix = 1; ix <= photo -> nx; ix ++) {
887 z [iy] [ix]. red = photo -> d_red -> z [iy] [ix];
888 z [iy] [ix]. green = photo -> d_green -> z [iy] [ix];
889 z [iy] [ix]. blue = photo -> d_blue -> z [iy] [ix];
890 z [iy] [ix]. transparency = photo -> d_transparency -> z [iy] [ix];
891 }
892 }
893 _cellArrayOrImage (me, constMATVU(), z.get(), constmatrixview<unsigned char>(),
894 1, photo -> nx, x1DC, x2DC, 1, photo -> ny, y1DC, y2DC,
895 0.0, 1.0,
896 //wdx (my d_x1WC), wdx (my d_x2WC), wdy (my d_y1WC), wdy (my d_y2WC), // in case of clipping
897 LONG_MIN, LONG_MAX, LONG_MAX, LONG_MIN, // in case of no clipping
898 true
899 );
900 } catch (MelderError) {
901 Melder_clearError ();
902 }
903 #elif gdicxx . . $ `sys/GraphicsP.h:55:10`!
904 if (my d_useGdiplus) {
905 structMelderFile file { };
906 Melder_relativePathToFile (relativeFileName, & file);
907 Gdiplus::Bitmap image (MelderFile_peekPathW (& file));
908 if (x1 == x2 && y1 == y2) {
909 width = image. GetWidth (), x1DC -= width / 2, x2DC = x1DC + width;
910 height = image. GetHeight (), y2DC -= height / 2, y1DC = y2DC + height;
911 } else if (x1 == x2) {
912 width = height * (double) image. GetWidth () / (double) image. GetHeight ();
913 x1DC -= width / 2, x2DC = x1DC + width;
914 } else if (y1 == y2) {
915 height = width * (double) image. GetHeight () / (double) image. GetWidth ();
916 y2DC -= height / 2, y1DC = y2DC + height;
917 }
918 Gdiplus::Graphics dcplus (my d_gdiGraphicsContext);
919 Gdiplus::Rect rect (x1DC, y2DC, width, height);
920 dcplus. DrawImage (& image, rect);
921 } else {
922 }
923 #elif quartzcxx . . $ `sys/GraphicsP.h:57:10`!
924 structMelderFile file { };
925 Melder_relativePathToFile (relativeFileName, & file);
926 CFURLRef url = CFURLCreateWithFileSystemPath (nullptr, (CFStringRef) MelderFile_peekPathCfstring (& file), kCFURLPOSIXPathStyle, false);
927 CGImageSourceRef imageSource = CGImageSourceCreateWithURL (url, nullptr);
928 CFRelease (url);
929 if (imageSource) {
930 CGImageRef image = CGImageSourceCreateImageAtIndex (imageSource, 0, nullptr);
931 CFRelease (imageSource);
932 if (image) {
933 if (x1 == x2 && y1 == y2) {
934 width = CGImageGetWidth (image), x1DC -= width / 2, x2DC = x1DC + width;
935 height = CGImageGetHeight (image), y2DC -= height / 2, y1DC = y2DC + height;
936 } else if (x1 == x2) {
937 width = height * (double) CGImageGetWidth (image) / (double) CGImageGetHeight (image);
938 x1DC -= width / 2, x2DC = x1DC + width;
939 } else if (y1 == y2) {
940 height = width * (double) CGImageGetHeight (image) / (double) CGImageGetWidth (image);
941 y2DC -= height / 2, y1DC = y2DC + height;
942 }
943 CGContextSaveGState (my d_macGraphicsContext);
944
945 //NSCAssert(my d_macGraphicsContext, @"nil context");
946
947 CGContextTranslateCTM (my d_macGraphicsContext, 0, y1DC);
948 CGContextScaleCTM (my d_macGraphicsContext, 1.0, -1.0);
949 CGContextDrawImage (my d_macGraphicsContext, CGRectMake (x1DC, 0, width, height), image);
950 CGContextRestoreGState (my d_macGraphicsContext);
951 CGImageRelease (image);
952 }
953 }
954 #endif
955 }
956
957 void Graphics_imageFromFilecxx . . $ Graphics_imageFromFile(9b328aacbdc4d4bc). (Graphicscxx . . $ Graphics# me, conststring32cxx . . $ conststring32# relativeFileName, double x1, double x2, double y1, double y2) {
958 if (mycxx . . $ `melder/melder.h:44:9`! recordingcxx . . $ structGraphics#recording.) {
959 conststring8cxx . . $ conststring8# txt_utf8 = Melder_peek32to8 (relativeFileName);
960 int length = strlen (txt_utf8) / sizeof (double) + 1; // TODO: integer overflow
961 opcxx . . $ `sys/GraphicsP.h:179:9`! (IMAGE_FROM_FILE, 5 + length); putcxx . . $ `sys/GraphicsP.h:178:9`! (x1); putcxx . . $ `sys/GraphicsP.h:178:9`! (x2); putcxx . . $ `sys/GraphicsP.h:178:9`! (y1); putcxx . . $ `sys/GraphicsP.h:178:9`! (y2); sputcxx . . $ `sys/GraphicsP.h:181:9`! (txt_utf8, length)
962 } else if (mycxx . . $ `melder/melder.h:44:9`! screencxx . . $ structGraphics#screen.) {
963 _GraphicsScreen_imageFromFilecxx . . $ _GraphicsScreen_imageFromFile(680903bcf895ae74). (static_cast <GraphicsScreencxx . . $ GraphicsScreen#> (me), relativeFileName, x1, x2, y1, y2);
964 }
965 }
966
967 void Graphics_imageFromFile_embeddedcxx . . $ Graphics_imageFromFile_embedded(9b328aacbdc4d4bc). (Graphicscxx . . $ Graphics# me, conststring32cxx . . $ conststring32# relativeFileName, double x1, double x2, double y1, double y2) {
968 if (Melder_endsWith_caseAwarecxx . . $ Melder_endsWith_caseAware(1652f10ed0f82783). (relativeFileName, U".pdf"))
969 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Cannot embed PDF pictures. Use “Insert picture from file...” instead.");
970 structMelderFilecxx . . $ structMelderFile# file { };
971 Melder_relativePathToFilecxx . . $ Melder_relativePathToFile(82691f2ee21fbb13). (relativeFileName, & file);
972 try {
973 autoPhotocxx . . $ autoPhoto# photo = Photo_readFromImageFilecxx . . $ Photo_readFromImageFile(4beee1b83b67140c). (& file);
974 automatrixcxx . . $ automatrix# <MelderColourcxx . . $ MelderColour#> z = newmatrixrawcxx . . $ newmatrixraw(902b25f6b635a55a). <MelderColourcxx . . $ MelderColour#> (photo ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nycxx . . $ structSampledXY#ny., photo ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nxcxx . . $ structSampled#nx.);
975 for (integercxx . . $ integer# iy = 1; iy <= photo ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nycxx . . $ structSampledXY#ny.; iy ++) {
976 for (integercxx . . $ integer# ix = 1; ix <= photo ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nxcxx . . $ structSampled#nx.; ix ++) {
977 z [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).iy] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).ix]. redcxx . . $ MelderColour#red. = photo ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). d_redcxx . . $ structPhoto#d_red. ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).iy] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).ix];
978 z [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).iy] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).ix]. greencxx . . $ MelderColour#green. = photo ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). d_greencxx . . $ structPhoto#d_green. ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).iy] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).ix];
979 z [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).iy] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).ix]. bluecxx . . $ MelderColour#blue. = photo ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). d_bluecxx . . $ structPhoto#d_blue. ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).iy] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).ix];
980 z [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).iy] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).ix]. transparencycxx . . $ MelderColour#transparency. = photo ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). d_transparencycxx . . $ structPhoto#d_transparency. ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).iy] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).ix];
981 }
982 }
983 Graphics_image_colourcxx . . $ Graphics_image_colour(5885e50e053285eb). (me, zcxx . . $ constmatrixview#constmatrixview(eed9513d24570b3d)..getcxx . . $ automatrix#get(b2b81450b5bdda66).(), x1, x2, y1, y2, 0.0, 1.0); // this does clipping to the canvas
984 } catch (MelderErrorcxx . . $ MelderError#) {
985 Melder_clearErrorcxx . . $ Melder_clearError(49f6e7a06ebc5aa8). ();
986 }
987 }
988
989 /* End of file Graphics_image.cpp */