( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, image )
| 14468 | } |
| 14469 | |
| 14470 | function clipImage( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, image ) { |
| 14471 | |
| 14472 | // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 |
| 14473 | |
| 14474 | var a, b, c, d, e, f, det, idet, |
| 14475 | width = image.width - 1, |
| 14476 | height = image.height - 1; |
| 14477 | |
| 14478 | u0 *= width; v0 *= height; |
| 14479 | u1 *= width; v1 *= height; |
| 14480 | u2 *= width; v2 *= height; |
| 14481 | |
| 14482 | x1 -= x0; y1 -= y0; |
| 14483 | x2 -= x0; y2 -= y0; |
| 14484 | |
| 14485 | u1 -= u0; v1 -= v0; |
| 14486 | u2 -= u0; v2 -= v0; |
| 14487 | |
| 14488 | det = u1 * v2 - u2 * v1; |
| 14489 | |
| 14490 | idet = 1 / det; |
| 14491 | |
| 14492 | a = ( v2 * x1 - v1 * x2 ) * idet; |
| 14493 | b = ( v2 * y1 - v1 * y2 ) * idet; |
| 14494 | c = ( u1 * x2 - u2 * x1 ) * idet; |
| 14495 | d = ( u1 * y2 - u2 * y1 ) * idet; |
| 14496 | |
| 14497 | e = x0 - a * u0 - c * v0; |
| 14498 | f = y0 - b * u0 - d * v0; |
| 14499 | |
| 14500 | _context.save(); |
| 14501 | _context.transform( a, b, c, d, e, f ); |
| 14502 | _context.clip(); |
| 14503 | _context.drawImage( image, 0, 0 ); |
| 14504 | _context.restore(); |
| 14505 | |
| 14506 | } |
| 14507 | |
| 14508 | function getGradientTexture( color1, color2, color3, color4 ) { |
| 14509 |
no outgoing calls
no test coverage detected