@hussmartinez/image-sdk 0.6.0 → 0.7.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.
@@ -0,0 +1,1114 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json",
4
+ "title": "hm-image-plan, version 4",
5
+ "description": "An image-sdk plan: one source, its crop, orientation, develop adjustments and filter, the layers over it, the redactions over those, the animation, which from this version may list frames of the source (docs/adr/0011), the export's size, and the metadata fields the user keeps (docs/formats/hm-image-plan.md, sdk-core ADR 0045). Positions are whole pixels of the oriented source, which is also the scene that layers and redactions are placed in. Everything but the animation applies to every frame. Beyond this schema, readers check that the base's source and every image layer's are ones the document lists, that their crops fit inside them, that a shape has a fill or a stroke, that a drawing's runs hold an x and a y for each point and stay within the scene's coordinates from its origin, that an arrow's ends differ, that no two items share a key, among layers, redactions and frames, that layers and redactions together are at most 1,024, that each frame of an animation is one the base's source has, and that a source with one frame has no animation.",
6
+ "type": "object",
7
+ "required": [
8
+ "format",
9
+ "version",
10
+ "sources",
11
+ "base",
12
+ "layers",
13
+ "redactions",
14
+ "animation",
15
+ "output",
16
+ "metadata"
17
+ ],
18
+ "additionalProperties": false,
19
+ "properties": {
20
+ "format": {
21
+ "const": "hm-image-plan"
22
+ },
23
+ "version": {
24
+ "const": 4
25
+ },
26
+ "sources": {
27
+ "description": "The sources by id. The base names one of them.",
28
+ "type": "object",
29
+ "propertyNames": {
30
+ "minLength": 1
31
+ },
32
+ "additionalProperties": {
33
+ "$ref": "#/$defs/source"
34
+ }
35
+ },
36
+ "base": {
37
+ "$ref": "#/$defs/base"
38
+ },
39
+ "layers": {
40
+ "description": "The layers over the base, bottom to top.",
41
+ "type": "array",
42
+ "maxItems": 1024,
43
+ "items": {
44
+ "$ref": "#/$defs/layer"
45
+ }
46
+ },
47
+ "redactions": {
48
+ "description": "The redactions, applied over everything else, in order.",
49
+ "type": "array",
50
+ "maxItems": 1024,
51
+ "items": {
52
+ "$ref": "#/$defs/redaction"
53
+ }
54
+ },
55
+ "animation": {
56
+ "description": "The animation, or null for a still.",
57
+ "oneOf": [
58
+ {
59
+ "type": "null"
60
+ },
61
+ {
62
+ "$ref": "#/$defs/animation"
63
+ }
64
+ ]
65
+ },
66
+ "output": {
67
+ "$ref": "#/$defs/output"
68
+ },
69
+ "metadata": {
70
+ "$ref": "#/$defs/metadata"
71
+ }
72
+ },
73
+ "$defs": {
74
+ "pixels": {
75
+ "description": "A whole number of pixels from 0.",
76
+ "type": "integer",
77
+ "minimum": 0,
78
+ "maximum": 9007199254740991
79
+ },
80
+ "size": {
81
+ "description": "A whole number of pixels from 1.",
82
+ "type": "integer",
83
+ "minimum": 1,
84
+ "maximum": 9007199254740991
85
+ },
86
+ "asset": {
87
+ "description": "A content-addressed reference to a source's bytes. Documents never inline them.",
88
+ "type": "object",
89
+ "required": ["asset", "mediaType", "size"],
90
+ "additionalProperties": false,
91
+ "properties": {
92
+ "asset": {
93
+ "description": "sha256: and the lowercase hex SHA-256 of the bytes.",
94
+ "type": "string",
95
+ "pattern": "^sha256:[0-9a-f]{64}$"
96
+ },
97
+ "mediaType": {
98
+ "description": "The bytes' media type, in lowercase.",
99
+ "type": "string",
100
+ "maxLength": 255,
101
+ "pattern": "^[a-z0-9][a-z0-9!#$&^_.+-]*/[a-z0-9][a-z0-9!#$&^_.+-]*$"
102
+ },
103
+ "size": {
104
+ "description": "The size of the bytes.",
105
+ "type": "integer",
106
+ "minimum": 0,
107
+ "maximum": 9007199254740991
108
+ }
109
+ }
110
+ },
111
+ "source": {
112
+ "description": "A source: its oriented size, after its EXIF orientation, which a crop must fit inside, and how many frames it has, 1 for a still.",
113
+ "type": "object",
114
+ "required": ["width", "height", "frames"],
115
+ "additionalProperties": false,
116
+ "properties": {
117
+ "width": {
118
+ "$ref": "#/$defs/size"
119
+ },
120
+ "height": {
121
+ "$ref": "#/$defs/size"
122
+ },
123
+ "frames": {
124
+ "$ref": "#/$defs/frameCount"
125
+ },
126
+ "asset": {
127
+ "$ref": "#/$defs/asset"
128
+ }
129
+ }
130
+ },
131
+ "crop": {
132
+ "description": "A rectangle in whole pixels of the oriented source.",
133
+ "type": "object",
134
+ "required": ["x", "y", "width", "height"],
135
+ "additionalProperties": false,
136
+ "properties": {
137
+ "x": {
138
+ "$ref": "#/$defs/pixels"
139
+ },
140
+ "y": {
141
+ "$ref": "#/$defs/pixels"
142
+ },
143
+ "width": {
144
+ "$ref": "#/$defs/size"
145
+ },
146
+ "height": {
147
+ "$ref": "#/$defs/size"
148
+ }
149
+ }
150
+ },
151
+ "orientation": {
152
+ "description": "The plan's rotation, then its flips.",
153
+ "type": "object",
154
+ "required": ["rotate", "flipX", "flipY"],
155
+ "additionalProperties": false,
156
+ "properties": {
157
+ "rotate": {
158
+ "description": "Clockwise, in degrees.",
159
+ "enum": [0, 90, 180, 270]
160
+ },
161
+ "flipX": {
162
+ "type": "boolean"
163
+ },
164
+ "flipY": {
165
+ "type": "boolean"
166
+ }
167
+ }
168
+ },
169
+ "level": {
170
+ "description": "A develop adjustment: a whole number from -100 to 100, where 0 is unchanged.",
171
+ "type": "integer",
172
+ "minimum": -100,
173
+ "maximum": 100
174
+ },
175
+ "develop": {
176
+ "description": "Every develop adjustment, in the order they're applied.",
177
+ "type": "object",
178
+ "required": [
179
+ "temperature",
180
+ "tint",
181
+ "exposure",
182
+ "highlights",
183
+ "shadows",
184
+ "contrast",
185
+ "saturation",
186
+ "vibrance"
187
+ ],
188
+ "additionalProperties": false,
189
+ "properties": {
190
+ "temperature": {
191
+ "$ref": "#/$defs/level"
192
+ },
193
+ "tint": {
194
+ "$ref": "#/$defs/level"
195
+ },
196
+ "exposure": {
197
+ "$ref": "#/$defs/level"
198
+ },
199
+ "highlights": {
200
+ "$ref": "#/$defs/level"
201
+ },
202
+ "shadows": {
203
+ "$ref": "#/$defs/level"
204
+ },
205
+ "contrast": {
206
+ "$ref": "#/$defs/level"
207
+ },
208
+ "saturation": {
209
+ "$ref": "#/$defs/level"
210
+ },
211
+ "vibrance": {
212
+ "$ref": "#/$defs/level"
213
+ }
214
+ }
215
+ },
216
+ "developValues": {
217
+ "description": "Some develop adjustments; the others keep their values.",
218
+ "type": "object",
219
+ "required": [],
220
+ "additionalProperties": false,
221
+ "properties": {
222
+ "temperature": {
223
+ "$ref": "#/$defs/level"
224
+ },
225
+ "tint": {
226
+ "$ref": "#/$defs/level"
227
+ },
228
+ "exposure": {
229
+ "$ref": "#/$defs/level"
230
+ },
231
+ "highlights": {
232
+ "$ref": "#/$defs/level"
233
+ },
234
+ "shadows": {
235
+ "$ref": "#/$defs/level"
236
+ },
237
+ "contrast": {
238
+ "$ref": "#/$defs/level"
239
+ },
240
+ "saturation": {
241
+ "$ref": "#/$defs/level"
242
+ },
243
+ "vibrance": {
244
+ "$ref": "#/$defs/level"
245
+ }
246
+ }
247
+ },
248
+ "filter": {
249
+ "description": "A filter preset and its strength, or null for none.",
250
+ "oneOf": [
251
+ {
252
+ "type": "null"
253
+ },
254
+ {
255
+ "type": "object",
256
+ "required": ["preset", "strength"],
257
+ "additionalProperties": false,
258
+ "properties": {
259
+ "preset": {
260
+ "enum": ["vivid", "warm", "cool", "fade", "mono", "noir", "sepia"]
261
+ },
262
+ "strength": {
263
+ "type": "integer",
264
+ "minimum": 0,
265
+ "maximum": 100
266
+ }
267
+ }
268
+ }
269
+ ]
270
+ },
271
+ "output": {
272
+ "description": "The export's size: the composition scaled by a factor up to 1, or fitted inside a box without enlarging it. The scale is copied, never computed, so it compares exactly.",
273
+ "oneOf": [
274
+ {
275
+ "type": "object",
276
+ "required": ["kind", "scale"],
277
+ "additionalProperties": false,
278
+ "properties": {
279
+ "kind": {
280
+ "const": "scale"
281
+ },
282
+ "scale": {
283
+ "type": "number",
284
+ "exclusiveMinimum": 0,
285
+ "maximum": 1
286
+ }
287
+ }
288
+ },
289
+ {
290
+ "type": "object",
291
+ "required": ["kind", "width", "height"],
292
+ "additionalProperties": false,
293
+ "properties": {
294
+ "kind": {
295
+ "const": "fit"
296
+ },
297
+ "width": {
298
+ "$ref": "#/$defs/size"
299
+ },
300
+ "height": {
301
+ "$ref": "#/$defs/size"
302
+ }
303
+ }
304
+ }
305
+ ]
306
+ },
307
+ "metadataValue": {
308
+ "description": "Text to keep, or empty to keep nothing. Its length is in Unicode code points, as maxLength counts it.",
309
+ "type": "string",
310
+ "maxLength": 2000
311
+ },
312
+ "metadataField": {
313
+ "enum": ["title", "description", "artist", "copyright"]
314
+ },
315
+ "metadata": {
316
+ "description": "The fields the user keeps on export. Never a location.",
317
+ "type": "object",
318
+ "required": ["title", "description", "artist", "copyright"],
319
+ "additionalProperties": false,
320
+ "properties": {
321
+ "title": {
322
+ "$ref": "#/$defs/metadataValue"
323
+ },
324
+ "description": {
325
+ "$ref": "#/$defs/metadataValue"
326
+ },
327
+ "artist": {
328
+ "$ref": "#/$defs/metadataValue"
329
+ },
330
+ "copyright": {
331
+ "$ref": "#/$defs/metadataValue"
332
+ }
333
+ }
334
+ },
335
+ "base": {
336
+ "description": "The image being edited.",
337
+ "type": "object",
338
+ "required": ["source", "crop", "orientation", "develop", "filter"],
339
+ "additionalProperties": false,
340
+ "properties": {
341
+ "source": {
342
+ "description": "The id of a source the document lists.",
343
+ "type": "string",
344
+ "minLength": 1
345
+ },
346
+ "crop": {
347
+ "oneOf": [
348
+ {
349
+ "type": "null"
350
+ },
351
+ {
352
+ "$ref": "#/$defs/crop"
353
+ }
354
+ ]
355
+ },
356
+ "orientation": {
357
+ "$ref": "#/$defs/orientation"
358
+ },
359
+ "develop": {
360
+ "$ref": "#/$defs/develop"
361
+ },
362
+ "filter": {
363
+ "$ref": "#/$defs/filter"
364
+ }
365
+ }
366
+ },
367
+ "key": {
368
+ "description": "An item's identity: any text of 1 to 64 Unicode code points, unique in the document, among its layers, redactions and frames.",
369
+ "type": "string",
370
+ "minLength": 1,
371
+ "maxLength": 64
372
+ },
373
+ "scenePosition": {
374
+ "description": "A position in whole pixels of the scene, which may be outside it.",
375
+ "type": "integer",
376
+ "minimum": -65536,
377
+ "maximum": 65536
378
+ },
379
+ "sceneLength": {
380
+ "description": "A length in whole pixels of the scene.",
381
+ "type": "integer",
382
+ "minimum": 1,
383
+ "maximum": 65536
384
+ },
385
+ "colour": {
386
+ "description": "A colour as #rrggbb, in lower case.",
387
+ "type": "string",
388
+ "pattern": "^#[0-9a-f]{6}$"
389
+ },
390
+ "redactionMode": {
391
+ "enum": ["solid", "pixelate"]
392
+ },
393
+ "redaction": {
394
+ "description": "A region an export doesn't show: a rectangle of the scene, filled with a colour or with coarse blocks.",
395
+ "oneOf": [
396
+ {
397
+ "type": "object",
398
+ "required": ["key", "mode", "x", "y", "width", "height", "colour"],
399
+ "additionalProperties": false,
400
+ "properties": {
401
+ "key": {
402
+ "$ref": "#/$defs/key"
403
+ },
404
+ "x": {
405
+ "$ref": "#/$defs/scenePosition"
406
+ },
407
+ "y": {
408
+ "$ref": "#/$defs/scenePosition"
409
+ },
410
+ "width": {
411
+ "$ref": "#/$defs/sceneLength"
412
+ },
413
+ "height": {
414
+ "$ref": "#/$defs/sceneLength"
415
+ },
416
+ "mode": {
417
+ "const": "solid"
418
+ },
419
+ "colour": {
420
+ "$ref": "#/$defs/colour"
421
+ }
422
+ }
423
+ },
424
+ {
425
+ "type": "object",
426
+ "required": ["key", "mode", "x", "y", "width", "height"],
427
+ "additionalProperties": false,
428
+ "properties": {
429
+ "key": {
430
+ "$ref": "#/$defs/key"
431
+ },
432
+ "x": {
433
+ "$ref": "#/$defs/scenePosition"
434
+ },
435
+ "y": {
436
+ "$ref": "#/$defs/scenePosition"
437
+ },
438
+ "width": {
439
+ "$ref": "#/$defs/sceneLength"
440
+ },
441
+ "height": {
442
+ "$ref": "#/$defs/sceneLength"
443
+ },
444
+ "mode": {
445
+ "const": "pixelate"
446
+ }
447
+ }
448
+ }
449
+ ]
450
+ },
451
+ "redactionProps": {
452
+ "description": "Some of a redaction's fields. Beyond this schema, the reducer checks the result: setting mode to pixelate drops the colour, so a colour can't be set on a pixelated redaction, and setting mode to solid needs a colour.",
453
+ "type": "object",
454
+ "additionalProperties": false,
455
+ "properties": {
456
+ "mode": {
457
+ "$ref": "#/$defs/redactionMode"
458
+ },
459
+ "x": {
460
+ "$ref": "#/$defs/scenePosition"
461
+ },
462
+ "y": {
463
+ "$ref": "#/$defs/scenePosition"
464
+ },
465
+ "width": {
466
+ "$ref": "#/$defs/sceneLength"
467
+ },
468
+ "height": {
469
+ "$ref": "#/$defs/sceneLength"
470
+ },
471
+ "colour": {
472
+ "$ref": "#/$defs/colour"
473
+ }
474
+ }
475
+ },
476
+ "keys": {
477
+ "description": "At least one key, none repeated.",
478
+ "type": "array",
479
+ "minItems": 1,
480
+ "uniqueItems": true,
481
+ "items": {
482
+ "$ref": "#/$defs/key"
483
+ }
484
+ },
485
+ "text": {
486
+ "description": "Text with no control character other than a line feed, and no bidirectional embedding, override or isolate control.",
487
+ "type": "string",
488
+ "pattern": "^[^\\u0000-\\u0009\\u000B-\\u001F\\u007F\\u202A-\\u202E\\u2066-\\u2069]*$"
489
+ },
490
+ "opacity": {
491
+ "type": "integer",
492
+ "minimum": 0,
493
+ "maximum": 100
494
+ },
495
+ "rotation": {
496
+ "description": "Tenths of a degree, clockwise about the box's centre.",
497
+ "type": "integer",
498
+ "minimum": 0,
499
+ "maximum": 3599
500
+ },
501
+ "flipX": {
502
+ "description": "Whether the layer is mirrored left to right, about its box's own vertical axis, before it's turned.",
503
+ "type": "boolean"
504
+ },
505
+ "font": {
506
+ "enum": ["sans-serif", "serif", "monospace"]
507
+ },
508
+ "align": {
509
+ "enum": ["start", "center", "end"]
510
+ },
511
+ "shape": {
512
+ "enum": ["rectangle", "ellipse"]
513
+ },
514
+ "stroke": {
515
+ "type": "object",
516
+ "required": ["colour", "width"],
517
+ "additionalProperties": false,
518
+ "properties": {
519
+ "colour": {
520
+ "$ref": "#/$defs/colour"
521
+ },
522
+ "width": {
523
+ "type": "integer",
524
+ "minimum": 1,
525
+ "maximum": 1024
526
+ }
527
+ }
528
+ },
529
+ "layer": {
530
+ "description": "A layer over the base: text, a shape or another image, in a box of the scene that may be mirrored and is turned about its centre; a drawing, at an origin; or an arrow, between two points.",
531
+ "oneOf": [
532
+ {
533
+ "type": "object",
534
+ "required": [
535
+ "key",
536
+ "kind",
537
+ "name",
538
+ "visible",
539
+ "opacity",
540
+ "x",
541
+ "y",
542
+ "width",
543
+ "height",
544
+ "rotation",
545
+ "flipX",
546
+ "text",
547
+ "font",
548
+ "bold",
549
+ "colour",
550
+ "align"
551
+ ],
552
+ "additionalProperties": false,
553
+ "properties": {
554
+ "key": {
555
+ "$ref": "#/$defs/key"
556
+ },
557
+ "name": {
558
+ "allOf": [
559
+ {
560
+ "$ref": "#/$defs/text"
561
+ },
562
+ {
563
+ "type": "string",
564
+ "maxLength": 100
565
+ }
566
+ ]
567
+ },
568
+ "visible": {
569
+ "type": "boolean"
570
+ },
571
+ "opacity": {
572
+ "$ref": "#/$defs/opacity"
573
+ },
574
+ "x": {
575
+ "$ref": "#/$defs/scenePosition"
576
+ },
577
+ "y": {
578
+ "$ref": "#/$defs/scenePosition"
579
+ },
580
+ "width": {
581
+ "$ref": "#/$defs/sceneLength"
582
+ },
583
+ "height": {
584
+ "$ref": "#/$defs/sceneLength"
585
+ },
586
+ "rotation": {
587
+ "$ref": "#/$defs/rotation"
588
+ },
589
+ "flipX": {
590
+ "$ref": "#/$defs/flipX"
591
+ },
592
+ "kind": {
593
+ "const": "text"
594
+ },
595
+ "text": {
596
+ "allOf": [
597
+ {
598
+ "$ref": "#/$defs/text"
599
+ },
600
+ {
601
+ "type": "string",
602
+ "maxLength": 1000
603
+ }
604
+ ]
605
+ },
606
+ "font": {
607
+ "$ref": "#/$defs/font"
608
+ },
609
+ "bold": {
610
+ "type": "boolean"
611
+ },
612
+ "colour": {
613
+ "$ref": "#/$defs/colour"
614
+ },
615
+ "align": {
616
+ "$ref": "#/$defs/align"
617
+ }
618
+ }
619
+ },
620
+ {
621
+ "type": "object",
622
+ "required": [
623
+ "key",
624
+ "kind",
625
+ "name",
626
+ "visible",
627
+ "opacity",
628
+ "x",
629
+ "y",
630
+ "width",
631
+ "height",
632
+ "rotation",
633
+ "flipX",
634
+ "shape",
635
+ "fill",
636
+ "stroke"
637
+ ],
638
+ "additionalProperties": false,
639
+ "properties": {
640
+ "key": {
641
+ "$ref": "#/$defs/key"
642
+ },
643
+ "name": {
644
+ "allOf": [
645
+ {
646
+ "$ref": "#/$defs/text"
647
+ },
648
+ {
649
+ "type": "string",
650
+ "maxLength": 100
651
+ }
652
+ ]
653
+ },
654
+ "visible": {
655
+ "type": "boolean"
656
+ },
657
+ "opacity": {
658
+ "$ref": "#/$defs/opacity"
659
+ },
660
+ "x": {
661
+ "$ref": "#/$defs/scenePosition"
662
+ },
663
+ "y": {
664
+ "$ref": "#/$defs/scenePosition"
665
+ },
666
+ "width": {
667
+ "$ref": "#/$defs/sceneLength"
668
+ },
669
+ "height": {
670
+ "$ref": "#/$defs/sceneLength"
671
+ },
672
+ "rotation": {
673
+ "$ref": "#/$defs/rotation"
674
+ },
675
+ "flipX": {
676
+ "$ref": "#/$defs/flipX"
677
+ },
678
+ "kind": {
679
+ "const": "shape"
680
+ },
681
+ "shape": {
682
+ "$ref": "#/$defs/shape"
683
+ },
684
+ "fill": {
685
+ "oneOf": [
686
+ {
687
+ "type": "null"
688
+ },
689
+ {
690
+ "$ref": "#/$defs/colour"
691
+ }
692
+ ]
693
+ },
694
+ "stroke": {
695
+ "oneOf": [
696
+ {
697
+ "type": "null"
698
+ },
699
+ {
700
+ "$ref": "#/$defs/stroke"
701
+ }
702
+ ]
703
+ }
704
+ }
705
+ },
706
+ {
707
+ "type": "object",
708
+ "required": [
709
+ "key",
710
+ "kind",
711
+ "name",
712
+ "visible",
713
+ "opacity",
714
+ "x",
715
+ "y",
716
+ "width",
717
+ "height",
718
+ "rotation",
719
+ "flipX",
720
+ "source",
721
+ "crop"
722
+ ],
723
+ "additionalProperties": false,
724
+ "properties": {
725
+ "key": {
726
+ "$ref": "#/$defs/key"
727
+ },
728
+ "name": {
729
+ "allOf": [
730
+ {
731
+ "$ref": "#/$defs/text"
732
+ },
733
+ {
734
+ "type": "string",
735
+ "maxLength": 100
736
+ }
737
+ ]
738
+ },
739
+ "visible": {
740
+ "type": "boolean"
741
+ },
742
+ "opacity": {
743
+ "$ref": "#/$defs/opacity"
744
+ },
745
+ "x": {
746
+ "$ref": "#/$defs/scenePosition"
747
+ },
748
+ "y": {
749
+ "$ref": "#/$defs/scenePosition"
750
+ },
751
+ "width": {
752
+ "$ref": "#/$defs/sceneLength"
753
+ },
754
+ "height": {
755
+ "$ref": "#/$defs/sceneLength"
756
+ },
757
+ "rotation": {
758
+ "$ref": "#/$defs/rotation"
759
+ },
760
+ "flipX": {
761
+ "$ref": "#/$defs/flipX"
762
+ },
763
+ "kind": {
764
+ "const": "image"
765
+ },
766
+ "source": {
767
+ "type": "string",
768
+ "minLength": 1
769
+ },
770
+ "crop": {
771
+ "oneOf": [
772
+ {
773
+ "type": "null"
774
+ },
775
+ {
776
+ "$ref": "#/$defs/crop"
777
+ }
778
+ ]
779
+ }
780
+ }
781
+ },
782
+ {
783
+ "type": "object",
784
+ "required": ["key", "kind", "name", "visible", "opacity", "x", "y", "strokes"],
785
+ "additionalProperties": false,
786
+ "properties": {
787
+ "key": {
788
+ "$ref": "#/$defs/key"
789
+ },
790
+ "name": {
791
+ "allOf": [
792
+ {
793
+ "$ref": "#/$defs/text"
794
+ },
795
+ {
796
+ "type": "string",
797
+ "maxLength": 100
798
+ }
799
+ ]
800
+ },
801
+ "visible": {
802
+ "type": "boolean"
803
+ },
804
+ "opacity": {
805
+ "$ref": "#/$defs/opacity"
806
+ },
807
+ "kind": {
808
+ "const": "drawing"
809
+ },
810
+ "x": {
811
+ "$ref": "#/$defs/scenePosition"
812
+ },
813
+ "y": {
814
+ "$ref": "#/$defs/scenePosition"
815
+ },
816
+ "strokes": {
817
+ "description": "In the order they're drawn. Beyond this schema, a drawing has at least one.",
818
+ "type": "array",
819
+ "maxItems": 1024,
820
+ "items": {
821
+ "$ref": "#/$defs/drawnStroke"
822
+ }
823
+ }
824
+ }
825
+ },
826
+ {
827
+ "type": "object",
828
+ "required": [
829
+ "key",
830
+ "kind",
831
+ "name",
832
+ "visible",
833
+ "opacity",
834
+ "from",
835
+ "to",
836
+ "colour",
837
+ "width"
838
+ ],
839
+ "additionalProperties": false,
840
+ "properties": {
841
+ "key": {
842
+ "$ref": "#/$defs/key"
843
+ },
844
+ "name": {
845
+ "allOf": [
846
+ {
847
+ "$ref": "#/$defs/text"
848
+ },
849
+ {
850
+ "type": "string",
851
+ "maxLength": 100
852
+ }
853
+ ]
854
+ },
855
+ "visible": {
856
+ "type": "boolean"
857
+ },
858
+ "opacity": {
859
+ "$ref": "#/$defs/opacity"
860
+ },
861
+ "kind": {
862
+ "const": "arrow"
863
+ },
864
+ "from": {
865
+ "$ref": "#/$defs/point"
866
+ },
867
+ "to": {
868
+ "$ref": "#/$defs/point"
869
+ },
870
+ "colour": {
871
+ "$ref": "#/$defs/colour"
872
+ },
873
+ "width": {
874
+ "$ref": "#/$defs/strokeWidth"
875
+ }
876
+ }
877
+ }
878
+ ]
879
+ },
880
+ "layerProps": {
881
+ "description": "Some of a layer's fields: any but its key and its kind, and a drawing's strokes, which the stroke commands change. Beyond this schema, the reducer checks that each field is one the layer's kind has, and the layer that results.",
882
+ "type": "object",
883
+ "additionalProperties": false,
884
+ "properties": {
885
+ "name": {
886
+ "allOf": [
887
+ {
888
+ "$ref": "#/$defs/text"
889
+ },
890
+ {
891
+ "type": "string",
892
+ "maxLength": 100
893
+ }
894
+ ]
895
+ },
896
+ "visible": {
897
+ "type": "boolean"
898
+ },
899
+ "opacity": {
900
+ "$ref": "#/$defs/opacity"
901
+ },
902
+ "x": {
903
+ "$ref": "#/$defs/scenePosition"
904
+ },
905
+ "y": {
906
+ "$ref": "#/$defs/scenePosition"
907
+ },
908
+ "width": {
909
+ "$ref": "#/$defs/sceneLength"
910
+ },
911
+ "height": {
912
+ "$ref": "#/$defs/sceneLength"
913
+ },
914
+ "rotation": {
915
+ "$ref": "#/$defs/rotation"
916
+ },
917
+ "flipX": {
918
+ "$ref": "#/$defs/flipX"
919
+ },
920
+ "text": {
921
+ "allOf": [
922
+ {
923
+ "$ref": "#/$defs/text"
924
+ },
925
+ {
926
+ "type": "string",
927
+ "maxLength": 1000
928
+ }
929
+ ]
930
+ },
931
+ "font": {
932
+ "$ref": "#/$defs/font"
933
+ },
934
+ "bold": {
935
+ "type": "boolean"
936
+ },
937
+ "colour": {
938
+ "$ref": "#/$defs/colour"
939
+ },
940
+ "align": {
941
+ "$ref": "#/$defs/align"
942
+ },
943
+ "shape": {
944
+ "$ref": "#/$defs/shape"
945
+ },
946
+ "fill": {
947
+ "oneOf": [
948
+ {
949
+ "type": "null"
950
+ },
951
+ {
952
+ "$ref": "#/$defs/colour"
953
+ }
954
+ ]
955
+ },
956
+ "stroke": {
957
+ "oneOf": [
958
+ {
959
+ "type": "null"
960
+ },
961
+ {
962
+ "$ref": "#/$defs/stroke"
963
+ }
964
+ ]
965
+ },
966
+ "source": {
967
+ "type": "string",
968
+ "minLength": 1
969
+ },
970
+ "crop": {
971
+ "oneOf": [
972
+ {
973
+ "type": "null"
974
+ },
975
+ {
976
+ "$ref": "#/$defs/crop"
977
+ }
978
+ ]
979
+ },
980
+ "from": {
981
+ "$ref": "#/$defs/point"
982
+ },
983
+ "to": {
984
+ "$ref": "#/$defs/point"
985
+ }
986
+ }
987
+ },
988
+ "strokeWidth": {
989
+ "description": "The width of a drawn stroke or an arrow's shaft, in whole scene pixels.",
990
+ "type": "integer",
991
+ "minimum": 1,
992
+ "maximum": 1024
993
+ },
994
+ "point": {
995
+ "description": "A point of the scene, in whole pixels.",
996
+ "type": "object",
997
+ "required": ["x", "y"],
998
+ "additionalProperties": false,
999
+ "properties": {
1000
+ "x": {
1001
+ "$ref": "#/$defs/scenePosition"
1002
+ },
1003
+ "y": {
1004
+ "$ref": "#/$defs/scenePosition"
1005
+ }
1006
+ }
1007
+ },
1008
+ "run": {
1009
+ "description": "One polyline of a stroke: [x0, y0, x1, y1, ...], 1 to 2,000 points in whole pixels from the drawing's origin. Beyond this schema, the count is even, and each point is within the scene's coordinates once the origin is added.",
1010
+ "type": "array",
1011
+ "minItems": 2,
1012
+ "maxItems": 4000,
1013
+ "items": {
1014
+ "type": "integer",
1015
+ "minimum": -131072,
1016
+ "maximum": 131072
1017
+ }
1018
+ },
1019
+ "drawnStroke": {
1020
+ "description": "One stroke of a drawing: what one gesture drew. It has more than one run only when it's long.",
1021
+ "type": "object",
1022
+ "required": ["colour", "width", "runs"],
1023
+ "additionalProperties": false,
1024
+ "properties": {
1025
+ "colour": {
1026
+ "$ref": "#/$defs/colour"
1027
+ },
1028
+ "width": {
1029
+ "$ref": "#/$defs/strokeWidth"
1030
+ },
1031
+ "runs": {
1032
+ "type": "array",
1033
+ "minItems": 1,
1034
+ "maxItems": 64,
1035
+ "items": {
1036
+ "$ref": "#/$defs/run"
1037
+ }
1038
+ }
1039
+ }
1040
+ },
1041
+ "frameCount": {
1042
+ "description": "How many frames a source has: 1 for a still, and at most 4,096.",
1043
+ "type": "integer",
1044
+ "minimum": 1,
1045
+ "maximum": 4096
1046
+ },
1047
+ "delay": {
1048
+ "description": "How long a frame is shown, in hundredths of a second.",
1049
+ "type": "integer",
1050
+ "minimum": 0,
1051
+ "maximum": 65535
1052
+ },
1053
+ "loop": {
1054
+ "description": "How many times an animation repeats: null for once, 0 for ever.",
1055
+ "oneOf": [
1056
+ {
1057
+ "type": "null"
1058
+ },
1059
+ {
1060
+ "type": "integer",
1061
+ "minimum": 0,
1062
+ "maximum": 65535
1063
+ }
1064
+ ]
1065
+ },
1066
+ "frame": {
1067
+ "description": "One frame of an animation: which of the source's frames it shows, from 0, and for how long. Beyond this schema, the source must have that frame.",
1068
+ "type": "object",
1069
+ "required": ["key", "frame", "delay"],
1070
+ "additionalProperties": false,
1071
+ "properties": {
1072
+ "key": {
1073
+ "$ref": "#/$defs/key"
1074
+ },
1075
+ "frame": {
1076
+ "type": "integer",
1077
+ "minimum": 0
1078
+ },
1079
+ "delay": {
1080
+ "$ref": "#/$defs/delay"
1081
+ }
1082
+ }
1083
+ },
1084
+ "frameProps": {
1085
+ "description": "Some of a frame's fields: its delay.",
1086
+ "type": "object",
1087
+ "additionalProperties": false,
1088
+ "properties": {
1089
+ "delay": {
1090
+ "$ref": "#/$defs/delay"
1091
+ }
1092
+ }
1093
+ },
1094
+ "animation": {
1095
+ "description": "The frames of the base's source, in the order they play, and how many times they repeat.",
1096
+ "type": "object",
1097
+ "required": ["loop", "frames"],
1098
+ "additionalProperties": false,
1099
+ "properties": {
1100
+ "loop": {
1101
+ "$ref": "#/$defs/loop"
1102
+ },
1103
+ "frames": {
1104
+ "type": "array",
1105
+ "minItems": 1,
1106
+ "maxItems": 4096,
1107
+ "items": {
1108
+ "$ref": "#/$defs/frame"
1109
+ }
1110
+ }
1111
+ }
1112
+ }
1113
+ }
1114
+ }