@ohos-ports/html2canvas-pro 0.0.0-stage → 2.3.2-beta.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/LICENSE +21 -0
- package/README.md +86 -2
- package/dist/html2canvas-pro.cjs +11191 -0
- package/dist/html2canvas-pro.cjs.map +1 -0
- package/dist/html2canvas-pro.esm.js +11182 -0
- package/dist/html2canvas-pro.esm.js.map +1 -0
- package/dist/html2canvas-pro.js +11196 -0
- package/dist/html2canvas-pro.js.map +1 -0
- package/dist/html2canvas-pro.min.js +10 -0
- package/dist/lib/config.js +49 -0
- package/dist/lib/core/abort-helper.js +20 -0
- package/dist/lib/core/background-parser.js +41 -0
- package/dist/lib/core/bitwise.js +5 -0
- package/dist/lib/core/cache-storage.js +268 -0
- package/dist/lib/core/config-assembler.js +88 -0
- package/dist/lib/core/constants.js +25 -0
- package/dist/lib/core/context.js +19 -0
- package/dist/lib/core/debugger.js +27 -0
- package/dist/lib/core/features.js +190 -0
- package/dist/lib/core/logger.js +56 -0
- package/dist/lib/core/lru-map.js +66 -0
- package/dist/lib/core/origin-checker.js +53 -0
- package/dist/lib/core/performance-monitor.js +185 -0
- package/dist/lib/core/render-element.js +132 -0
- package/dist/lib/core/util.js +4 -0
- package/dist/lib/core/validator.js +500 -0
- package/dist/lib/css/grouped/background-styles.js +36 -0
- package/dist/lib/css/grouped/border-styles.js +75 -0
- package/dist/lib/css/grouped/font-styles.js +93 -0
- package/dist/lib/css/grouped/layout-styles.js +127 -0
- package/dist/lib/css/index.js +330 -0
- package/dist/lib/css/layout/bounds.js +52 -0
- package/dist/lib/css/layout/text.js +133 -0
- package/dist/lib/css/property-descriptor.js +2 -0
- package/dist/lib/css/property-descriptors/background-blend-mode.js +41 -0
- package/dist/lib/css/property-descriptors/background-clip.js +23 -0
- package/dist/lib/css/property-descriptors/background-color.js +10 -0
- package/dist/lib/css/property-descriptors/background-image.js +24 -0
- package/dist/lib/css/property-descriptors/background-origin.js +23 -0
- package/dist/lib/css/property-descriptors/background-position.js +19 -0
- package/dist/lib/css/property-descriptors/background-repeat.js +33 -0
- package/dist/lib/css/property-descriptors/background-size.js +23 -0
- package/dist/lib/css/property-descriptors/border-color.js +14 -0
- package/dist/lib/css/property-descriptors/border-image-repeat.js +42 -0
- package/dist/lib/css/property-descriptors/border-image-slice.js +45 -0
- package/dist/lib/css/property-descriptors/border-image-source.js +22 -0
- package/dist/lib/css/property-descriptors/border-radius.js +15 -0
- package/dist/lib/css/property-descriptors/border-style.js +26 -0
- package/dist/lib/css/property-descriptors/border-width.js +20 -0
- package/dist/lib/css/property-descriptors/box-decoration-break.js +18 -0
- package/dist/lib/css/property-descriptors/box-shadow.js +54 -0
- package/dist/lib/css/property-descriptors/clip-path.js +189 -0
- package/dist/lib/css/property-descriptors/color.js +10 -0
- package/dist/lib/css/property-descriptors/content.js +19 -0
- package/dist/lib/css/property-descriptors/counter-increment.js +35 -0
- package/dist/lib/css/property-descriptors/counter-reset.js +18 -0
- package/dist/lib/css/property-descriptors/direction.js +18 -0
- package/dist/lib/css/property-descriptors/display.js +81 -0
- package/dist/lib/css/property-descriptors/duration.js +14 -0
- package/dist/lib/css/property-descriptors/filter.js +76 -0
- package/dist/lib/css/property-descriptors/float.js +22 -0
- package/dist/lib/css/property-descriptors/font-family.js +32 -0
- package/dist/lib/css/property-descriptors/font-size.js +10 -0
- package/dist/lib/css/property-descriptors/font-style.js +20 -0
- package/dist/lib/css/property-descriptors/font-variant-ligatures.js +34 -0
- package/dist/lib/css/property-descriptors/font-variant.js +13 -0
- package/dist/lib/css/property-descriptors/font-weight.js +25 -0
- package/dist/lib/css/property-descriptors/image-rendering.js +33 -0
- package/dist/lib/css/property-descriptors/letter-spacing.js +21 -0
- package/dist/lib/css/property-descriptors/line-break.js +23 -0
- package/dist/lib/css/property-descriptors/line-height.js +24 -0
- package/dist/lib/css/property-descriptors/list-style-image.js +17 -0
- package/dist/lib/css/property-descriptors/list-style-position.js +18 -0
- package/dist/lib/css/property-descriptors/list-style-type.js +122 -0
- package/dist/lib/css/property-descriptors/margin.js +13 -0
- package/dist/lib/css/property-descriptors/mix-blend-mode.js +31 -0
- package/dist/lib/css/property-descriptors/object-fit.js +28 -0
- package/dist/lib/css/property-descriptors/object-position.js +42 -0
- package/dist/lib/css/property-descriptors/opacity.js +16 -0
- package/dist/lib/css/property-descriptors/overflow-wrap.js +18 -0
- package/dist/lib/css/property-descriptors/overflow.js +27 -0
- package/dist/lib/css/property-descriptors/padding.js +14 -0
- package/dist/lib/css/property-descriptors/paint-order.js +33 -0
- package/dist/lib/css/property-descriptors/position.js +22 -0
- package/dist/lib/css/property-descriptors/quotes.js +41 -0
- package/dist/lib/css/property-descriptors/rotate.js +27 -0
- package/dist/lib/css/property-descriptors/text-align.js +21 -0
- package/dist/lib/css/property-descriptors/text-decoration-color.js +10 -0
- package/dist/lib/css/property-descriptors/text-decoration-line.js +28 -0
- package/dist/lib/css/property-descriptors/text-decoration-style.js +24 -0
- package/dist/lib/css/property-descriptors/text-decoration-thickness.js +26 -0
- package/dist/lib/css/property-descriptors/text-overflow.js +18 -0
- package/dist/lib/css/property-descriptors/text-shadow.js +46 -0
- package/dist/lib/css/property-descriptors/text-transform.js +20 -0
- package/dist/lib/css/property-descriptors/text-underline-offset.js +23 -0
- package/dist/lib/css/property-descriptors/transform-origin.js +24 -0
- package/dist/lib/css/property-descriptors/transform.js +57 -0
- package/dist/lib/css/property-descriptors/visibility.js +20 -0
- package/dist/lib/css/property-descriptors/webkit-line-clamp.js +26 -0
- package/dist/lib/css/property-descriptors/webkit-text-stroke-color.js +10 -0
- package/dist/lib/css/property-descriptors/webkit-text-stroke-width.js +16 -0
- package/dist/lib/css/property-descriptors/word-break.js +26 -0
- package/dist/lib/css/property-descriptors/writing-mode.js +28 -0
- package/dist/lib/css/property-descriptors/z-index.js +19 -0
- package/dist/lib/css/property-descriptors/zoom.js +18 -0
- package/dist/lib/css/syntax/parser.js +140 -0
- package/dist/lib/css/syntax/token-constants.js +214 -0
- package/dist/lib/css/syntax/token-singletons.js +36 -0
- package/dist/lib/css/syntax/token-types.js +10 -0
- package/dist/lib/css/syntax/tokenizer.js +502 -0
- package/dist/lib/css/type-descriptor.js +2 -0
- package/dist/lib/css/types/angle.js +80 -0
- package/dist/lib/css/types/color-math.js +25 -0
- package/dist/lib/css/types/color-spaces/a98.js +78 -0
- package/dist/lib/css/types/color-spaces/p3.js +86 -0
- package/dist/lib/css/types/color-spaces/pro-photo.js +83 -0
- package/dist/lib/css/types/color-spaces/rec2020.js +85 -0
- package/dist/lib/css/types/color-spaces/srgb.js +79 -0
- package/dist/lib/css/types/color-utilities.js +342 -0
- package/dist/lib/css/types/color.js +400 -0
- package/dist/lib/css/types/functions/-prefix-linear-gradient.js +32 -0
- package/dist/lib/css/types/functions/-prefix-radial-gradient.js +83 -0
- package/dist/lib/css/types/functions/-webkit-gradient.js +59 -0
- package/dist/lib/css/types/functions/counter.js +367 -0
- package/dist/lib/css/types/functions/gradient.js +163 -0
- package/dist/lib/css/types/functions/linear-gradient.js +27 -0
- package/dist/lib/css/types/functions/radial-gradient.js +90 -0
- package/dist/lib/css/types/functions/repeating-linear-gradient.js +9 -0
- package/dist/lib/css/types/image.js +62 -0
- package/dist/lib/css/types/index.js +2 -0
- package/dist/lib/css/types/length-percentage.js +197 -0
- package/dist/lib/css/types/length.js +5 -0
- package/dist/lib/css/types/safe-eval.js +80 -0
- package/dist/lib/css/types/time.js +17 -0
- package/dist/lib/dom/document-cloner.js +597 -0
- package/dist/lib/dom/dom-normalizer.js +115 -0
- package/dist/lib/dom/element-container.js +56 -0
- package/dist/lib/dom/elements/li-element-container.js +11 -0
- package/dist/lib/dom/elements/ol-element-container.js +12 -0
- package/dist/lib/dom/elements/select-element-container.js +12 -0
- package/dist/lib/dom/elements/textarea-element-container.js +11 -0
- package/dist/lib/dom/node-parser.js +112 -0
- package/dist/lib/dom/node-type-guards.js +81 -0
- package/dist/lib/dom/replaced-elements/canvas-element-container.js +13 -0
- package/dist/lib/dom/replaced-elements/iframe-element-container.js +38 -0
- package/dist/lib/dom/replaced-elements/image-element-container.js +14 -0
- package/dist/lib/dom/replaced-elements/index.js +2 -0
- package/dist/lib/dom/replaced-elements/input-element-container.js +89 -0
- package/dist/lib/dom/replaced-elements/svg-element-container.js +19 -0
- package/dist/lib/dom/slot-cloner.js +176 -0
- package/dist/lib/dom/text-container.js +35 -0
- package/dist/lib/index.js +49 -0
- package/dist/lib/options.js +2 -0
- package/dist/lib/render/background.js +188 -0
- package/dist/lib/render/bezier-curve.js +34 -0
- package/dist/lib/render/border.js +104 -0
- package/dist/lib/render/bound-curves.js +188 -0
- package/dist/lib/render/box-sizing.js +20 -0
- package/dist/lib/render/canvas/background-renderer.js +327 -0
- package/dist/lib/render/canvas/border-image-renderer.js +153 -0
- package/dist/lib/render/canvas/border-renderer.js +184 -0
- package/dist/lib/render/canvas/canvas-path.js +25 -0
- package/dist/lib/render/canvas/canvas-renderer.js +312 -0
- package/dist/lib/render/canvas/content-renderer.js +204 -0
- package/dist/lib/render/canvas/effects-renderer.js +171 -0
- package/dist/lib/render/canvas/font-utils.js +29 -0
- package/dist/lib/render/canvas/foreignobject-renderer.js +38 -0
- package/dist/lib/render/canvas/text/text-decoration-renderer.js +99 -0
- package/dist/lib/render/canvas/text-renderer.js +485 -0
- package/dist/lib/render/effects.js +231 -0
- package/dist/lib/render/font-metrics.js +53 -0
- package/dist/lib/render/object-fit.js +91 -0
- package/dist/lib/render/path.js +26 -0
- package/dist/lib/render/renderer-interface.js +2 -0
- package/dist/lib/render/stacking-context.js +340 -0
- package/dist/lib/render/vector.js +16 -0
- package/dist/types/config.d.ts +44 -0
- package/dist/types/core/abort-helper.d.ts +12 -0
- package/dist/types/core/background-parser.d.ts +16 -0
- package/dist/types/core/bitwise.d.ts +1 -0
- package/dist/types/core/cache-storage.d.ts +68 -0
- package/dist/types/core/config-assembler.d.ts +28 -0
- package/dist/types/core/constants.d.ts +22 -0
- package/dist/types/core/context.d.ts +22 -0
- package/dist/types/core/debugger.d.ts +8 -0
- package/dist/types/core/features.d.ts +12 -0
- package/dist/types/core/logger.d.ts +18 -0
- package/dist/types/core/lru-map.d.ts +37 -0
- package/dist/types/core/origin-checker.d.ts +33 -0
- package/dist/types/core/performance-monitor.d.ts +120 -0
- package/dist/types/core/render-element.d.ts +3 -0
- package/dist/types/core/util.d.ts +1 -0
- package/dist/types/core/validator.d.ts +130 -0
- package/dist/types/css/grouped/background-styles.d.ts +16 -0
- package/dist/types/css/grouped/border-styles.d.ts +31 -0
- package/dist/types/css/grouped/font-styles.d.ts +35 -0
- package/dist/types/css/grouped/layout-styles.d.ts +46 -0
- package/dist/types/css/index.d.ts +185 -0
- package/dist/types/css/layout/bounds.d.ts +14 -0
- package/dist/types/css/layout/text.d.ts +10 -0
- package/dist/types/css/property-descriptor.d.ts +40 -0
- package/dist/types/css/property-descriptors/background-blend-mode.d.ts +23 -0
- package/dist/types/css/property-descriptors/background-clip.d.ts +8 -0
- package/dist/types/css/property-descriptors/background-color.d.ts +2 -0
- package/dist/types/css/property-descriptors/background-image.d.ts +3 -0
- package/dist/types/css/property-descriptors/background-origin.d.ts +8 -0
- package/dist/types/css/property-descriptors/background-position.d.ts +5 -0
- package/dist/types/css/property-descriptors/background-repeat.d.ts +9 -0
- package/dist/types/css/property-descriptors/background-size.d.ts +11 -0
- package/dist/types/css/property-descriptors/border-color.d.ts +5 -0
- package/dist/types/css/property-descriptors/border-image-repeat.d.ts +12 -0
- package/dist/types/css/property-descriptors/border-image-slice.d.ts +10 -0
- package/dist/types/css/property-descriptors/border-image-source.d.ts +4 -0
- package/dist/types/css/property-descriptors/border-radius.d.ts +7 -0
- package/dist/types/css/property-descriptors/border-style.d.ts +12 -0
- package/dist/types/css/property-descriptors/border-width.d.ts +5 -0
- package/dist/types/css/property-descriptors/box-decoration-break.d.ts +6 -0
- package/dist/types/css/property-descriptors/box-shadow.d.ts +14 -0
- package/dist/types/css/property-descriptors/clip-path.d.ts +62 -0
- package/dist/types/css/property-descriptors/color.d.ts +2 -0
- package/dist/types/css/property-descriptors/content.d.ts +4 -0
- package/dist/types/css/property-descriptors/counter-increment.d.ts +10 -0
- package/dist/types/css/property-descriptors/counter-reset.d.ts +7 -0
- package/dist/types/css/property-descriptors/direction.d.ts +6 -0
- package/dist/types/css/property-descriptors/display.d.ts +35 -0
- package/dist/types/css/property-descriptors/duration.d.ts +2 -0
- package/dist/types/css/property-descriptors/filter.d.ts +3 -0
- package/dist/types/css/property-descriptors/float.d.ts +9 -0
- package/dist/types/css/property-descriptors/font-family.d.ts +4 -0
- package/dist/types/css/property-descriptors/font-size.d.ts +2 -0
- package/dist/types/css/property-descriptors/font-style.d.ts +7 -0
- package/dist/types/css/property-descriptors/font-variant-ligatures.d.ts +14 -0
- package/dist/types/css/property-descriptors/font-variant.d.ts +2 -0
- package/dist/types/css/property-descriptors/font-weight.d.ts +2 -0
- package/dist/types/css/property-descriptors/image-rendering.d.ts +8 -0
- package/dist/types/css/property-descriptors/letter-spacing.d.ts +2 -0
- package/dist/types/css/property-descriptors/line-break.d.ts +6 -0
- package/dist/types/css/property-descriptors/line-height.d.ts +4 -0
- package/dist/types/css/property-descriptors/list-style-image.d.ts +3 -0
- package/dist/types/css/property-descriptors/list-style-position.d.ts +6 -0
- package/dist/types/css/property-descriptors/list-style-type.d.ts +58 -0
- package/dist/types/css/property-descriptors/margin.d.ts +5 -0
- package/dist/types/css/property-descriptors/mix-blend-mode.d.ts +21 -0
- package/dist/types/css/property-descriptors/object-fit.d.ts +10 -0
- package/dist/types/css/property-descriptors/object-position.d.ts +4 -0
- package/dist/types/css/property-descriptors/opacity.d.ts +2 -0
- package/dist/types/css/property-descriptors/overflow-wrap.d.ts +6 -0
- package/dist/types/css/property-descriptors/overflow.d.ts +9 -0
- package/dist/types/css/property-descriptors/padding.d.ts +5 -0
- package/dist/types/css/property-descriptors/paint-order.d.ts +8 -0
- package/dist/types/css/property-descriptors/position.d.ts +9 -0
- package/dist/types/css/property-descriptors/quotes.d.ts +8 -0
- package/dist/types/css/property-descriptors/rotate.d.ts +3 -0
- package/dist/types/css/property-descriptors/text-align.d.ts +7 -0
- package/dist/types/css/property-descriptors/text-decoration-color.d.ts +2 -0
- package/dist/types/css/property-descriptors/text-decoration-line.d.ts +10 -0
- package/dist/types/css/property-descriptors/text-decoration-style.d.ts +9 -0
- package/dist/types/css/property-descriptors/text-decoration-thickness.d.ts +3 -0
- package/dist/types/css/property-descriptors/text-overflow.d.ts +6 -0
- package/dist/types/css/property-descriptors/text-shadow.d.ts +12 -0
- package/dist/types/css/property-descriptors/text-transform.d.ts +8 -0
- package/dist/types/css/property-descriptors/text-underline-offset.d.ts +3 -0
- package/dist/types/css/property-descriptors/transform-origin.d.ts +4 -0
- package/dist/types/css/property-descriptors/transform.d.ts +4 -0
- package/dist/types/css/property-descriptors/visibility.d.ts +7 -0
- package/dist/types/css/property-descriptors/webkit-line-clamp.d.ts +7 -0
- package/dist/types/css/property-descriptors/webkit-text-stroke-color.d.ts +2 -0
- package/dist/types/css/property-descriptors/webkit-text-stroke-width.d.ts +2 -0
- package/dist/types/css/property-descriptors/word-break.d.ts +7 -0
- package/dist/types/css/property-descriptors/writing-mode.d.ts +11 -0
- package/dist/types/css/property-descriptors/z-index.d.ts +7 -0
- package/dist/types/css/property-descriptors/zoom.d.ts +3 -0
- package/dist/types/css/syntax/parser.d.ts +34 -0
- package/dist/types/css/syntax/token-constants.d.ts +74 -0
- package/dist/types/css/syntax/token-singletons.d.ts +22 -0
- package/dist/types/css/syntax/token-types.d.ts +72 -0
- package/dist/types/css/syntax/tokenizer.d.ts +32 -0
- package/dist/types/css/type-descriptor.d.ts +6 -0
- package/dist/types/css/types/angle.d.ts +7 -0
- package/dist/types/css/types/color-math.d.ts +12 -0
- package/dist/types/css/types/color-spaces/a98.d.ts +39 -0
- package/dist/types/css/types/color-spaces/p3.d.ts +45 -0
- package/dist/types/css/types/color-spaces/pro-photo.d.ts +45 -0
- package/dist/types/css/types/color-spaces/rec2020.d.ts +45 -0
- package/dist/types/css/types/color-spaces/srgb.d.ts +38 -0
- package/dist/types/css/types/color-utilities.d.ts +107 -0
- package/dist/types/css/types/color.d.ts +8 -0
- package/dist/types/css/types/functions/-prefix-linear-gradient.d.ts +4 -0
- package/dist/types/css/types/functions/-prefix-radial-gradient.d.ts +4 -0
- package/dist/types/css/types/functions/-webkit-gradient.d.ts +4 -0
- package/dist/types/css/types/functions/counter.d.ts +10 -0
- package/dist/types/css/types/functions/gradient.d.ts +7 -0
- package/dist/types/css/types/functions/linear-gradient.d.ts +4 -0
- package/dist/types/css/types/functions/radial-gradient.d.ts +12 -0
- package/dist/types/css/types/functions/repeating-linear-gradient.d.ts +4 -0
- package/dist/types/css/types/image.d.ts +56 -0
- package/dist/types/css/types/index.d.ts +1 -0
- package/dist/types/css/types/length-percentage.d.ts +62 -0
- package/dist/types/css/types/length.d.ts +4 -0
- package/dist/types/css/types/safe-eval.d.ts +8 -0
- package/dist/types/css/types/time.d.ts +2 -0
- package/dist/types/dom/document-cloner.d.ts +57 -0
- package/dist/types/dom/dom-normalizer.d.ts +62 -0
- package/dist/types/dom/element-container.d.ts +31 -0
- package/dist/types/dom/elements/li-element-container.d.ts +6 -0
- package/dist/types/dom/elements/ol-element-container.d.ts +7 -0
- package/dist/types/dom/elements/select-element-container.d.ts +6 -0
- package/dist/types/dom/elements/textarea-element-container.d.ts +6 -0
- package/dist/types/dom/node-parser.d.ts +3 -0
- package/dist/types/dom/node-type-guards.d.ts +32 -0
- package/dist/types/dom/replaced-elements/canvas-element-container.d.ts +8 -0
- package/dist/types/dom/replaced-elements/iframe-element-container.d.ts +14 -0
- package/dist/types/dom/replaced-elements/image-element-container.d.ts +8 -0
- package/dist/types/dom/replaced-elements/index.d.ts +4 -0
- package/dist/types/dom/replaced-elements/input-element-container.d.ts +14 -0
- package/dist/types/dom/replaced-elements/svg-element-container.d.ts +8 -0
- package/dist/types/dom/slot-cloner.d.ts +66 -0
- package/dist/types/dom/text-container.d.ts +8 -0
- package/dist/types/index.d.ts +36 -0
- package/dist/types/options.d.ts +62 -0
- package/dist/types/render/background.d.ts +16 -0
- package/dist/types/render/bezier-curve.d.ts +14 -0
- package/dist/types/render/border.d.ts +6 -0
- package/dist/types/render/bound-curves.d.ts +32 -0
- package/dist/types/render/box-sizing.d.ts +4 -0
- package/dist/types/render/canvas/background-renderer.d.ts +94 -0
- package/dist/types/render/canvas/border-image-renderer.d.ts +18 -0
- package/dist/types/render/canvas/border-renderer.d.ts +67 -0
- package/dist/types/render/canvas/canvas-path.d.ts +3 -0
- package/dist/types/render/canvas/canvas-renderer.d.ts +60 -0
- package/dist/types/render/canvas/content-renderer.d.ts +43 -0
- package/dist/types/render/canvas/effects-renderer.d.ts +90 -0
- package/dist/types/render/canvas/font-utils.d.ts +19 -0
- package/dist/types/render/canvas/foreignobject-renderer.d.ts +10 -0
- package/dist/types/render/canvas/text/text-decoration-renderer.d.ts +18 -0
- package/dist/types/render/canvas/text-renderer.d.ts +103 -0
- package/dist/types/render/effects.d.ts +112 -0
- package/dist/types/render/font-metrics.d.ts +11 -0
- package/dist/types/render/object-fit.d.ts +19 -0
- package/dist/types/render/path.d.ts +13 -0
- package/dist/types/render/renderer-interface.d.ts +28 -0
- package/dist/types/render/stacking-context.d.ts +49 -0
- package/dist/types/render/vector.d.ts +9 -0
- package/package.json +139 -4
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertXyz50 = exports.convertXyz = exports.xyz50FromXYZ = exports.xyzFromXYZ = exports.xyz50ToXYZ = exports.oklabToXyz = exports.oklchToXyz = exports.lchToXyz = exports.labToXyz = exports.hslToXyz = exports.rgbToXyz = exports.hue2rgb = exports.d50toD65 = exports.d65toD50 = exports.extractOkLchComponents = exports.extractLabComponents = exports.extractLchComponents = exports.packHSL = exports.extractHslComponents = exports.packLch = exports.packOkLch = exports.packOkLab = exports.packLab = exports.packXYZ = exports.packSrgbLinear = exports.packSrgb = exports.multiplyMatrices = exports.clamp = exports.isRelativeTransform = exports.getTokenColorValue = exports.pack = exports.asString = exports.isTransparent = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
const srgb_1 = require("./color-spaces/srgb");
|
|
6
|
+
const angle_1 = require("./angle");
|
|
7
|
+
const length_percentage_1 = require("./length-percentage");
|
|
8
|
+
const color_math_1 = require("./color-math");
|
|
9
|
+
Object.defineProperty(exports, "clamp", { enumerable: true, get: function () { return color_math_1.clamp; } });
|
|
10
|
+
Object.defineProperty(exports, "multiplyMatrices", { enumerable: true, get: function () { return color_math_1.multiplyMatrices; } });
|
|
11
|
+
const isTransparent = (color) => (0xff & color) === 0;
|
|
12
|
+
exports.isTransparent = isTransparent;
|
|
13
|
+
const asString = (color) => {
|
|
14
|
+
const alpha = 0xff & color;
|
|
15
|
+
const blue = 0xff & (color >> 8);
|
|
16
|
+
const green = 0xff & (color >> 16);
|
|
17
|
+
const red = 0xff & (color >> 24);
|
|
18
|
+
return alpha < 255 ? `rgba(${red},${green},${blue},${alpha / 255})` : `rgb(${red},${green},${blue})`;
|
|
19
|
+
};
|
|
20
|
+
exports.asString = asString;
|
|
21
|
+
const pack = (r, g, b, a) => ((r << 24) | (g << 16) | (b << 8) | (Math.round(a * 255) << 0)) >>> 0;
|
|
22
|
+
exports.pack = pack;
|
|
23
|
+
const getTokenColorValue = (token, i) => {
|
|
24
|
+
if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
25
|
+
return token.number;
|
|
26
|
+
}
|
|
27
|
+
if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
|
|
28
|
+
const max = i === 3 ? 1 : 255;
|
|
29
|
+
return i === 3 ? (token.number / 100) * max : Math.round((token.number / 100) * max);
|
|
30
|
+
}
|
|
31
|
+
return 0;
|
|
32
|
+
};
|
|
33
|
+
exports.getTokenColorValue = getTokenColorValue;
|
|
34
|
+
const isRelativeTransform = (tokens) => (tokens[0].type === 20 /* TokenType.IDENT_TOKEN */ ? tokens[0].value : 'unknown') === 'from';
|
|
35
|
+
exports.isRelativeTransform = isRelativeTransform;
|
|
36
|
+
const packSrgb = (args) => {
|
|
37
|
+
return (0, exports.pack)((0, color_math_1.clamp)(Math.round(args[0] * 255), 0, 255), (0, color_math_1.clamp)(Math.round(args[1] * 255), 0, 255), (0, color_math_1.clamp)(Math.round(args[2] * 255), 0, 255), (0, color_math_1.clamp)(args[3], 0, 1));
|
|
38
|
+
};
|
|
39
|
+
exports.packSrgb = packSrgb;
|
|
40
|
+
const packSrgbLinear = ([r, g, b, a]) => {
|
|
41
|
+
const rgb = (0, srgb_1.srgbLinear2rgb)([r, g, b]);
|
|
42
|
+
return (0, exports.pack)((0, color_math_1.clamp)(Math.round(rgb[0] * 255), 0, 255), (0, color_math_1.clamp)(Math.round(rgb[1] * 255), 0, 255), (0, color_math_1.clamp)(Math.round(rgb[2] * 255), 0, 255), a);
|
|
43
|
+
};
|
|
44
|
+
exports.packSrgbLinear = packSrgbLinear;
|
|
45
|
+
const packXYZ = (args) => {
|
|
46
|
+
const srgb_linear = (0, srgb_1.xyz2rgbLinear)([args[0], args[1], args[2]]);
|
|
47
|
+
return (0, exports.packSrgbLinear)([srgb_linear[0], srgb_linear[1], srgb_linear[2], args[3]]);
|
|
48
|
+
};
|
|
49
|
+
exports.packXYZ = packXYZ;
|
|
50
|
+
const packLab = (_context, args) => {
|
|
51
|
+
if ((0, exports.isRelativeTransform)(args.filter(parser_1.nonFunctionArgSeparator))) {
|
|
52
|
+
throw new Error('Relative color not supported for lab()');
|
|
53
|
+
}
|
|
54
|
+
const [l, a, b, alpha] = (0, exports.extractLabComponents)(args), rgb = (0, srgb_1.srgbLinear2rgb)((0, srgb_1.xyz2rgbLinear)(lab2xyz([l, a, b])));
|
|
55
|
+
return (0, exports.pack)((0, color_math_1.clamp)(Math.round(rgb[0] * 255), 0, 255), (0, color_math_1.clamp)(Math.round(rgb[1] * 255), 0, 255), (0, color_math_1.clamp)(Math.round(rgb[2] * 255), 0, 255), alpha);
|
|
56
|
+
};
|
|
57
|
+
exports.packLab = packLab;
|
|
58
|
+
const packOkLab = (_context, args) => {
|
|
59
|
+
if ((0, exports.isRelativeTransform)(args.filter(parser_1.nonFunctionArgSeparator))) {
|
|
60
|
+
throw new Error('Relative color not supported for oklab()');
|
|
61
|
+
}
|
|
62
|
+
const [l, a, b, alpha] = (0, exports.extractLabComponents)(args), rgb = (0, srgb_1.srgbLinear2rgb)((0, srgb_1.xyz2rgbLinear)(oklab2xyz([l, a, b])));
|
|
63
|
+
return (0, exports.pack)((0, color_math_1.clamp)(Math.round(rgb[0] * 255), 0, 255), (0, color_math_1.clamp)(Math.round(rgb[1] * 255), 0, 255), (0, color_math_1.clamp)(Math.round(rgb[2] * 255), 0, 255), alpha);
|
|
64
|
+
};
|
|
65
|
+
exports.packOkLab = packOkLab;
|
|
66
|
+
const packOkLch = (_context, args) => {
|
|
67
|
+
if ((0, exports.isRelativeTransform)(args.filter(parser_1.nonFunctionArgSeparator))) {
|
|
68
|
+
throw new Error('Relative color not supported for oklch()');
|
|
69
|
+
}
|
|
70
|
+
const [l, c, h, alpha] = (0, exports.extractOkLchComponents)(args), rgb = (0, srgb_1.srgbLinear2rgb)((0, srgb_1.xyz2rgbLinear)(oklab2xyz(lch2lab([l, c, h]))));
|
|
71
|
+
return (0, exports.pack)((0, color_math_1.clamp)(Math.round(rgb[0] * 255), 0, 255), (0, color_math_1.clamp)(Math.round(rgb[1] * 255), 0, 255), (0, color_math_1.clamp)(Math.round(rgb[2] * 255), 0, 255), alpha);
|
|
72
|
+
};
|
|
73
|
+
exports.packOkLch = packOkLch;
|
|
74
|
+
const packLch = (_context, args) => {
|
|
75
|
+
if ((0, exports.isRelativeTransform)(args.filter(parser_1.nonFunctionArgSeparator))) {
|
|
76
|
+
throw new Error('Relative color not supported for lch()');
|
|
77
|
+
}
|
|
78
|
+
const [l, c, h, a] = (0, exports.extractLchComponents)(args), rgb = (0, srgb_1.srgbLinear2rgb)((0, srgb_1.xyz2rgbLinear)(lab2xyz(lch2lab([l, c, h]))));
|
|
79
|
+
return (0, exports.pack)((0, color_math_1.clamp)(Math.round(rgb[0] * 255), 0, 255), (0, color_math_1.clamp)(Math.round(rgb[1] * 255), 0, 255), (0, color_math_1.clamp)(Math.round(rgb[2] * 255), 0, 255), a);
|
|
80
|
+
};
|
|
81
|
+
exports.packLch = packLch;
|
|
82
|
+
const extractHslComponents = (context, args) => {
|
|
83
|
+
const tokens = args.filter(parser_1.nonFunctionArgSeparator), [hue, saturation, lightness, alpha] = tokens, h = (hue.type === 17 /* TokenType.NUMBER_TOKEN */ ? (0, angle_1.deg)(hue.number) : angle_1.angle.parse(context, hue)) / (Math.PI * 2), s = (0, length_percentage_1.isLengthPercentage)(saturation) ? saturation.number / 100 : 0, l = (0, length_percentage_1.isLengthPercentage)(lightness) ? lightness.number / 100 : 0, a = typeof alpha !== 'undefined' && (0, length_percentage_1.isLengthPercentage)(alpha) ? (0, length_percentage_1.getAbsoluteValue)(alpha, 1) : 1;
|
|
84
|
+
return [h, s, l, a];
|
|
85
|
+
};
|
|
86
|
+
exports.extractHslComponents = extractHslComponents;
|
|
87
|
+
const packHSL = (context, args) => {
|
|
88
|
+
if ((0, exports.isRelativeTransform)(args)) {
|
|
89
|
+
throw new Error('Relative color not supported for hsl()');
|
|
90
|
+
}
|
|
91
|
+
const [h, s, l, a] = (0, exports.extractHslComponents)(context, args), rgb = hsl2rgb([h, s, l]);
|
|
92
|
+
return (0, exports.pack)(rgb[0] * 255, rgb[1] * 255, rgb[2] * 255, s === 0 ? 1 : a);
|
|
93
|
+
};
|
|
94
|
+
exports.packHSL = packHSL;
|
|
95
|
+
const extractLchComponents = (args) => {
|
|
96
|
+
const tokens = args.filter(parser_1.nonFunctionArgSeparator), l = (0, length_percentage_1.isLengthPercentage)(tokens[0]) ? tokens[0].number : 0, c = (0, length_percentage_1.isLengthPercentage)(tokens[1]) ? tokens[1].number : 0, h = (0, parser_1.isNumberToken)(tokens[2]) || (0, parser_1.isDimensionToken)(tokens[2]) ? tokens[2].number : 0, a = typeof tokens[4] !== 'undefined' && (0, length_percentage_1.isLengthPercentage)(tokens[4]) ? (0, length_percentage_1.getAbsoluteValue)(tokens[4], 1) : 1;
|
|
97
|
+
return [l, c, h, a];
|
|
98
|
+
};
|
|
99
|
+
exports.extractLchComponents = extractLchComponents;
|
|
100
|
+
const extractLabComponents = (args) => {
|
|
101
|
+
const tokens = args.filter(parser_1.nonFunctionArgSeparator), l = tokens[0].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
102
|
+
? tokens[0].number / 100
|
|
103
|
+
: (0, parser_1.isNumberToken)(tokens[0])
|
|
104
|
+
? tokens[0].number
|
|
105
|
+
: 0, a = tokens[1].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
106
|
+
? tokens[1].number / 100
|
|
107
|
+
: (0, parser_1.isNumberToken)(tokens[1])
|
|
108
|
+
? tokens[1].number
|
|
109
|
+
: 0, b = (0, parser_1.isNumberToken)(tokens[2]) || (0, parser_1.isDimensionToken)(tokens[2]) ? tokens[2].number : 0, alpha = typeof tokens[4] !== 'undefined' && (0, length_percentage_1.isLengthPercentage)(tokens[4]) ? (0, length_percentage_1.getAbsoluteValue)(tokens[4], 1) : 1;
|
|
110
|
+
return [l, a, b, alpha];
|
|
111
|
+
};
|
|
112
|
+
exports.extractLabComponents = extractLabComponents;
|
|
113
|
+
const extractOkLchComponents = (args) => {
|
|
114
|
+
const tokens = args.filter(parser_1.nonFunctionArgSeparator), l = tokens[0].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
115
|
+
? tokens[0].number / 100
|
|
116
|
+
: (0, parser_1.isNumberToken)(tokens[0])
|
|
117
|
+
? tokens[0].number
|
|
118
|
+
: 0, c = tokens[1].type === 16 /* TokenType.PERCENTAGE_TOKEN */
|
|
119
|
+
? tokens[1].number / 100
|
|
120
|
+
: (0, parser_1.isNumberToken)(tokens[1])
|
|
121
|
+
? tokens[1].number
|
|
122
|
+
: 0, h = (0, parser_1.isNumberToken)(tokens[2]) || (0, parser_1.isDimensionToken)(tokens[2]) ? tokens[2].number : 0, a = typeof tokens[4] !== 'undefined' && (0, length_percentage_1.isLengthPercentage)(tokens[4]) ? (0, length_percentage_1.getAbsoluteValue)(tokens[4], 1) : 1;
|
|
123
|
+
return [l, c, h, a];
|
|
124
|
+
};
|
|
125
|
+
exports.extractOkLchComponents = extractOkLchComponents;
|
|
126
|
+
/**
|
|
127
|
+
* Convert D65 to D50
|
|
128
|
+
*
|
|
129
|
+
* @param xyz
|
|
130
|
+
*/
|
|
131
|
+
const d65toD50 = (xyz) => {
|
|
132
|
+
return (0, color_math_1.multiplyMatrices)([
|
|
133
|
+
1.0479297925449969, 0.022946870601609652, -0.05019226628920524, 0.02962780877005599, 0.9904344267538799,
|
|
134
|
+
-0.017073799063418826, -0.009243040646204504, 0.015055191490298152, 0.7518742814281371
|
|
135
|
+
], xyz);
|
|
136
|
+
};
|
|
137
|
+
exports.d65toD50 = d65toD50;
|
|
138
|
+
/**
|
|
139
|
+
* Convert D50 to D65
|
|
140
|
+
*
|
|
141
|
+
* @param xyz
|
|
142
|
+
*/
|
|
143
|
+
const d50toD65 = (xyz) => {
|
|
144
|
+
return (0, color_math_1.multiplyMatrices)([
|
|
145
|
+
0.955473421488075, -0.02309845494876471, 0.06325924320057072, -0.0283697093338637, 1.0099953980813041,
|
|
146
|
+
0.021041441191917323, 0.012314014864481998, -0.020507649298898964, 1.330365926242124
|
|
147
|
+
], xyz);
|
|
148
|
+
};
|
|
149
|
+
exports.d50toD65 = d50toD65;
|
|
150
|
+
const hue2rgb = (t1, t2, hue) => {
|
|
151
|
+
if (hue < 0) {
|
|
152
|
+
hue += 1;
|
|
153
|
+
}
|
|
154
|
+
if (hue >= 1) {
|
|
155
|
+
hue -= 1;
|
|
156
|
+
}
|
|
157
|
+
if (hue < 1 / 6) {
|
|
158
|
+
return (t2 - t1) * hue * 6 + t1;
|
|
159
|
+
}
|
|
160
|
+
else if (hue < 1 / 2) {
|
|
161
|
+
return t2;
|
|
162
|
+
}
|
|
163
|
+
else if (hue < 2 / 3) {
|
|
164
|
+
return (t2 - t1) * 6 * (2 / 3 - hue) + t1;
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return t1;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
exports.hue2rgb = hue2rgb;
|
|
171
|
+
const hsl2rgb = ([h, s, l]) => {
|
|
172
|
+
if (s === 0) {
|
|
173
|
+
return [l * 255, l * 255, l * 255];
|
|
174
|
+
}
|
|
175
|
+
const t2 = l <= 0.5 ? l * (s + 1) : l + s - l * s, t1 = l * 2 - t2, r = (0, exports.hue2rgb)(t1, t2, h + 1 / 3), g = (0, exports.hue2rgb)(t1, t2, h), b = (0, exports.hue2rgb)(t1, t2, h - 1 / 3);
|
|
176
|
+
return [r, g, b];
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Convert lch to OKLab
|
|
180
|
+
*
|
|
181
|
+
* @param l
|
|
182
|
+
* @param c
|
|
183
|
+
* @param h
|
|
184
|
+
*/
|
|
185
|
+
const lch2lab = ([l, c, h]) => {
|
|
186
|
+
if (c < 0) {
|
|
187
|
+
c = 0;
|
|
188
|
+
}
|
|
189
|
+
if (isNaN(h)) {
|
|
190
|
+
h = 0;
|
|
191
|
+
}
|
|
192
|
+
return [l, c * Math.cos((h * Math.PI) / 180), c * Math.sin((h * Math.PI) / 180)];
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Convert OKLab to XYZ relative to D65
|
|
196
|
+
*
|
|
197
|
+
* @param lab
|
|
198
|
+
*/
|
|
199
|
+
const oklab2xyz = (lab) => {
|
|
200
|
+
const LMSg = (0, color_math_1.multiplyMatrices)([
|
|
201
|
+
1, 0.3963377773761749, 0.2158037573099136, 1, -0.1055613458156586, -0.0638541728258133, 1,
|
|
202
|
+
-0.0894841775298119, -1.2914855480194092
|
|
203
|
+
], lab), LMS = LMSg.map((val) => val ** 3);
|
|
204
|
+
return (0, color_math_1.multiplyMatrices)([
|
|
205
|
+
1.2268798758459243, -0.5578149944602171, 0.2813910456659647, -0.0405757452148008, 1.112286803280317,
|
|
206
|
+
-0.0717110580655164, -0.0763729366746601, -0.4214933324022432, 1.5869240198367816
|
|
207
|
+
], LMS);
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Convert Lab to D50-adapted XYZ
|
|
211
|
+
*
|
|
212
|
+
* @param lab
|
|
213
|
+
*/
|
|
214
|
+
const lab2xyz = (lab) => {
|
|
215
|
+
const fy = (lab[0] + 16) / 116, fx = lab[1] / 500 + fy, fz = fy - lab[2] / 200, k = 24389 / 27, e = 24 / 116, xyz = [
|
|
216
|
+
((fx > e ? fx ** 3 : (116 * fx - 16) / k) * 0.3457) / 0.3585,
|
|
217
|
+
lab[0] > 8 ? fy ** 3 : lab[0] / k,
|
|
218
|
+
((fz > e ? fz ** 3 : (116 * fz - 16) / k) * (1.0 - 0.3457 - 0.3585)) / 0.3585
|
|
219
|
+
];
|
|
220
|
+
return (0, exports.d50toD65)([xyz[0], xyz[1], xyz[2]]);
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Convert RGB to XYZ
|
|
224
|
+
*
|
|
225
|
+
* @param _context
|
|
226
|
+
* @param args
|
|
227
|
+
*/
|
|
228
|
+
const rgbToXyz = (_context, args) => {
|
|
229
|
+
const tokens = args.filter(parser_1.nonFunctionArgSeparator);
|
|
230
|
+
if (tokens.length === 3) {
|
|
231
|
+
const [r, g, b] = tokens.map(exports.getTokenColorValue), rgb_linear = (0, srgb_1.rgb2rgbLinear)([r / 255, g / 255, b / 255]), [x, y, z] = (0, srgb_1.rgbLinear2xyz)([rgb_linear[0], rgb_linear[1], rgb_linear[2]]);
|
|
232
|
+
return [x, y, z, 1];
|
|
233
|
+
}
|
|
234
|
+
if (tokens.length === 4) {
|
|
235
|
+
const [r, g, b, a] = tokens.map(exports.getTokenColorValue), rgb_linear = (0, srgb_1.rgb2rgbLinear)([r / 255, g / 255, b / 255]), [x, y, z] = (0, srgb_1.rgbLinear2xyz)([rgb_linear[0], rgb_linear[1], rgb_linear[2]]);
|
|
236
|
+
return [x, y, z, a];
|
|
237
|
+
}
|
|
238
|
+
return [0, 0, 0, 1];
|
|
239
|
+
};
|
|
240
|
+
exports.rgbToXyz = rgbToXyz;
|
|
241
|
+
/**
|
|
242
|
+
* HSL to XYZ
|
|
243
|
+
*
|
|
244
|
+
* @param context
|
|
245
|
+
* @param args
|
|
246
|
+
*/
|
|
247
|
+
const hslToXyz = (context, args) => {
|
|
248
|
+
const [h, s, l, a] = (0, exports.extractHslComponents)(context, args), rgb_linear = (0, srgb_1.rgb2rgbLinear)(hsl2rgb([h, s, l])), [x, y, z] = (0, srgb_1.rgbLinear2xyz)([rgb_linear[0], rgb_linear[1], rgb_linear[2]]);
|
|
249
|
+
return [x, y, z, a];
|
|
250
|
+
};
|
|
251
|
+
exports.hslToXyz = hslToXyz;
|
|
252
|
+
/**
|
|
253
|
+
* LAB to XYZ
|
|
254
|
+
*
|
|
255
|
+
* @param _context
|
|
256
|
+
* @param args
|
|
257
|
+
*/
|
|
258
|
+
const labToXyz = (_context, args) => {
|
|
259
|
+
const [l, a, b, alpha] = (0, exports.extractLabComponents)(args), [x, y, z] = lab2xyz([l, a, b]);
|
|
260
|
+
return [x, y, z, alpha];
|
|
261
|
+
};
|
|
262
|
+
exports.labToXyz = labToXyz;
|
|
263
|
+
/**
|
|
264
|
+
* LCH to XYZ
|
|
265
|
+
*
|
|
266
|
+
* @param _context
|
|
267
|
+
* @param args
|
|
268
|
+
*/
|
|
269
|
+
const lchToXyz = (_context, args) => {
|
|
270
|
+
const [l, c, h, alpha] = (0, exports.extractLchComponents)(args), [x, y, z] = lab2xyz(lch2lab([l, c, h]));
|
|
271
|
+
return [x, y, z, alpha];
|
|
272
|
+
};
|
|
273
|
+
exports.lchToXyz = lchToXyz;
|
|
274
|
+
/**
|
|
275
|
+
* OKLch to XYZ
|
|
276
|
+
*
|
|
277
|
+
* @param _context
|
|
278
|
+
* @param args
|
|
279
|
+
*/
|
|
280
|
+
const oklchToXyz = (_context, args) => {
|
|
281
|
+
const [l, c, h, alpha] = (0, exports.extractOkLchComponents)(args), [x, y, z] = oklab2xyz(lch2lab([l, c, h]));
|
|
282
|
+
return [x, y, z, alpha];
|
|
283
|
+
};
|
|
284
|
+
exports.oklchToXyz = oklchToXyz;
|
|
285
|
+
/**
|
|
286
|
+
* OKLab to XYZ
|
|
287
|
+
*
|
|
288
|
+
* @param _context
|
|
289
|
+
* @param args
|
|
290
|
+
*/
|
|
291
|
+
const oklabToXyz = (_context, args) => {
|
|
292
|
+
const [l, c, h, alpha] = (0, exports.extractLabComponents)(args), [x, y, z] = oklab2xyz([l, c, h]);
|
|
293
|
+
return [x, y, z, alpha];
|
|
294
|
+
};
|
|
295
|
+
exports.oklabToXyz = oklabToXyz;
|
|
296
|
+
/**
|
|
297
|
+
* XYZ-50 to XYZ
|
|
298
|
+
*
|
|
299
|
+
* @param args
|
|
300
|
+
*/
|
|
301
|
+
const xyz50ToXYZ = (args) => {
|
|
302
|
+
return (0, exports.d50toD65)([args[0], args[1], args[2]]);
|
|
303
|
+
};
|
|
304
|
+
exports.xyz50ToXYZ = xyz50ToXYZ;
|
|
305
|
+
/**
|
|
306
|
+
* Does nothing, required for SUPPORTED_COLOR_SPACES_FROM_XYZ in the _color() function
|
|
307
|
+
*
|
|
308
|
+
* @param args
|
|
309
|
+
*/
|
|
310
|
+
const xyzFromXYZ = (args) => {
|
|
311
|
+
return args;
|
|
312
|
+
};
|
|
313
|
+
exports.xyzFromXYZ = xyzFromXYZ;
|
|
314
|
+
/**
|
|
315
|
+
* XYZ-65 to XYZ-50
|
|
316
|
+
*
|
|
317
|
+
* @param args
|
|
318
|
+
*/
|
|
319
|
+
const xyz50FromXYZ = (args) => {
|
|
320
|
+
const [x, y, z] = (0, exports.d65toD50)([args[0], args[2], args[3]]);
|
|
321
|
+
return [x, y, z, args[3]];
|
|
322
|
+
};
|
|
323
|
+
exports.xyz50FromXYZ = xyz50FromXYZ;
|
|
324
|
+
/**
|
|
325
|
+
* Convert XYZ to SRGB and Pack
|
|
326
|
+
*
|
|
327
|
+
* @param args
|
|
328
|
+
*/
|
|
329
|
+
const convertXyz = (args) => {
|
|
330
|
+
return (0, exports.packXYZ)([args[0], args[1], args[2], args[3]]);
|
|
331
|
+
};
|
|
332
|
+
exports.convertXyz = convertXyz;
|
|
333
|
+
/**
|
|
334
|
+
* Convert XYZ-50 to SRGB and Pack
|
|
335
|
+
*
|
|
336
|
+
* @param args
|
|
337
|
+
*/
|
|
338
|
+
const convertXyz50 = (args) => {
|
|
339
|
+
const xyz = (0, exports.xyz50ToXYZ)([args[0], args[1], args[2]]);
|
|
340
|
+
return (0, exports.packXYZ)([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
341
|
+
};
|
|
342
|
+
exports.convertXyz50 = convertXyz50;
|