OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var EXIF_MARK_SOI = 0xffd8; // Start of image data. | 5 var EXIF_MARK_SOI = 0xffd8; // Start of image data. |
6 var EXIF_MARK_SOS = 0xffda; // Start of "stream" (the actual image data). | 6 var EXIF_MARK_SOS = 0xffda; // Start of "stream" (the actual image data). |
7 var EXIF_MARK_SOF = 0xffc0; // Start of "frame" | 7 var EXIF_MARK_SOF = 0xffc0; // Start of "frame" |
8 var EXIF_MARK_EXIF = 0xffe1; // Start of exif block. | 8 var EXIF_MARK_EXIF = 0xffe1; // Start of exif block. |
9 | 9 |
10 var EXIF_ALIGN_LITTLE = 0x4949; // Indicates little endian exif data. | 10 var EXIF_ALIGN_LITTLE = 0x4949; // Indicates little endian exif data. |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 //TODO(JSDOC) | 346 //TODO(JSDOC) |
347 ExifParser.SCALEY = [1, 1, -1, -1, -1, 1, 1, -1]; | 347 ExifParser.SCALEY = [1, 1, -1, -1, -1, 1, 1, -1]; |
348 | 348 |
349 //TODO(JSDOC) | 349 //TODO(JSDOC) |
350 ExifParser.ROTATE90 = [0, 0, 0, 0, 1, 1, 1, 1]; | 350 ExifParser.ROTATE90 = [0, 0, 0, 0, 1, 1, 1, 1]; |
351 | 351 |
352 /** | 352 /** |
353 * Transform exif-encoded orientation into a set of parameters compatible with | 353 * Transform exif-encoded orientation into a set of parameters compatible with |
354 * CSS and canvas transforms (scaleX, scaleY, rotation). | 354 * CSS and canvas transforms (scaleX, scaleY, rotation). |
355 * | 355 * |
356 * @param {Object} ifd exif property dictionary (image or thumbnail) | 356 * @param {Object} ifd exif property dictionary (image or thumbnail). |
357 * @return {Object} //TODO(JSDOC) | 357 * @return {Object} //TODO(JSDOC). |
358 */ | 358 */ |
359 ExifParser.prototype.parseOrientation = function(ifd) { | 359 ExifParser.prototype.parseOrientation = function(ifd) { |
360 if (ifd[EXIF_TAG_ORIENTATION]) { | 360 if (ifd[EXIF_TAG_ORIENTATION]) { |
361 var index = (ifd[EXIF_TAG_ORIENTATION].value || 1) - 1; | 361 var index = (ifd[EXIF_TAG_ORIENTATION].value || 1) - 1; |
362 return { | 362 return { |
363 scaleX: ExifParser.SCALEX[index], | 363 scaleX: ExifParser.SCALEX[index], |
364 scaleY: ExifParser.SCALEY[index], | 364 scaleY: ExifParser.SCALEY[index], |
365 rotate90: ExifParser.ROTATE90[index] | 365 rotate90: ExifParser.ROTATE90[index] |
366 }; | 366 }; |
367 } | 367 } |
368 return null; | 368 return null; |
369 }; | 369 }; |
370 | 370 |
371 MetadataDispatcher.registerParserClass(ExifParser); | 371 MetadataDispatcher.registerParserClass(ExifParser); |
OLD | NEW |