( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, image )
| 9981 | } |
| 9982 | |
| 9983 | function clipImage( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, image ) { |
| 9984 | |
| 9985 | // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 |
| 9986 | |
| 9987 | var a, b, c, d, e, f, det, idet, |
| 9988 | width = image.width - 1, |
| 9989 | height = image.height - 1; |
| 9990 | |
| 9991 | u0 *= width; v0 *= height; |
| 9992 | u1 *= width; v1 *= height; |
| 9993 | u2 *= width; v2 *= height; |
| 9994 | |
| 9995 | x1 -= x0; y1 -= y0; |
| 9996 | x2 -= x0; y2 -= y0; |
| 9997 | |
| 9998 | u1 -= u0; v1 -= v0; |
| 9999 | u2 -= u0; v2 -= v0; |
| 10000 | |
| 10001 | det = u1 * v2 - u2 * v1; |
| 10002 | |
| 10003 | idet = 1 / det; |
| 10004 | |
| 10005 | a = ( v2 * x1 - v1 * x2 ) * idet; |
| 10006 | b = ( v2 * y1 - v1 * y2 ) * idet; |
| 10007 | c = ( u1 * x2 - u2 * x1 ) * idet; |
| 10008 | d = ( u1 * y2 - u2 * y1 ) * idet; |
| 10009 | |
| 10010 | e = x0 - a * u0 - c * v0; |
| 10011 | f = y0 - b * u0 - d * v0; |
| 10012 | |
| 10013 | _context.save(); |
| 10014 | _context.transform( a, b, c, d, e, f ); |
| 10015 | _context.clip(); |
| 10016 | _context.drawImage( image, 0, 0 ); |
| 10017 | _context.restore(); |
| 10018 | |
| 10019 | } |
| 10020 | |
| 10021 | function getGradientTexture( color1, color2, color3, color4 ) { |
| 10022 |
no outgoing calls
no test coverage detected