Changeset View
Changeset View
Standalone View
Standalone View
src/script/data/libraries/emmet/lib.js
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 5425 Lines • ▼ Show 20 Line(s) | 5346 | return { | |||
---|---|---|---|---|---|
5426 | 5426 | | |||
5427 | /** | 5427 | /** | ||
5428 | * Gets image size from image byte stream. | 5428 | * Gets image size from image byte stream. | ||
5429 | * @author http://romeda.org/rePublish/ | 5429 | * @author http://romeda.org/rePublish/ | ||
5430 | * @param {String} stream Image byte stream (use <code>IEmmetFile.read()</code>) | 5430 | * @param {String} stream Image byte stream (use <code>IEmmetFile.read()</code>) | ||
5431 | * @return {Object} Object with <code>width</code> and <code>height</code> properties | 5431 | * @return {Object} Object with <code>width</code> and <code>height</code> properties | ||
5432 | */ | 5432 | */ | ||
5433 | getImageSize: function(stream) { | 5433 | getImageSize: function(stream) { | ||
5434 | var pngMagicNum = "\\211PNG\r\n\\032\n", | 5434 | var pngMagicNum = "\x89PNG\r\n\x1A\n", | ||
5435 | jpgMagicNum = "\\377\\330", | 5435 | jpgMagicNum = "\xFF\xD8", | ||
5436 | gifMagicNum = "GIF8", | 5436 | gifMagicNum = "GIF8", | ||
5437 | pos = 0, | 5437 | pos = 0, | ||
5438 | nextByte = function() { | 5438 | nextByte = function() { | ||
5439 | return stream.charCodeAt(pos++); | 5439 | return stream.charCodeAt(pos++); | ||
5440 | }; | 5440 | }; | ||
5441 | 5441 | | |||
5442 | if (stream.substr(0, 8) === pngMagicNum) { | 5442 | if (stream.substr(0, 8) === pngMagicNum) { | ||
5443 | // PNG. Easy peasy. | 5443 | // PNG. Easy peasy. | ||
▲ Show 20 Lines • Show All 8319 Lines • Show Last 20 Lines |