( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, image )
| 16311 | } |
| 16312 | |
| 16313 | function clipImage( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, image ) { |
| 16314 | |
| 16315 | // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 |
| 16316 | |
| 16317 | var a, b, c, d, e, f, det, idet, |
| 16318 | width = image.width - 1, |
| 16319 | height = image.height - 1; |
| 16320 | |
| 16321 | u0 *= width; v0 *= height; |
| 16322 | u1 *= width; v1 *= height; |
| 16323 | u2 *= width; v2 *= height; |
| 16324 | |
| 16325 | x1 -= x0; y1 -= y0; |
| 16326 | x2 -= x0; y2 -= y0; |
| 16327 | |
| 16328 | u1 -= u0; v1 -= v0; |
| 16329 | u2 -= u0; v2 -= v0; |
| 16330 | |
| 16331 | det = u1 * v2 - u2 * v1; |
| 16332 | |
| 16333 | idet = 1 / det; |
| 16334 | |
| 16335 | a = ( v2 * x1 - v1 * x2 ) * idet; |
| 16336 | b = ( v2 * y1 - v1 * y2 ) * idet; |
| 16337 | c = ( u1 * x2 - u2 * x1 ) * idet; |
| 16338 | d = ( u1 * y2 - u2 * y1 ) * idet; |
| 16339 | |
| 16340 | e = x0 - a * u0 - c * v0; |
| 16341 | f = y0 - b * u0 - d * v0; |
| 16342 | |
| 16343 | _context.save(); |
| 16344 | _context.transform( a, b, c, d, e, f ); |
| 16345 | _context.clip(); |
| 16346 | _context.drawImage( image, 0, 0 ); |
| 16347 | _context.restore(); |
| 16348 | |
| 16349 | } |
| 16350 | |
| 16351 | function getGradientTexture( color1, color2, color3, color4 ) { |
| 16352 |
no outgoing calls
no test coverage detected