| 3446 | var TWIRL = "twirl"; |
| 3447 | |
| 3448 | function distort(mode, img, options) { |
| 3449 | /* Applies the given distortion and returns a new image. |
| 3450 | * Optional parameters are dx, dy, radius, zoom and angle. |
| 3451 | */ |
| 3452 | var o = options || {}; |
| 3453 | switch (mode) { |
| 3454 | case BUMP: |
| 3455 | return bump(img, o.dx, o.dy, o.radius, o.zoom); |
| 3456 | case DENT: |
| 3457 | return dent(img, o.dx, o.dy, o.radius, o.zoom); |
| 3458 | case PINCH: |
| 3459 | return pinch(img, o.dx, o.dy, o.zoom); |
| 3460 | case SPLASH: |
| 3461 | return splash(img, o.dx, o.dy, o.radius); |
| 3462 | case TWIRL: |
| 3463 | return twirl(img, o.dx, o.dy, o.radius, o.angle); |
| 3464 | default: |
| 3465 | return img; |
| 3466 | } |
| 3467 | } |
| 3468 | |
| 3469 | /*##################################################################################################*/ |
| 3470 | |