(data, isReversed)
| 195 | } |
| 196 | |
| 197 | function getRotatedSizes(data, isReversed) { |
| 198 | var deg = abs(data.degree) % 180; |
| 199 | var arc = (deg > 90 ? (180 - deg) : deg) * Math.PI / 180; |
| 200 | var sinArc = sin(arc); |
| 201 | var cosArc = cos(arc); |
| 202 | var width = data.width; |
| 203 | var height = data.height; |
| 204 | var aspectRatio = data.aspectRatio; |
| 205 | var newWidth; |
| 206 | var newHeight; |
| 207 | |
| 208 | if (!isReversed) { |
| 209 | newWidth = width * cosArc + height * sinArc; |
| 210 | newHeight = width * sinArc + height * cosArc; |
| 211 | } else { |
| 212 | newWidth = width / (cosArc + sinArc / aspectRatio); |
| 213 | newHeight = newWidth / aspectRatio; |
| 214 | } |
| 215 | |
| 216 | return { |
| 217 | width: newWidth, |
| 218 | height: newHeight |
| 219 | }; |
| 220 | } |
| 221 | |
| 222 | function getSourceCanvas(image, data) { |
| 223 | var canvas = $('<canvas>')[0]; |
no test coverage detected