@breakside/jskit 2025.43.0 → 2026.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Frameworks/DOM.jsframework/Info.json +2 -2
- package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
- package/Frameworks/FontKit.jsframework/Info.json +2 -2
- package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/Info.json +2 -2
- package/Frameworks/Foundation.jsframework/JS/JSImage.js +108 -0
- package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/sources.json +1 -0
- package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
- package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
- package/Info.json +2 -2
- package/Node/io.breakside.jskit-bundle.js +2 -2
- package/Root/Frameworks/APIKit/Info.yaml +1 -1
- package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/AuthKit/Info.yaml +1 -1
- package/Root/Frameworks/CSSOM/Info.yaml +1 -1
- package/Root/Frameworks/ChartKit/Info.yaml +1 -1
- package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
- package/Root/Frameworks/DBKit/Info.yaml +1 -1
- package/Root/Frameworks/DOM/Info.yaml +1 -1
- package/Root/Frameworks/Dispatch/Info.yaml +1 -1
- package/Root/Frameworks/FontKit/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/JSImage.js +108 -0
- package/Root/Frameworks/ImageKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
- package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
- package/Root/Frameworks/PDFKit/Info.yaml +1 -1
- package/Root/Frameworks/QRKit/Info.yaml +1 -1
- package/Root/Frameworks/SearchKit/Info.yaml +1 -1
- package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/TestKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +5 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.DOM",
|
|
4
|
-
"JSBundleVersion": "
|
|
4
|
+
"JSBundleVersion": "2026.1.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "DOM+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "2345355a065b38aeedad172cfe7c337d1d3f297b"
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.DOM'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.DOM",
|
|
6
|
-
"JSBundleVersion": "
|
|
6
|
+
"JSBundleVersion": "2026.1.0",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.DOM'] = {
|
|
|
11
11
|
"node": "DOM+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "2345355a065b38aeedad172cfe7c337d1d3f297b"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [],
|
|
17
17
|
"ResourceLookup": {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.FontKit",
|
|
4
|
-
"JSBundleVersion": "
|
|
4
|
+
"JSBundleVersion": "2026.1.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
8
8
|
"html": "FontKit+HTML.js"
|
|
9
9
|
},
|
|
10
10
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
11
|
-
"GitRevision": "
|
|
11
|
+
"GitRevision": "2345355a065b38aeedad172cfe7c337d1d3f297b"
|
|
12
12
|
}
|
|
@@ -3,14 +3,14 @@ JSBundle.bundles['io.breakside.JSKit.FontKit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.FontKit",
|
|
6
|
-
"JSBundleVersion": "
|
|
6
|
+
"JSBundleVersion": "2026.1.0",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
10
10
|
"html": "FontKit+HTML.js"
|
|
11
11
|
},
|
|
12
12
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
13
|
-
"GitRevision": "
|
|
13
|
+
"GitRevision": "2345355a065b38aeedad172cfe7c337d1d3f297b"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [],
|
|
16
16
|
"ResourceLookup": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.Foundation",
|
|
4
|
-
"JSBundleVersion": "
|
|
4
|
+
"JSBundleVersion": "2026.1.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "Foundation+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "2345355a065b38aeedad172cfe7c337d1d3f297b"
|
|
13
13
|
}
|
|
@@ -343,6 +343,9 @@ _JSDataImage.sizeFromJPEGData = function(data){
|
|
|
343
343
|
var l = data.length;
|
|
344
344
|
var blockLength;
|
|
345
345
|
var blockdata;
|
|
346
|
+
var exifData;
|
|
347
|
+
var exif = null;
|
|
348
|
+
var flipWidthHeight = false;
|
|
346
349
|
while (i < l){
|
|
347
350
|
b = data[i++];
|
|
348
351
|
if (b != 0xFF){
|
|
@@ -369,10 +372,21 @@ _JSDataImage.sizeFromJPEGData = function(data){
|
|
|
369
372
|
// TODO: Error, not enough room for block data
|
|
370
373
|
return JSSize.Zero;
|
|
371
374
|
}
|
|
375
|
+
// E1 is Exif Data
|
|
376
|
+
if (b === 0xE1){
|
|
377
|
+
exifData = data.subdataInRange(JSRange(i + 2, blockLength - 2));
|
|
378
|
+
exif = JSImageExif.initWithData(exifData);
|
|
379
|
+
if (exif !== null){
|
|
380
|
+
flipWidthHeight = exif.orientationFlipsWidthHeight;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
372
383
|
// C0-CF are start of frame blocks, expect for C4 and CC
|
|
373
384
|
// start of frame blocks have image sizes
|
|
374
385
|
if (b >= 0xC0 && b <= 0xCF && b != 0xC4 && b != 0xCC){
|
|
375
386
|
if (blockLength >= 7){
|
|
387
|
+
if (flipWidthHeight){
|
|
388
|
+
return JSSize(dataView.getUint16(i + 3), dataView.getUint16(i + 5));
|
|
389
|
+
}
|
|
376
390
|
return JSSize(dataView.getUint16(i + 5), dataView.getUint16(i + 3));
|
|
377
391
|
}
|
|
378
392
|
return JSSize.Zero;
|
|
@@ -536,4 +550,98 @@ JSImage.RenderMode = {
|
|
|
536
550
|
template: 2
|
|
537
551
|
};
|
|
538
552
|
|
|
553
|
+
JSClass("JSImageExif", JSObject, {
|
|
554
|
+
|
|
555
|
+
data: null,
|
|
556
|
+
dataView: null,
|
|
557
|
+
|
|
558
|
+
initWithData: function(data){
|
|
559
|
+
if (data.length < 8){
|
|
560
|
+
return null;
|
|
561
|
+
}
|
|
562
|
+
if (data[0] === 0x45 && data[1] === 0x78 && data[2] === 0x69 && data[3] === 0x66 && data[4] === 0x00 && data[5] === 0x00){
|
|
563
|
+
data = data.subdataInRange(JSRange(6, data.length - 6));
|
|
564
|
+
}
|
|
565
|
+
this.data = data;
|
|
566
|
+
this.dataView = this.data.dataView();
|
|
567
|
+
this.littleEndian = this.data[0] === 0x49 && this.data[1] === 0x49;
|
|
568
|
+
this.magicNumber = this.dataView.getUint16(2, this.littleEndian);
|
|
569
|
+
if (this.magicNumber !== 42){
|
|
570
|
+
return null;
|
|
571
|
+
}
|
|
572
|
+
this.firstDirectoryOffset = this.dataView.getUint32(4, this.littleEndian);
|
|
573
|
+
if (this.firstDirectoryOffset + 2 > this.data.length){
|
|
574
|
+
return null;
|
|
575
|
+
}
|
|
576
|
+
this.numberOfEntries = this.dataView.getUint16(this.firstDirectoryOffset, this.littleEndian);
|
|
577
|
+
if (this.firstDirectoryOffset + this.numberOfEntries * 12 + 4 > this.data.length){
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
|
|
582
|
+
valueForTag: function(tag, defaultValue){
|
|
583
|
+
var min = 0;
|
|
584
|
+
var max = this.numberOfEntries;
|
|
585
|
+
var mid;
|
|
586
|
+
var offset;
|
|
587
|
+
var result;
|
|
588
|
+
var type;
|
|
589
|
+
var count;
|
|
590
|
+
while (min < max){
|
|
591
|
+
mid = Math.floor(min + (max - min) / 2);
|
|
592
|
+
offset = this.firstDirectoryOffset + 2 + 12 * mid;
|
|
593
|
+
result = tag - this.dataView.getUint16(offset, this.littleEndian);
|
|
594
|
+
if (result < 0){
|
|
595
|
+
max = mid;
|
|
596
|
+
}else if (result > 0){
|
|
597
|
+
min = mid + 1;
|
|
598
|
+
}else{
|
|
599
|
+
min = max = mid;
|
|
600
|
+
type = this.dataView.getUint16(offset + 2, this.littleEndian);
|
|
601
|
+
count = this.dataView.getUint32(offset + 4, this.littleEndian);
|
|
602
|
+
if (count === 1){
|
|
603
|
+
if (type === JSImageExif.Type.byte){
|
|
604
|
+
return this.data[offset + 8];
|
|
605
|
+
}
|
|
606
|
+
if (type === JSImageExif.Type.short){
|
|
607
|
+
return this.dataView.getUint16(offset + 8, this.littleEndian);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
return defaultValue;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return defaultValue;
|
|
614
|
+
},
|
|
615
|
+
|
|
616
|
+
orientation: JSLazyInitProperty(function(){
|
|
617
|
+
return this.valueForTag(JSImageExif.Tag.orientation, 1);
|
|
618
|
+
}),
|
|
619
|
+
|
|
620
|
+
orientationFlipsWidthHeight: JSLazyInitProperty(function(){
|
|
621
|
+
var orientation = this.orientation;
|
|
622
|
+
if (orientation === 5 || orientation === 6 || orientation === 7 || orientation === 8){
|
|
623
|
+
return true;
|
|
624
|
+
}
|
|
625
|
+
return false;
|
|
626
|
+
}),
|
|
627
|
+
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
JSImageExif.Type = {
|
|
631
|
+
byte: 1,
|
|
632
|
+
ascii: 2,
|
|
633
|
+
short: 3,
|
|
634
|
+
long: 4,
|
|
635
|
+
rational: 5,
|
|
636
|
+
sbyte: 6,
|
|
637
|
+
undefined: 7,
|
|
638
|
+
sshort: 8,
|
|
639
|
+
slong: 9,
|
|
640
|
+
srational: 10
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
JSImageExif.Tag = {
|
|
644
|
+
orientation: 274,
|
|
645
|
+
};
|
|
646
|
+
|
|
539
647
|
})();
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.Foundation'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.Foundation",
|
|
6
|
-
"JSBundleVersion": "
|
|
6
|
+
"JSBundleVersion": "2026.1.0",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.Foundation'] = {
|
|
|
11
11
|
"node": "Foundation+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "2345355a065b38aeedad172cfe7c337d1d3f297b"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [
|
|
17
17
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.SecurityKit",
|
|
4
|
-
"JSBundleVersion": "
|
|
4
|
+
"JSBundleVersion": "2026.1.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "SecurityKit+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "2345355a065b38aeedad172cfe7c337d1d3f297b"
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.SecurityKit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.SecurityKit",
|
|
6
|
-
"JSBundleVersion": "
|
|
6
|
+
"JSBundleVersion": "2026.1.0",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.SecurityKit'] = {
|
|
|
11
11
|
"node": "SecurityKit+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "2345355a065b38aeedad172cfe7c337d1d3f297b"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [],
|
|
17
17
|
"ResourceLookup": {
|
package/Info.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "node",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.jskit",
|
|
4
|
-
"JSBundleVersion": "
|
|
4
|
+
"JSBundleVersion": "2026.1.0",
|
|
5
5
|
"JSExecutableName": "jskit",
|
|
6
6
|
"NPMOrganization": "breakside",
|
|
7
7
|
"JSResources": [
|
|
8
8
|
"Tests/HTMLTestRunner.js",
|
|
9
9
|
"Tests/NodeTestRunner.js"
|
|
10
10
|
],
|
|
11
|
-
"GitRevision": "
|
|
11
|
+
"GitRevision": "2345355a065b38aeedad172cfe7c337d1d3f297b"
|
|
12
12
|
}
|
|
@@ -3,14 +3,14 @@ JSBundle.bundles['io.breakside.jskit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "node",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.jskit",
|
|
6
|
-
"JSBundleVersion": "
|
|
6
|
+
"JSBundleVersion": "2026.1.0",
|
|
7
7
|
"JSExecutableName": "jskit",
|
|
8
8
|
"NPMOrganization": "breakside",
|
|
9
9
|
"JSResources": [
|
|
10
10
|
"Tests/HTMLTestRunner.js",
|
|
11
11
|
"Tests/NodeTestRunner.js"
|
|
12
12
|
],
|
|
13
|
-
"GitRevision": "
|
|
13
|
+
"GitRevision": "2345355a065b38aeedad172cfe7c337d1d3f297b"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [
|
|
16
16
|
{
|
|
@@ -343,6 +343,9 @@ _JSDataImage.sizeFromJPEGData = function(data){
|
|
|
343
343
|
var l = data.length;
|
|
344
344
|
var blockLength;
|
|
345
345
|
var blockdata;
|
|
346
|
+
var exifData;
|
|
347
|
+
var exif = null;
|
|
348
|
+
var flipWidthHeight = false;
|
|
346
349
|
while (i < l){
|
|
347
350
|
b = data[i++];
|
|
348
351
|
if (b != 0xFF){
|
|
@@ -369,10 +372,21 @@ _JSDataImage.sizeFromJPEGData = function(data){
|
|
|
369
372
|
// TODO: Error, not enough room for block data
|
|
370
373
|
return JSSize.Zero;
|
|
371
374
|
}
|
|
375
|
+
// E1 is Exif Data
|
|
376
|
+
if (b === 0xE1){
|
|
377
|
+
exifData = data.subdataInRange(JSRange(i + 2, blockLength - 2));
|
|
378
|
+
exif = JSImageExif.initWithData(exifData);
|
|
379
|
+
if (exif !== null){
|
|
380
|
+
flipWidthHeight = exif.orientationFlipsWidthHeight;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
372
383
|
// C0-CF are start of frame blocks, expect for C4 and CC
|
|
373
384
|
// start of frame blocks have image sizes
|
|
374
385
|
if (b >= 0xC0 && b <= 0xCF && b != 0xC4 && b != 0xCC){
|
|
375
386
|
if (blockLength >= 7){
|
|
387
|
+
if (flipWidthHeight){
|
|
388
|
+
return JSSize(dataView.getUint16(i + 3), dataView.getUint16(i + 5));
|
|
389
|
+
}
|
|
376
390
|
return JSSize(dataView.getUint16(i + 5), dataView.getUint16(i + 3));
|
|
377
391
|
}
|
|
378
392
|
return JSSize.Zero;
|
|
@@ -536,4 +550,98 @@ JSImage.RenderMode = {
|
|
|
536
550
|
template: 2
|
|
537
551
|
};
|
|
538
552
|
|
|
553
|
+
JSClass("JSImageExif", JSObject, {
|
|
554
|
+
|
|
555
|
+
data: null,
|
|
556
|
+
dataView: null,
|
|
557
|
+
|
|
558
|
+
initWithData: function(data){
|
|
559
|
+
if (data.length < 8){
|
|
560
|
+
return null;
|
|
561
|
+
}
|
|
562
|
+
if (data[0] === 0x45 && data[1] === 0x78 && data[2] === 0x69 && data[3] === 0x66 && data[4] === 0x00 && data[5] === 0x00){
|
|
563
|
+
data = data.subdataInRange(JSRange(6, data.length - 6));
|
|
564
|
+
}
|
|
565
|
+
this.data = data;
|
|
566
|
+
this.dataView = this.data.dataView();
|
|
567
|
+
this.littleEndian = this.data[0] === 0x49 && this.data[1] === 0x49;
|
|
568
|
+
this.magicNumber = this.dataView.getUint16(2, this.littleEndian);
|
|
569
|
+
if (this.magicNumber !== 42){
|
|
570
|
+
return null;
|
|
571
|
+
}
|
|
572
|
+
this.firstDirectoryOffset = this.dataView.getUint32(4, this.littleEndian);
|
|
573
|
+
if (this.firstDirectoryOffset + 2 > this.data.length){
|
|
574
|
+
return null;
|
|
575
|
+
}
|
|
576
|
+
this.numberOfEntries = this.dataView.getUint16(this.firstDirectoryOffset, this.littleEndian);
|
|
577
|
+
if (this.firstDirectoryOffset + this.numberOfEntries * 12 + 4 > this.data.length){
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
|
|
582
|
+
valueForTag: function(tag, defaultValue){
|
|
583
|
+
var min = 0;
|
|
584
|
+
var max = this.numberOfEntries;
|
|
585
|
+
var mid;
|
|
586
|
+
var offset;
|
|
587
|
+
var result;
|
|
588
|
+
var type;
|
|
589
|
+
var count;
|
|
590
|
+
while (min < max){
|
|
591
|
+
mid = Math.floor(min + (max - min) / 2);
|
|
592
|
+
offset = this.firstDirectoryOffset + 2 + 12 * mid;
|
|
593
|
+
result = tag - this.dataView.getUint16(offset, this.littleEndian);
|
|
594
|
+
if (result < 0){
|
|
595
|
+
max = mid;
|
|
596
|
+
}else if (result > 0){
|
|
597
|
+
min = mid + 1;
|
|
598
|
+
}else{
|
|
599
|
+
min = max = mid;
|
|
600
|
+
type = this.dataView.getUint16(offset + 2, this.littleEndian);
|
|
601
|
+
count = this.dataView.getUint32(offset + 4, this.littleEndian);
|
|
602
|
+
if (count === 1){
|
|
603
|
+
if (type === JSImageExif.Type.byte){
|
|
604
|
+
return this.data[offset + 8];
|
|
605
|
+
}
|
|
606
|
+
if (type === JSImageExif.Type.short){
|
|
607
|
+
return this.dataView.getUint16(offset + 8, this.littleEndian);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
return defaultValue;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return defaultValue;
|
|
614
|
+
},
|
|
615
|
+
|
|
616
|
+
orientation: JSLazyInitProperty(function(){
|
|
617
|
+
return this.valueForTag(JSImageExif.Tag.orientation, 1);
|
|
618
|
+
}),
|
|
619
|
+
|
|
620
|
+
orientationFlipsWidthHeight: JSLazyInitProperty(function(){
|
|
621
|
+
var orientation = this.orientation;
|
|
622
|
+
if (orientation === 5 || orientation === 6 || orientation === 7 || orientation === 8){
|
|
623
|
+
return true;
|
|
624
|
+
}
|
|
625
|
+
return false;
|
|
626
|
+
}),
|
|
627
|
+
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
JSImageExif.Type = {
|
|
631
|
+
byte: 1,
|
|
632
|
+
ascii: 2,
|
|
633
|
+
short: 3,
|
|
634
|
+
long: 4,
|
|
635
|
+
rational: 5,
|
|
636
|
+
sbyte: 6,
|
|
637
|
+
undefined: 7,
|
|
638
|
+
sshort: 8,
|
|
639
|
+
slong: 9,
|
|
640
|
+
srational: 10
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
JSImageExif.Tag = {
|
|
644
|
+
orientation: 274,
|
|
645
|
+
};
|
|
646
|
+
|
|
539
647
|
})();
|
package/package.json
CHANGED
|
@@ -4,12 +4,15 @@
|
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://github.com/breakside/JSKit/issues"
|
|
6
6
|
},
|
|
7
|
-
"repository":
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/breakside/JSKit.git"
|
|
10
|
+
},
|
|
8
11
|
"engines": {
|
|
9
12
|
"node": ">=10.10.0"
|
|
10
13
|
},
|
|
11
14
|
"name": "@breakside/jskit",
|
|
12
|
-
"version": "
|
|
15
|
+
"version": "2026.1.0",
|
|
13
16
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
14
17
|
"files": [
|
|
15
18
|
"*"
|