cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | /* |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 3 | % % |
| 4 | % % |
| 5 | % % |
| 6 | % DDDD RRRR AAA W W % |
| 7 | % D D R R A A W W % |
| 8 | % D D RRRR AAAAA W W % |
| 9 | % D D R R A A W W W % |
| 10 | % DDDD R R A A W W % |
| 11 | % % |
| 12 | % TTTTT EEEEE SSSSS TTTTT % |
| 13 | % T E SS T % |
| 14 | % T EEE SSS T % |
| 15 | % T E SS T % |
| 16 | % T EEEEE SSSSS T % |
| 17 | % % |
| 18 | % % |
| 19 | % MagickWand Drawing Tests % |
| 20 | % % |
| 21 | % Software Design % |
cristy | de984cd | 2013-12-01 14:49:27 +0000 | [diff] [blame] | 22 | % Cristy % |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 23 | % Bob Friesenhahn % |
| 24 | % March 2002 % |
| 25 | % % |
| 26 | % % |
Cristy | f6ff9ea | 2016-12-05 09:53:35 -0500 | [diff] [blame] | 27 | % Copyright 1999-2017 ImageMagick Studio LLC, a non-profit organization % |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 28 | % dedicated to making software imaging solutions freely available. % |
| 29 | % % |
| 30 | % You may not use this file except in compliance with the License. You may % |
| 31 | % obtain a copy of the License at % |
| 32 | % % |
Cristy | f19d414 | 2017-04-24 11:34:30 -0400 | [diff] [blame] | 33 | % https://www.imagemagick.org/script/license.php % |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 34 | % % |
| 35 | % Unless required by applicable law or agreed to in writing, software % |
| 36 | % distributed under the License is distributed on an "AS IS" BASIS, % |
| 37 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. % |
| 38 | % See the License for the specific language governing permissions and % |
| 39 | % limitations under the License. % |
| 40 | % % |
| 41 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 42 | % |
| 43 | % |
| 44 | % |
| 45 | */ |
| 46 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 47 | #include <stdio.h> |
| 48 | #include <stdlib.h> |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 49 | #include <MagickWand/MagickWand.h> |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 50 | |
| 51 | #define ThrowWandException(wand) \ |
| 52 | { \ |
| 53 | char \ |
| 54 | *description; \ |
| 55 | \ |
| 56 | ExceptionType \ |
| 57 | severity; \ |
| 58 | \ |
| 59 | description=MagickGetException(wand,&severity); \ |
cristy | 1e60481 | 2011-05-19 18:07:50 +0000 | [diff] [blame] | 60 | (void) FormatLocaleFile(stderr,"%s %s %lu %s\n",GetMagickModule(), \ |
| 61 | description); \ |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 62 | description=(char *) MagickRelinquishMemory(description); \ |
| 63 | exit(-1); \ |
| 64 | } |
| 65 | |
cristy | 30841e6 | 2014-05-19 00:45:15 +0000 | [diff] [blame] | 66 | static MagickBooleanType ScribbleImage(MagickWand *canvas) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 67 | { |
| 68 | DrawingWand |
| 69 | *picasso; |
| 70 | |
| 71 | PixelWand |
| 72 | *color; |
| 73 | |
| 74 | picasso=NewDrawingWand(); |
| 75 | color=NewPixelWand(); |
| 76 | (void) PushDrawingWand(picasso); |
| 77 | { |
cristy | 32c2aea | 2010-12-01 01:00:50 +0000 | [diff] [blame] | 78 | DrawSetViewbox(picasso,0,0,(ssize_t) MagickGetImageWidth(canvas), |
| 79 | (ssize_t) MagickGetImageHeight(canvas)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 80 | DrawScale(picasso,1.101,1.08); |
| 81 | DrawTranslate(picasso,-23.69,-22.97); |
| 82 | DrawRotate(picasso,0); |
| 83 | (void) PixelSetColor(color,"#ffffff"); |
| 84 | DrawSetFillColor(picasso,color); |
| 85 | DrawRectangle(picasso,23.69,22.97,564.6,802.2); |
dirk | 567d0f7 | 2015-04-07 20:23:08 +0000 | [diff] [blame] | 86 | DrawSetFillOpacity(picasso,1.0); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 87 | (void) PixelSetColor(color,"none"); |
| 88 | DrawSetFillColor(picasso,color); |
| 89 | DrawSetStrokeColor(picasso,color); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 90 | DrawSetStrokeAntialias(picasso,MagickTrue); |
| 91 | DrawSetStrokeLineCap(picasso,RoundCap); |
| 92 | DrawSetStrokeLineJoin(picasso,RoundJoin); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 93 | DrawPushDefs(picasso); |
| 94 | { |
| 95 | DrawPushClipPath(picasso,"clip_1"); |
| 96 | { |
| 97 | (void) PushDrawingWand(picasso); |
| 98 | { |
| 99 | DrawRectangle(picasso,0,0,595.3,841.9); |
| 100 | } |
| 101 | (void) PopDrawingWand(picasso); |
| 102 | } |
| 103 | DrawPopClipPath(picasso); |
| 104 | } |
| 105 | DrawPopDefs(picasso); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 106 | (void) PushDrawingWand(picasso); |
| 107 | { |
| 108 | (void) DrawSetClipPath(picasso, "url(#clip_1)"); |
cristy | 6a917d9 | 2009-10-06 19:23:54 +0000 | [diff] [blame] | 109 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 110 | (void) PushDrawingWand(picasso); |
| 111 | { |
| 112 | DrawSetStrokeAntialias(picasso,MagickTrue); |
| 113 | DrawSetStrokeWidth(picasso,4.032); |
| 114 | DrawSetStrokeLineCap(picasso,RoundCap); |
| 115 | DrawSetStrokeLineJoin(picasso,RoundJoin); |
cristy | f432c63 | 2014-12-07 15:11:28 +0000 | [diff] [blame] | 116 | (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 117 | (void) PixelSetColor(color,"#ff0000"); |
| 118 | DrawSetStrokeColor(picasso,color); |
| 119 | DrawSetFillRule(picasso,EvenOddRule); |
| 120 | (void) PixelSetColor(color,"#ff00ff"); |
| 121 | DrawSetFillColor(picasso,color); |
| 122 | DrawRectangle(picasso,72,72,144,144); |
| 123 | } |
| 124 | (void) PopDrawingWand(picasso); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 125 | (void) PushDrawingWand(picasso); |
| 126 | { |
| 127 | DrawSetStrokeAntialias(picasso,MagickTrue); |
| 128 | DrawSetStrokeWidth(picasso,9); |
| 129 | DrawSetStrokeLineCap(picasso,RoundCap); |
| 130 | DrawSetStrokeLineJoin(picasso,RoundJoin); |
cristy | f432c63 | 2014-12-07 15:11:28 +0000 | [diff] [blame] | 131 | (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 132 | (void) PixelSetColor(color,"#00ff00"); |
| 133 | DrawSetStrokeColor(picasso,color); |
| 134 | DrawSetFillRule(picasso,EvenOddRule); |
| 135 | (void) PixelSetColor(color,"#0080ff"); |
| 136 | DrawSetFillColor(picasso,color); |
| 137 | DrawRoundRectangle(picasso,72,216,360,432,9,9); |
| 138 | } |
| 139 | (void) PopDrawingWand(picasso); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 140 | (void) PushDrawingWand(picasso); |
| 141 | { |
| 142 | const PointInfo points[37] = |
| 143 | { |
| 144 | { 378.1,81.72 }, { 381.1,79.56 }, { 384.3,78.12 }, { 387.6,77.33 }, |
| 145 | { 391.1,77.11 }, { 394.6,77.62 }, { 397.8,78.77 }, { 400.9,80.57 }, |
| 146 | { 403.6,83.02 }, { 523.9,216.8 }, { 526.2,219.7 }, { 527.6,223 }, |
| 147 | { 528.4,226.4 }, { 528.6,229.8 }, { 528,233.3 }, { 526.9,236.5 }, |
| 148 | { 525.1,239.5 }, { 522.6,242.2 }, { 495.9,266.3 }, { 493,268.5 }, |
| 149 | { 489.7,269.9 }, { 486.4,270.8 }, { 482.9,270.9 }, { 479.5,270.4 }, |
| 150 | { 476.2,269.3 }, { 473.2,267.5 }, { 470.4,265 }, { 350,131.2 }, |
| 151 | { 347.8,128.3 }, { 346.4,125.1 }, { 345.6,121.7 }, {345.4,118.2 }, |
| 152 | { 346,114.8 }, { 347.1,111.5 }, { 348.9,108.5 }, { 351.4,105.8 }, |
| 153 | { 378.1,81.72 } |
| 154 | }; |
cristy | 6a917d9 | 2009-10-06 19:23:54 +0000 | [diff] [blame] | 155 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 156 | DrawSetStrokeAntialias(picasso,MagickTrue); |
| 157 | DrawSetStrokeWidth(picasso,2.016); |
| 158 | DrawSetStrokeLineCap(picasso,RoundCap); |
| 159 | DrawSetStrokeLineJoin(picasso,RoundJoin); |
cristy | f432c63 | 2014-12-07 15:11:28 +0000 | [diff] [blame] | 160 | (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 161 | (void) PixelSetColor(color,"#000080"); |
| 162 | DrawSetStrokeColor(picasso,color); |
| 163 | DrawSetFillRule(picasso,EvenOddRule); |
| 164 | (void) PixelSetColor(color,"#c2c280"); |
| 165 | DrawSetFillColor(picasso,color); |
| 166 | DrawPolygon(picasso,37,points); |
| 167 | } |
| 168 | (void) PopDrawingWand(picasso); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 169 | (void) PushDrawingWand(picasso); |
| 170 | { |
| 171 | DrawSetStrokeAntialias(picasso,MagickTrue); |
| 172 | DrawSetStrokeWidth(picasso,3.024); |
| 173 | DrawSetStrokeLineCap(picasso,RoundCap); |
| 174 | DrawSetStrokeLineJoin(picasso,RoundJoin); |
cristy | f432c63 | 2014-12-07 15:11:28 +0000 | [diff] [blame] | 175 | (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 176 | (void) PixelSetColor(color,"#000080"); |
| 177 | DrawSetStrokeColor(picasso,color); |
| 178 | DrawSetFillRule(picasso,EvenOddRule); |
| 179 | (void) PixelSetColor(color,"#000080"); |
| 180 | DrawSetFillColor(picasso,color); |
| 181 | DrawEllipse(picasso,489.6,424.8,72,129.6,0,360); |
| 182 | } |
| 183 | (void) PopDrawingWand(picasso); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 184 | (void) PushDrawingWand(picasso); |
| 185 | { |
| 186 | const PointInfo points[48] = |
| 187 | { |
| 188 | { 213.8,25.13}, { 216.7,24.48 }, {219.8,24.55 }, { 223.1,25.42 }, |
| 189 | { 226.7,27 }, { 230.3,29.3 }, { 234.1,32.26 }, { 237.9,35.86 }, |
| 190 | { 241.8,40.03 }, { 249.7,50.11 }, { 257.4,62.14 }, { 264.8,75.89 }, |
| 191 | { 271.6,91.15 }, { 277.3,106.8 }, { 281.6,121.8 }, { 284.4,135.9 }, |
| 192 | { 285.7,148.5 }, { 285.6,159.6 }, { 284.9,164.3 }, { 283.8,168.5 }, |
| 193 | { 282.5,172.1 }, { 280.7,175 }, { 278.5,177.3 }, { 275.9,178.7 }, |
| 194 | { 273,179.4 }, { 269.9,179.3 }, { 266.6,178.4 }, { 263.1,176.8 }, |
| 195 | { 259.5,174.5}, { 255.7,171.6 }, { 251.9,168 }, { 248,163.8 }, |
| 196 | { 244.1,159 }, { 240.1,153.7 }, { 232.3,141.7 }, { 225,127.9 }, |
| 197 | { 218.2,112.7 }, { 212.5,97.06 }, { 208.2,82.01 }, { 205.4,67.97 }, |
| 198 | { 204,55.3 }, { 204.3,44.35 }, { 204.9,39.6 }, { 205.9,35.42 }, |
| 199 | { 207.4,31.82 }, { 209.2,28.87 }, { 211.3,26.64}, { 213.8,25.13 } |
| 200 | }; |
cristy | 6a917d9 | 2009-10-06 19:23:54 +0000 | [diff] [blame] | 201 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 202 | DrawSetStrokeAntialias(picasso,MagickTrue); |
| 203 | DrawSetStrokeWidth(picasso,3.024); |
| 204 | DrawSetStrokeLineCap(picasso,RoundCap); |
| 205 | DrawSetStrokeLineJoin(picasso,RoundJoin); |
cristy | f432c63 | 2014-12-07 15:11:28 +0000 | [diff] [blame] | 206 | (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 207 | (void) PixelSetColor(color,"#ff8000"); |
| 208 | DrawSetStrokeColor(picasso,color); |
| 209 | DrawSetFillRule(picasso,EvenOddRule); |
| 210 | (void) PixelSetColor(color,"#00ffff"); |
| 211 | DrawSetFillColor(picasso,color); |
| 212 | DrawPolygon(picasso,48,points); |
| 213 | } |
| 214 | (void) PopDrawingWand(picasso); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 215 | (void) PushDrawingWand(picasso); |
| 216 | { |
| 217 | DrawSetStrokeAntialias(picasso,MagickTrue); |
| 218 | DrawSetStrokeWidth(picasso,12.02); |
| 219 | DrawSetStrokeLineCap(picasso,RoundCap); |
| 220 | DrawSetStrokeLineJoin(picasso,RoundJoin); |
cristy | f432c63 | 2014-12-07 15:11:28 +0000 | [diff] [blame] | 221 | (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 222 | (void) PixelSetColor(color,"#4000c2"); |
| 223 | DrawSetStrokeColor(picasso,color); |
| 224 | (void) PixelSetColor(color,"none"); |
| 225 | DrawSetFillColor(picasso,color); |
| 226 | DrawArc(picasso,360,554.4,187.2,237.6,0,90); |
| 227 | } |
| 228 | (void) PopDrawingWand(picasso); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 229 | (void) PushDrawingWand(picasso); |
| 230 | { |
| 231 | DrawSetStrokeAntialias(picasso,MagickTrue); |
| 232 | DrawSetStrokeWidth(picasso,9); |
| 233 | DrawSetStrokeLineCap(picasso,RoundCap); |
| 234 | DrawSetStrokeLineJoin(picasso,RoundJoin); |
cristy | f432c63 | 2014-12-07 15:11:28 +0000 | [diff] [blame] | 235 | (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 236 | (void) PixelSetColor(color,"#4000c2"); |
| 237 | DrawSetStrokeColor(picasso,color); |
| 238 | DrawSetFillRule(picasso,EvenOddRule); |
| 239 | (void) PixelSetColor(color,"#4000c2"); |
| 240 | DrawSetFillColor(picasso,color); |
| 241 | DrawEllipse(picasso,388.8,626.4,100.8,122.4,0,90); |
| 242 | } |
| 243 | (void) PopDrawingWand(picasso); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 244 | (void) PushDrawingWand(picasso); |
| 245 | { |
| 246 | const PointInfo points[6] = |
| 247 | { |
| 248 | { 180,504 }, { 282.7,578.6 }, { 243.5,699.4 }, { 116.5,699.4 }, |
| 249 | { 77.26,578.6 }, { 180,504 } |
| 250 | }; |
cristy | 6a917d9 | 2009-10-06 19:23:54 +0000 | [diff] [blame] | 251 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 252 | DrawSetStrokeAntialias(picasso,MagickTrue); |
| 253 | DrawSetStrokeWidth(picasso,9); |
| 254 | DrawSetStrokeLineCap(picasso,RoundCap); |
| 255 | DrawSetStrokeLineJoin(picasso,RoundJoin); |
cristy | f432c63 | 2014-12-07 15:11:28 +0000 | [diff] [blame] | 256 | (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 257 | (void) PixelSetColor(color,"#4000c2"); |
| 258 | DrawSetStrokeColor(picasso,color); |
| 259 | DrawSetFillRule(picasso,EvenOddRule); |
| 260 | (void) PixelSetColor(color,"#800000"); |
| 261 | DrawSetFillColor(picasso,color); |
| 262 | DrawPolygon(picasso,6,points); |
| 263 | } |
| 264 | (void) PopDrawingWand(picasso); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 265 | (void) PushDrawingWand(picasso); |
| 266 | { |
| 267 | const PointInfo points[11] = |
| 268 | { |
| 269 | { 180,504 }, { 211.8,568.3 }, { 282.7,578.6 }, { 231.3,628.7 }, |
| 270 | { 243.5,699.4 }, { 180,666 }, { 116.5,699.4 }, { 128.7,628.7 }, |
| 271 | { 77.26,578.6 }, { 148.2,568.3 }, { 180,504 } |
| 272 | }; |
cristy | 6a917d9 | 2009-10-06 19:23:54 +0000 | [diff] [blame] | 273 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 274 | DrawSetStrokeAntialias(picasso,MagickTrue); |
| 275 | DrawSetStrokeWidth(picasso,9); |
| 276 | DrawSetStrokeLineCap(picasso,RoundCap); |
| 277 | DrawSetStrokeLineJoin(picasso,RoundJoin); |
cristy | f432c63 | 2014-12-07 15:11:28 +0000 | [diff] [blame] | 278 | (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 279 | (void) PixelSetColor(color,"#4000c2"); |
| 280 | DrawSetStrokeColor(picasso,color); |
| 281 | DrawSetFillRule(picasso,EvenOddRule); |
| 282 | (void) PixelSetColor(color,"#800000"); |
| 283 | DrawSetFillColor(picasso,color); |
| 284 | DrawPolygon(picasso,11,points); |
| 285 | } |
| 286 | (void) PopDrawingWand(picasso); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 287 | (void) PushDrawingWand(picasso); |
| 288 | { |
| 289 | const PointInfo points[15] = |
| 290 | { |
| 291 | { 540,288 }, { 561.6,216 }, { 547.2,43.2 }, { 280.8,36 }, |
| 292 | { 302.4,194.4 }, { 331.2,64.8 }, { 504,64.8 }, { 475.2,115.2 }, |
| 293 | { 525.6,93.6 }, { 496.8,158.4 }, { 532.8,136.8 }, { 518.4,180 }, |
| 294 | { 540,172.8 }, { 540,223.2 }, { 540,288 } |
| 295 | }; |
cristy | 6a917d9 | 2009-10-06 19:23:54 +0000 | [diff] [blame] | 296 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 297 | DrawSetStrokeAntialias(picasso,MagickTrue); |
| 298 | DrawSetStrokeWidth(picasso,5.976); |
| 299 | DrawSetStrokeLineCap(picasso,RoundCap); |
| 300 | DrawSetStrokeLineJoin(picasso,RoundJoin); |
cristy | f432c63 | 2014-12-07 15:11:28 +0000 | [diff] [blame] | 301 | (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 302 | (void) PixelSetColor(color,"#4000c2"); |
| 303 | DrawSetStrokeColor(picasso,color); |
| 304 | DrawSetFillRule(picasso,EvenOddRule); |
| 305 | (void) PixelSetColor(color,"#ffff00"); |
| 306 | DrawSetFillColor(picasso,color); |
| 307 | DrawPolygon(picasso,15,points); |
| 308 | } |
| 309 | (void) PopDrawingWand(picasso); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 310 | (void) PushDrawingWand(picasso); |
| 311 | { |
| 312 | const PointInfo points[7] = |
| 313 | { |
| 314 | { 57.6,640.8 }, { 57.6,784.8 }, { 194.4,799.2 }, { 259.2,777.6 }, |
| 315 | { 151.2,756 }, { 86.4,748.8 }, { 57.6,640.8 } |
| 316 | }; |
cristy | 6a917d9 | 2009-10-06 19:23:54 +0000 | [diff] [blame] | 317 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 318 | DrawSetStrokeAntialias(picasso,MagickTrue); |
| 319 | DrawSetStrokeWidth(picasso,5.976); |
| 320 | DrawSetStrokeLineCap(picasso,RoundCap); |
| 321 | DrawSetStrokeLineJoin(picasso,RoundJoin); |
cristy | f432c63 | 2014-12-07 15:11:28 +0000 | [diff] [blame] | 322 | (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 323 | (void) PixelSetColor(color,"#4000c2"); |
| 324 | DrawSetStrokeColor(picasso,color); |
| 325 | DrawSetFillRule(picasso,EvenOddRule); |
| 326 | (void) PixelSetColor(color,"#ffff00"); |
| 327 | DrawSetFillColor(picasso,color); |
| 328 | DrawPolygon(picasso,7,points); |
| 329 | } |
| 330 | (void) PopDrawingWand(picasso); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 331 | (void) PushDrawingWand(picasso); |
| 332 | { |
| 333 | const PointInfo points[193] = |
| 334 | { |
| 335 | { 27.86,565.3 }, { 29.66,550.8 }, { 31.97,538.1 }, { 34.85,527.1 }, |
| 336 | { 38.09,517.7 }, { 41.83,509.8 }, { 45.86,503.1 }, { 50.33,497.6 }, |
| 337 | { 55.08,493.2 }, { 60.19,489.8 }, { 65.45,487.3 }, { 70.92,485.4 }, |
| 338 | { 76.61,484.2 }, { 88.42,483 }, { 100.4,482.9 }, { 108.4,482.2 }, |
| 339 | { 119.8,480.3 }, { 150.8,474.1 }, { 189.4,466.6 }, { 210.3,463 }, |
| 340 | { 231.5,459.9 }, { 252.4,457.8 }, { 272.7,456.6 }, { 291.8,456.9 }, |
| 341 | { 300.7,457.7 }, { 309.1,458.9 }, { 316.9,460.6 }, { 324.1,462.8 }, |
| 342 | { 330.7,465.6 }, { 336.4,469 }, { 341.3,473 }, { 345.3,477.7 }, |
| 343 | { 348.4,483.1 }, { 350.4,489.2}, { 352.4,495.4 }, { 355.2,500.9 }, |
| 344 | { 358.8,505.8 }, { 363,510 }, { 367.8,513.6 }, { 373,516.8 }, |
| 345 | { 378.6,519.6 }, { 384.3,521.8 }, { 396.4,525.4 }, { 408.2,527.9 }, |
| 346 | { 428,531.2 }, { 434.6,532.9 }, { 436.7,533.8 }, { 437.8,534.9 }, |
| 347 | { 437.8,536.2 }, { 436.8,537.8 }, { 434.5,539.6 }, { 430.9,541.8 }, |
| 348 | { 419.3,547.6 }, { 401.3,555.2 }, { 342.4,577.9 }, {325.2,584.9 }, |
cristy | 6a917d9 | 2009-10-06 19:23:54 +0000 | [diff] [blame] | 349 | { 311,591.3 }, { 300,597.3 }, { 291.6,602.8 }, { 285.8,607.8 }, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 350 | { 282.3,612.3 }, { 281.4,614.4 }, { 280.9,616.2 }, { 281.2,619.6 }, |
| 351 | { 282.1,621.2 }, { 283.3,622.6 }, { 286.8,624.9 }, { 291.5,626.6 }, |
| 352 | { 297.1,627.8 }, { 303.6,628.3 }, { 310.5,628.3 }, { 317.9,627.6 }, |
| 353 | { 325.2,626.3 }, { 332.6,624.3 }, { 339.5,621.7 }, { 345.9,618.4 }, |
| 354 | { 351.4,614.4 }, { 353.9,612.2 }, { 356,609.8 }, { 357.9,607.1 }, |
| 355 | { 359.4,604.3 }, { 360.6,601.3 }, { 361.4,598.2 }, { 361.7,594.9 }, |
| 356 | { 361.7,591.3 }, { 361.2,587.7 }, { 360.1,583.7 }, { 358.6,579.7 }, |
| 357 | { 356.4,575.4 }, { 353.7,570.9 }, { 350.4,566.2 }, { 346.4,561.3 }, |
| 358 | { 341.8,556.2 }, { 336.5,550.9 }, { 330.6,545.5 }, { 323.8,539.8 }, |
| 359 | { 316.2,533.9 }, { 298.7,521.5 }, { 277.8,508.2 }, { 256.1,495.5 }, |
| 360 | { 236,484.5 }, { 217.7,475.1 }, { 200.8,467.1 }, { 185.6,460.7 }, |
| 361 | { 171.9,455.5 }, { 159.6,451.6 }, { 148.6,448.8 }, { 139,447 }, |
| 362 | { 130.5,446.2 }, { 123.3,446.2 }, { 117.1,446.9 }, { 112,448.3 }, |
| 363 | { 107.9,450.2 }, { 104.8,452.5 }, { 102.5,455.2 }, { 101,458.1 }, |
| 364 | { 100.2,461.2 }, { 100.2,464.3 }, { 100.7,467.4 }, { 101.8,470.3 }, |
| 365 | { 103.4,473 }, { 105.4,475.3 }, { 107.8,477.1 }, { 110.5,478.4 }, |
| 366 | { 113.4,479.1 }, { 116.5,478.9 }, { 119.7,478 }, { 123,476.2 }, |
| 367 | { 126.4,473.3 }, { 129.6,469.2 }, { 132.7,463.9 }, { 135.2,458.4 }, |
| 368 | { 136.6,453.7 }, { 137,449.9 }, { 136.6,446.8 }, { 135.4,444.5 }, |
| 369 | { 133.3,442.9 }, { 130.8,441.9 }, { 127.5,441.4 }, { 123.9,441.6 }, |
| 370 | { 119.8,442.3 }, { 110.7,445.1 }, { 101.1,449.5 }, { 91.37,455.2 }, |
| 371 | { 82.37,461.9 }, { 74.66,469.2 }, { 71.57,473 }, { 68.98,476.8 }, |
| 372 | { 67.03,480.7 }, { 65.81,484.4 }, { 65.45,488.2 }, { 65.95,491.7 }, |
| 373 | { 67.46,495.1 }, { 69.98,498.3 }, { 73.66,501.3 }, { 78.55,503.9 }, |
| 374 | { 84.82,506.3 }, { 92.38,508.2 }, { 107.1,511.6 }, { 118.2,514.8 }, |
| 375 | { 125.9,517.8 }, { 130.7,520.4 }, { 132.1,521.7 }, { 132.8,522.9 }, |
| 376 | { 133,524.2 }, { 132.6,525.3 }, { 131.8,526.5 }, { 130.5,527.5 }, |
| 377 | { 126.6,529.6 }, { 121.5,531.7 }, { 115.3,533.7 }, { 101.4,537.6 }, |
| 378 | { 87.55,541.8 }, { 81.36,544 }, { 76.25,546.3 }, { 71.64,549.5 }, |
| 379 | { 66.89,554.1 }, { 62.14,559.8 }, { 57.38,566.1 }, { 48.17,579.6 }, |
| 380 | { 39.96,591.4 }, { 36.43,595.9 }, { 34.78,597.6 }, { 33.26,598.8 }, |
| 381 | { 31.9,599.6 }, { 30.67,599.9 }, { 29.59,599.7 }, { 28.66,598.8 }, |
| 382 | { 27.86,597.4 }, { 27.29,595.2 }, { 26.64,588.7 }, { 26.86,578.8 }, |
| 383 | { 27.86,565.3 } |
| 384 | }; |
cristy | 6a917d9 | 2009-10-06 19:23:54 +0000 | [diff] [blame] | 385 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 386 | DrawSetStrokeAntialias(picasso,MagickTrue); |
| 387 | DrawSetStrokeWidth(picasso,5.904); |
| 388 | DrawSetStrokeLineCap(picasso,RoundCap); |
| 389 | DrawSetStrokeLineJoin(picasso,RoundJoin); |
cristy | f432c63 | 2014-12-07 15:11:28 +0000 | [diff] [blame] | 390 | (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 391 | (void) PixelSetColor(color,"#4000c2"); |
| 392 | DrawSetStrokeColor(picasso,color); |
| 393 | DrawSetFillRule(picasso,EvenOddRule); |
| 394 | (void) PixelSetColor(color,"#ffff00"); |
| 395 | DrawSetFillColor(picasso,color); |
| 396 | DrawPolygon(picasso,193,points); |
| 397 | } |
| 398 | (void) PopDrawingWand(picasso); |
| 399 | } |
| 400 | (void) PopDrawingWand(picasso); |
| 401 | } |
| 402 | (void) PopDrawingWand(picasso); |
| 403 | (void) MagickDrawImage(canvas,picasso); |
| 404 | color=DestroyPixelWand(color); |
| 405 | picasso=DestroyDrawingWand(picasso); |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 406 | return(MagickTrue); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 407 | } |
| 408 | |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 409 | int main(int argc,char **argv) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 410 | { |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 411 | char |
cristy | 151b66d | 2015-04-15 10:50:31 +0000 | [diff] [blame] | 412 | filename[MagickPathExtent]; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 413 | |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 414 | MagickBooleanType |
| 415 | status; |
| 416 | |
| 417 | MagickWand |
| 418 | *canvas; |
| 419 | |
| 420 | if (argc != 2) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 421 | { |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 422 | (void) printf ("Usage: %s filename\n",argv[0]); |
| 423 | exit(1); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 424 | } |
cristy | 151b66d | 2015-04-15 10:50:31 +0000 | [diff] [blame] | 425 | (void) CopyMagickString(filename,argv[1],MagickPathExtent); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 426 | /* |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 427 | Create canvas image. |
| 428 | */ |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 429 | MagickWandGenesis(); |
| 430 | canvas=NewMagickWand(); |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 431 | status=MagickSetSize(canvas,596,842); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 432 | if (status == MagickFalse) |
| 433 | ThrowWandException(canvas); |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 434 | status=MagickReadImage(canvas,"xc:white"); |
| 435 | if (status == MagickFalse) |
| 436 | ThrowWandException(canvas); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 437 | /* |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 438 | Scribble on image. |
| 439 | */ |
| 440 | status=ScribbleImage(canvas); |
| 441 | if (status == MagickFalse) |
| 442 | ThrowWandException(canvas); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 443 | /* |
cristy | 4a16cd5 | 2010-01-05 14:04:01 +0000 | [diff] [blame] | 444 | Set pixel depth to 8. |
| 445 | */ |
| 446 | status=MagickSetImageDepth(canvas,8); |
| 447 | if (status == MagickFalse) |
| 448 | ThrowWandException(canvas); |
| 449 | /* |
cristy | 778ca77 | 2012-04-28 16:27:30 +0000 | [diff] [blame] | 450 | Set output as RLE compressed. |
cristy | 4a16cd5 | 2010-01-05 14:04:01 +0000 | [diff] [blame] | 451 | */ |
cristy | 778ca77 | 2012-04-28 16:27:30 +0000 | [diff] [blame] | 452 | status=MagickSetImageCompression(canvas,RLECompression); |
cristy | 4a16cd5 | 2010-01-05 14:04:01 +0000 | [diff] [blame] | 453 | if (status == MagickFalse) |
| 454 | ThrowWandException(canvas); |
| 455 | /* |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 456 | Save image to file. |
| 457 | */ |
| 458 | status=MagickWriteImage(canvas,filename); |
| 459 | if (status == MagickFalse) |
| 460 | ThrowWandException(canvas); |
| 461 | canvas=DestroyMagickWand(canvas); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 462 | MagickWandTerminus(); |
cristy | ced48ba | 2009-12-13 18:55:24 +0000 | [diff] [blame] | 463 | return(0); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 464 | } |