MCPcopy Index your code
hub / github.com/blueimp/JavaScript-Load-Image / requiresRot180

Function requiresRot180

js/load-image-orientation.js:160–180  ·  view source on GitHub ↗

* Determines orientation combinations that require a rotation by 180°. * * The following is a list of combinations that return true: * * 2 (flip) => 5 (rot90,flip), 7 (rot90,flip), 6 (rot90), 8 (rot90) * 4 (flip) => 5 (rot90,flip), 7 (rot90,flip), 6 (rot90), 8 (rot90) * * 5 (rot

(orientation, autoOrientation)

Source from the content-addressed store, hash-verified

158 * @returns {boolean} Returns true if rotation by 180° is required
159 */
160 function requiresRot180(orientation, autoOrientation) {
161 if (autoOrientation > 1 && autoOrientation < 9) {
162 switch (orientation) {
163 case 2:
164 case 4:
165 return autoOrientation > 4
166 case 5:
167 case 7:
168 return autoOrientation % 2 === 0
169 case 6:
170 case 8:
171 return (
172 autoOrientation === 2 ||
173 autoOrientation === 4 ||
174 autoOrientation === 5 ||
175 autoOrientation === 7
176 )
177 }
178 }
179 return false
180 }
181
182 // Determines if the target image should be a canvas element:
183 loadImage.requiresCanvas = function (options) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected