File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -3508,6 +3508,30 @@ unless trailing zeroes have been omitted.
35083508 }
35093509 </pre>
35103510
3511+ <!--
3512+ ██████ ███████ ████████ ████████
3513+ ██ ██ ██ ██ ██ ██ ██
3514+ ██ ██ ██ ██ ██ ██
3515+ ██ ██ ██ ██ ██ ██████
3516+ ██ ██ ██ ██ ██ ██
3517+ ██ ██ ██ ██ ██ ██ ██
3518+ ██████ ███████ ████████ ████████
3519+ -->
3520+
3521+ <h2 id="color-conversion-code">
3522+ Sample code for Color Conversions</h2>
3523+
3524+ <em> This section is not normative.</em>
3525+
3526+ The naive conversion from device-cmyk is trivial:
3527+
3528+ <pre class="include-code lang-javascript">
3529+ path: naive.js
3530+ highlight: js
3531+ </pre>
3532+
3533+
3534+
35113535<!--
35123536 ██████ ████████ ██████ ██ ██ ████████ ████ ████████ ██ ██
35133537██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
Original file line number Diff line number Diff line change 1+ function naive ( cmyk ) {
2+ // naively convert an array of CMYK values
3+ // to sRGB
4+ let [ cyan , magenta , yellow , black ] = cmyk ;
5+ let red = 1 - Math . min ( 1 , cyan * ( 1 - black ) + black ) ;
6+ let green = 1 - Math . min ( 1 , magenta * ( 1 - black ) + black ) ;
7+ let blue = 1 - Math . min ( 1 , yellow * ( 1 - black ) + black ) ;
8+ return [ red , green , blue ] ;
9+ }
You can’t perform that action at this time.
0 commit comments