1 /*
2 * Folds the picture down from the corners.
3 *
4 * Last updated: 2019-08-29
5 */
6
7 //optimized version soon :)
8 //when "folding" same corner many times it gives strange results. Now it's allowed. Let me know
9 //if you think it shouldn't be.
10
11 //sound playing needs fixing.
12
13 #include "tp_magic_api.h"
14 #include "SDL_image.h"
15 #include "SDL_mixer.h"
16
17 #define FOLD_LEN 80
18
19 int right_arm_x, right_arm_y, left_arm_x, left_arm_y;
20 int fold_ox, fold_oy;
21 int fold_x, fold_y;
22 Uint8 fold_shadow_value;
23 Uint8 corner;
24 Mix_Chunk *fold_snd;
25 Uint8 fold_r, fold_g, fold_b;
26 Uint32 fold_color;
27 SDL_Surface *fold_surface_src, *fold_surface_dst;
28
29
30 void fold_draw(magic_api * api, int which,
31 SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect);
32 static void fold_erase(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
33 void translate_coords(SDL_Surface * canvas, int angle);
34 SDL_Surface *rotate(magic_api * api, SDL_Surface * canvas, int angle);
35 void fold_draw(magic_api * api, int which,
36 SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect);
37 static void fold_print_line(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
38 static void fold_print_dark_line(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
39 void translate_xy(SDL_Surface * canvas, int x, int y, int *a, int *b, int rotation);
40 Uint32 fold_api_version(void);
41 void fold_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
42 int fold_init(magic_api * api);
43 int fold_get_tool_count(magic_api * api);
44 SDL_Surface *fold_get_icon(magic_api * api, int which);
45 char *fold_get_name(magic_api * api, int which);
46 char *fold_get_description(magic_api * api, int which, int mode);
47 int fold_requires_colors(magic_api * api, int which);
48 void fold_release(magic_api * api, int which,
49 SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect);
50 void fold_shutdown(magic_api * api);
51 void fold_click(magic_api * ptr, int which, int mode,
52 SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect);
53 void fold_preview(magic_api * api, int which, SDL_Surface * canvas,
54 SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect);
55 int fold_modes(magic_api * api, int which);
56
57 // Housekeeping functions
58
59 void fold_drag(magic_api * api, int which, SDL_Surface * canvas,
60 SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect);
61 void fold_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
62 inline Uint8 fold_what_corner(int x, int y, SDL_Surface * canvas);
63 void fold_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
64
fold_api_version(void)65 Uint32 fold_api_version(void)
66 {
67 return (TP_MAGIC_API_VERSION);
68 }
69
fold_set_color(magic_api * api ATTRIBUTE_UNUSED,Uint8 r,Uint8 g,Uint8 b)70 void fold_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b) //get the colors from API and store it in structure
71 {
72 fold_r = r;
73 fold_g = g;
74 fold_b = b;
75 }
76
fold_init(magic_api * api)77 int fold_init(magic_api * api)
78 {
79 char fname[1024];
80
81 snprintf(fname, sizeof(fname), "%s/sounds/magic/fold.wav", api->data_directory);
82 fold_snd = Mix_LoadWAV(fname);
83
84 return (1);
85 }
86
fold_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)87 int fold_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
88 {
89 return 1;
90 }
91
fold_get_icon(magic_api * api ATTRIBUTE_UNUSED,int which ATTRIBUTE_UNUSED)92 SDL_Surface *fold_get_icon(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
93 {
94 char fname[1024];
95
96 snprintf(fname, sizeof(fname), "%s/images/magic/fold.png", api->data_directory);
97
98 return (IMG_Load(fname));
99 }
100
fold_get_name(magic_api * api ATTRIBUTE_UNUSED,int which ATTRIBUTE_UNUSED)101 char *fold_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
102 {
103 return (gettext_noop("Fold"));
104 }
105
fold_get_description(magic_api * api ATTRIBUTE_UNUSED,int which ATTRIBUTE_UNUSED,int mode ATTRIBUTE_UNUSED)106 char *fold_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
107 {
108 return strdup(gettext_noop("Choose a background color and click to turn the corner of the page over."));
109 }
110
fold_requires_colors(magic_api * api ATTRIBUTE_UNUSED,int which ATTRIBUTE_UNUSED)111 int fold_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
112 {
113 return 1;
114 } //selected color will be a "backpage" color
115
116
fold_shadow(void * ptr,int which ATTRIBUTE_UNUSED,SDL_Surface * canvas,SDL_Surface * temp,int x,int y)117 static void fold_shadow(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * temp, int x, int y)
118 {
119 magic_api *api = (magic_api *) ptr;
120 Uint8 r, g, b, a;
121
122 SDL_GetRGBA(api->getpixel(temp, x, y), temp->format, &r, &g, &b, &a);
123 api->putpixel(canvas, x, y, SDL_MapRGBA(canvas->format,
124 max(r - 160 + fold_shadow_value * 4, 0), max(g - 160 + fold_shadow_value * 4,
125 0),
126 max(b - 160 + fold_shadow_value * 4, 0), a));
127 }
128
fold_draw(magic_api * api,int which,SDL_Surface * canvas,SDL_Surface * snapshot,int x,int y,SDL_Rect * update_rect ATTRIBUTE_UNUSED)129 void fold_draw(magic_api * api, int which,
130 SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
131 {
132 float right_step_x, right_step_y, left_step_x, left_step_y;
133 float dist_x, dist_y;
134 int left_y, right_x;
135 float w, h;
136 SDL_Surface *temp;
137
138 temp = SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->w, canvas->h, canvas->format->BitsPerPixel,
139 canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask,
140 canvas->format->Amask);
141 SDL_BlitSurface(canvas, 0, temp, 0);
142
143 right_step_x = (float)(x - left_arm_x) / (float)(left_arm_x - fold_ox);
144 right_step_y = (float)(y - left_arm_y) / (float)(left_arm_x - fold_ox);
145 left_step_x = (float)(x - right_arm_x) / (float)(right_arm_y - fold_oy);
146 left_step_y = (float)(y - right_arm_y) / (float)(right_arm_y - fold_oy);
147
148 left_y = (float)right_arm_y / left_arm_x * (left_arm_x - canvas->w);
149 right_x = (float)left_arm_x / right_arm_y * (right_arm_y - canvas->h);
150
151 for (w = 0; w < canvas->w; w += 0.5)
152 {
153 for (h = 0; h < canvas->h; h += 0.5)
154 {
155 dist_x = right_step_x * w + left_step_x * h;
156 dist_y = right_step_y * w + left_step_y * h;
157 api->putpixel(canvas, x - dist_x, y - dist_y, api->getpixel(temp, w, h));
158 }
159 }
160
161 // Erasing the triangle.
162 // The 1 pixel in plus is a workaround for api-line not getting the end in some lines.
163 if (left_arm_x > canvas->w)
164 {
165 for (h = 0; h <= right_arm_y; h++)
166 api->line((void *)api, which, canvas, snapshot, canvas->w, left_y - h, -1, right_arm_y - h, 1, fold_erase);
167 }
168 else if (right_arm_y > canvas->h)
169 {
170 for (w = 0; w <= left_arm_x; w++)
171 api->line((void *)api, which, canvas, snapshot, left_arm_x - w, 0, right_x - w, canvas->h + 1, 1, fold_erase);
172 }
173 else
174 for (w = 0; w <= min(left_arm_x, right_arm_y); w++) // The -1 values are because api->line
175 api->line((void *)api, which, canvas, snapshot, left_arm_x - w, 0, -1, right_arm_y - w, 1, fold_erase);
176
177 SDL_BlitSurface(canvas, 0, temp, 0);
178
179 // Shadows
180 if (left_arm_x > canvas->w)
181 {
182 for (fold_shadow_value = 0; fold_shadow_value < 40; fold_shadow_value += 1)
183 api->line((void *)api, which, canvas, temp, canvas->w, left_y - fold_shadow_value, 0,
184 right_arm_y - fold_shadow_value, 1, fold_shadow);
185
186 }
187 else if (right_arm_y > canvas->h)
188 {
189 for (fold_shadow_value = 0; fold_shadow_value < 40; fold_shadow_value += 1)
190 api->line((void *)api, which, canvas, temp, left_arm_x - fold_shadow_value, 0, right_x - fold_shadow_value,
191 canvas->h, 1, fold_shadow);
192
193 }
194
195 else
196 for (fold_shadow_value = 0; fold_shadow_value < 40; fold_shadow_value += 1)
197 api->line((void *)api, which, canvas, temp, left_arm_x - fold_shadow_value, 0, 0, right_arm_y - fold_shadow_value,
198 1, fold_shadow);
199
200 SDL_BlitSurface(canvas, 0, temp, 0);
201
202 for (fold_shadow_value = 0; fold_shadow_value < 40; fold_shadow_value += 1)
203 {
204 if (fold_shadow_value * left_step_x > x || fold_shadow_value * right_step_y > y)
205 break;
206
207 dist_x = fold_shadow_value * (right_step_x + left_step_x);
208 dist_y = fold_shadow_value * (right_step_y + left_step_y);
209 api->line((void *)api, which, canvas, temp, left_arm_x + fold_shadow_value * right_step_x,
210 fold_shadow_value * right_step_y, fold_shadow_value * left_step_x,
211 right_arm_y + fold_shadow_value * left_step_y, 1, fold_shadow);
212 }
213
214 api->line((void *)api, which, canvas, snapshot, x, y, right_arm_x, right_arm_y, 1, fold_print_line);
215 api->line((void *)api, which, canvas, snapshot, x, y, left_arm_x, left_arm_y, 1, fold_print_line);
216 api->line((void *)api, which, canvas, snapshot, left_arm_x, left_arm_y, right_arm_x, right_arm_y, 1,
217 fold_print_dark_line);
218
219 }
220
rotate(magic_api * api,SDL_Surface * canvas,int angle)221 SDL_Surface *rotate(magic_api * api, SDL_Surface * canvas, int angle)
222 {
223 SDL_Surface *temp;
224 int x, y;
225 int a, b;
226
227 if (angle == 180)
228 temp = SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->w, canvas->h, canvas->format->BitsPerPixel,
229 canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask,
230 canvas->format->Amask);
231 else
232 temp = SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->h, canvas->w, canvas->format->BitsPerPixel,
233 canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask,
234 canvas->format->Amask);
235
236 switch (angle)
237 {
238 case 90:
239 for (x = 0; x < canvas->w; x++)
240 for (y = 0; y < canvas->h; y++)
241 {
242 translate_xy(canvas, x, y, &a, &b, 90);
243 api->putpixel(temp, a, b, api->getpixel(canvas, x, y));
244 }
245 break;
246
247 case 180:
248 // printf("%i, %i\n",temp,canvas);
249 for (x = 0; x < canvas->w; x++)
250 for (y = 0; y < canvas->h; y++)
251 {
252 translate_xy(canvas, x, y, &a, &b, 180);
253 api->putpixel(temp, a, b, api->getpixel(canvas, x, y));
254 }
255 break;
256
257 case 270:
258 for (x = 0; x < canvas->w; x++)
259 for (y = 0; y < canvas->h; y++)
260 {
261 translate_xy(canvas, x, y, &a, &b, 270);
262 api->putpixel(temp, a, b, api->getpixel(canvas, x, y));
263 }
264 break;
265 }
266 return temp;
267 }
268
translate_coords(SDL_Surface * canvas,int angle)269 void translate_coords(SDL_Surface * canvas, int angle)
270 {
271 int a, b;
272
273 switch (angle)
274 {
275 case 90:
276 translate_xy(canvas, right_arm_x, right_arm_y, &a, &b, 90);
277 right_arm_x = a;
278 right_arm_y = b;
279 translate_xy(canvas, left_arm_x, left_arm_y, &a, &b, 90);
280 left_arm_x = a;
281 left_arm_y = b;
282
283 break;
284 case 180:
285 right_arm_x = canvas->w - 1 - right_arm_x;
286 right_arm_y = canvas->h - 1 - right_arm_y;
287 left_arm_x = canvas->w - 1 - left_arm_x;
288 left_arm_y = canvas->h - 1 - left_arm_y;
289 break;
290 case 270:
291 translate_xy(canvas, right_arm_x, right_arm_y, &a, &b, 270);
292 right_arm_x = a;
293 right_arm_y = b;
294 translate_xy(canvas, left_arm_x, left_arm_y, &a, &b, 270);
295 left_arm_x = a;
296 left_arm_y = b;
297 break;
298 }
299 }
300
translate_xy(SDL_Surface * canvas,int x,int y,int * a,int * b,int rotation)301 void translate_xy(SDL_Surface * canvas, int x, int y, int *a, int *b, int rotation)
302 {
303 switch (rotation)
304 {
305 case 90:
306 *a = y;
307 *b = canvas->w - 1 - x;
308 break;
309 case 180:
310 *a = canvas->w - 1 - x;
311 *b = canvas->h - 1 - y;
312 break;
313 case 270:
314 *a = canvas->h - 1 - y;
315 *b = x;
316 break;
317 }
318 }
319
fold_release(magic_api * api,int which,SDL_Surface * canvas,SDL_Surface * snapshot,int x,int y,SDL_Rect * update_rect)320 void fold_release(magic_api * api, int which,
321 SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect)
322 {
323 int a, b;
324 SDL_Surface *temp, *temp2;
325
326 x = fold_x;
327 y = fold_y;
328 fold_ox = fold_oy = 0;
329 SDL_BlitSurface(snapshot, 0, canvas, 0);
330 switch (corner)
331 {
332 case 1:
333 translate_xy(canvas, x, y, &a, &b, 90);
334 translate_coords(canvas, 90);
335 temp = rotate(api, canvas, 90);
336 fold_draw(api, which, temp, snapshot, a, b, update_rect);
337 temp2 = rotate(api, temp, 270);
338 SDL_BlitSurface(temp2, 0, canvas, 0);
339 SDL_FreeSurface(temp);
340 SDL_FreeSurface(temp2);
341 break;
342
343 case 2:
344 fold_draw(api, which, canvas, snapshot, x, y, update_rect);
345 break;
346
347 case 3:
348 translate_xy(canvas, x, y, &a, &b, 270);
349 translate_coords(canvas, 270);
350 temp = rotate(api, canvas, 270);
351 fold_draw(api, which, temp, snapshot, a, b, update_rect);
352 temp2 = rotate(api, temp, 90);
353 SDL_BlitSurface(temp2, 0, canvas, 0);
354 SDL_FreeSurface(temp);
355 SDL_FreeSurface(temp2);
356 break;
357
358 case 4:
359 translate_xy(canvas, x, y, &a, &b, 180);
360 translate_coords(canvas, 180);
361 temp = rotate(api, canvas, 180);
362 fold_draw(api, which, temp, snapshot, a, b, update_rect);
363 temp2 = rotate(api, temp, 180);
364 SDL_BlitSurface(temp2, 0, canvas, 0);
365 SDL_FreeSurface(temp);
366 SDL_FreeSurface(temp2);
367 break;
368 }
369
370 update_rect->x = update_rect->y = 0;
371 update_rect->w = canvas->w;
372 update_rect->h = canvas->h;
373 api->playsound(fold_snd, (x * 255) / canvas->w, 255);
374 }
375
fold_shutdown(magic_api * api ATTRIBUTE_UNUSED)376 void fold_shutdown(magic_api * api ATTRIBUTE_UNUSED)
377 {
378 Mix_FreeChunk(fold_snd);
379 SDL_FreeSurface(fold_surface_dst);
380 SDL_FreeSurface(fold_surface_src);
381 }
382
383 // Interactivity functions
384
fold_what_corner(int x,int y,SDL_Surface * canvas)385 inline Uint8 fold_what_corner(int x, int y, SDL_Surface * canvas)
386 {
387 if (x >= canvas->w / 2)
388 {
389 if (y >= canvas->h / 2)
390 return 4;
391 else
392 return 1;
393 }
394 else
395 {
396 if (y >= canvas->h / 2)
397 return 3;
398 else
399 return 2;
400 }
401 }
402
403
fold_print_line(void * ptr,int which ATTRIBUTE_UNUSED,SDL_Surface * canvas,SDL_Surface * last,int x,int y)404 static void fold_print_line(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last,
405 int x, int y)
406 {
407 magic_api *api = (magic_api *) ptr;
408
409 api->putpixel(canvas, x, y, SDL_MapRGB(last->format, 222, 222, 222)); //Middle gray. Color have been set arbitrary.
410 }
411
fold_print_dark_line(void * ptr,int which ATTRIBUTE_UNUSED,SDL_Surface * canvas,SDL_Surface * last ATTRIBUTE_UNUSED,int x,int y)412 static void fold_print_dark_line(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
413 SDL_Surface * last ATTRIBUTE_UNUSED, int x, int y)
414 {
415 magic_api *api = (magic_api *) ptr;
416
417 api->putpixel(canvas, x, y, SDL_MapRGB(last->format, 90, 90, 90)); //It should not look too black nor too white with shadowed colors.
418 }
419
fold_erase(void * ptr,int which ATTRIBUTE_UNUSED,SDL_Surface * canvas,SDL_Surface * last ATTRIBUTE_UNUSED,int x,int y)420 static void fold_erase(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
421 int x, int y)
422 {
423 magic_api *api = (magic_api *) ptr;
424
425 api->putpixel(canvas, x, y, SDL_MapRGB(canvas->format, fold_r, fold_g, fold_b));
426 }
427
fold_click(magic_api * ptr,int which,int mode ATTRIBUTE_UNUSED,SDL_Surface * canvas,SDL_Surface * snapshot,int x,int y,SDL_Rect * update_rect)428 void fold_click(magic_api * ptr, int which, int mode ATTRIBUTE_UNUSED,
429 SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect)
430 {
431 magic_api *api = (magic_api *) ptr;
432
433 corner = fold_what_corner(x, y, snapshot);
434
435 switch (corner)
436 {
437 case 1:
438 fold_ox = canvas->w - 1;
439 fold_oy = 0;
440 break;
441 case 2:
442 fold_ox = fold_oy = 0;
443 break;
444 case 3:
445 fold_ox = 0;
446 fold_oy = canvas->h - 1;
447 break;
448 case 4:
449 fold_ox = canvas->w - 1;
450 fold_oy = canvas->h - 1;
451 break;
452 }
453
454 fold_drag(api, which, canvas, snapshot, x, y, x, y, update_rect);
455 }
456
fold_preview(magic_api * api,int which,SDL_Surface * canvas,SDL_Surface * snapshot,int ox ATTRIBUTE_UNUSED,int oy ATTRIBUTE_UNUSED,int x,int y,SDL_Rect * update_rect)457 void fold_preview(magic_api * api, int which, SDL_Surface * canvas,
458 SDL_Surface * snapshot, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x, int y,
459 SDL_Rect * update_rect)
460 {
461 int middle_point_x;
462 int middle_point_y;
463
464 fold_x = x;
465 fold_y = y;
466 SDL_BlitSurface(snapshot, 0, canvas, 0);
467
468 middle_point_x = (fold_ox + x) / 2;
469 middle_point_y = (fold_oy + y) / 2;
470
471 switch (corner)
472 {
473 case 1: //Right Upper
474 right_arm_x = fold_ox - (fold_ox - middle_point_x) - middle_point_y * middle_point_y / (fold_ox - middle_point_x);
475 right_arm_y = fold_oy;
476
477 left_arm_x = fold_ox;
478 left_arm_y =
479 fold_oy - (fold_oy - middle_point_y) - (fold_ox - middle_point_x) * (fold_ox - middle_point_x) / (fold_oy -
480 middle_point_y);
481 break;
482
483 case 2: //LU
484 right_arm_x = fold_ox;
485 right_arm_y = middle_point_y + middle_point_x * middle_point_x / middle_point_y;
486
487 left_arm_x = middle_point_x + middle_point_y * middle_point_y / middle_point_x;
488 left_arm_y = fold_oy;
489 break;
490
491 case 3: //LL
492 right_arm_x = middle_point_x + (fold_oy - middle_point_y) * (fold_oy - middle_point_y) / middle_point_x;
493 right_arm_y = fold_oy;
494
495 left_arm_x = fold_ox;
496 left_arm_y =
497 fold_oy - (fold_oy - middle_point_y) - (fold_ox - middle_point_x) * (fold_ox - middle_point_x) / (fold_oy -
498 middle_point_y);
499 break;
500
501 case 4: //RL
502 right_arm_x = fold_ox;
503 right_arm_y =
504 fold_oy - (fold_oy - middle_point_y) - (fold_ox - middle_point_x) * (fold_ox - middle_point_x) / (fold_oy -
505 middle_point_y);
506
507 left_arm_x =
508 fold_ox - (fold_ox - middle_point_x) - (fold_oy - middle_point_y) * (fold_oy - middle_point_y) / (fold_ox -
509 middle_point_x);
510 left_arm_y = fold_oy;
511 break;
512 }
513
514 api->line((void *)api, which, canvas, snapshot, x, y, right_arm_x, right_arm_y, 1, fold_print_line);
515 api->line((void *)api, which, canvas, snapshot, x, y, left_arm_x, left_arm_y, 1, fold_print_line);
516 api->line((void *)api, which, canvas, snapshot, left_arm_x, left_arm_y, right_arm_x, right_arm_y, 1, fold_print_line);
517
518 update_rect->x = update_rect->y = 0;
519 update_rect->w = canvas->w;
520 update_rect->h = canvas->h;
521 }
522
fold_drag(magic_api * api,int which,SDL_Surface * canvas,SDL_Surface * snapshot,int ox,int oy,int x,int y,SDL_Rect * update_rect)523 void fold_drag(magic_api * api, int which, SDL_Surface * canvas,
524 SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect)
525 {
526 // Avoid division by zero when calculating the preview
527 x = clamp(2, x, canvas->w - 2);
528 y = clamp(2, y, canvas->h - 2);
529 fold_preview(api, which, canvas, snapshot, ox, oy, x, y, update_rect);
530 }
531
fold_switchin(magic_api * api ATTRIBUTE_UNUSED,int which ATTRIBUTE_UNUSED,int mode ATTRIBUTE_UNUSED,SDL_Surface * canvas ATTRIBUTE_UNUSED)532 void fold_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
533 SDL_Surface * canvas ATTRIBUTE_UNUSED)
534 {
535 }
536
fold_switchout(magic_api * api ATTRIBUTE_UNUSED,int which ATTRIBUTE_UNUSED,int mode ATTRIBUTE_UNUSED,SDL_Surface * canvas ATTRIBUTE_UNUSED)537 void fold_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
538 SDL_Surface * canvas ATTRIBUTE_UNUSED)
539 {
540 }
541
fold_modes(magic_api * api ATTRIBUTE_UNUSED,int which ATTRIBUTE_UNUSED)542 int fold_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
543 {
544 return (MODE_PAINT_WITH_PREVIEW);
545 }
546