diff options
| author | Sébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com> | 2023-12-13 14:35:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-13 14:35:56 +0100 |
| commit | d869a07d2dbdfb5f1952d2d574f6848d21e7f68e (patch) | |
| tree | 60675c24ff8c95244427e3babd2d6c29caee052c /crates/typst-pdf/src/postscript | |
| parent | 077d6b5c5442dc840327567944df64043e42e0a8 (diff) | |
Remove HSV and HSL color spaces from PDF export (#2927)
Co-authored-by: EpicEricEE <github@ericbiedert.de>
Diffstat (limited to 'crates/typst-pdf/src/postscript')
| -rw-r--r-- | crates/typst-pdf/src/postscript/hsl.ps | 63 | ||||
| -rw-r--r-- | crates/typst-pdf/src/postscript/hsv.ps | 62 |
2 files changed, 0 insertions, 125 deletions
diff --git a/crates/typst-pdf/src/postscript/hsl.ps b/crates/typst-pdf/src/postscript/hsl.ps deleted file mode 100644 index 740bc3ed..00000000 --- a/crates/typst-pdf/src/postscript/hsl.ps +++ /dev/null @@ -1,63 +0,0 @@ - -{ - % Starting stack: H, S, L - % /!\ WARNING: The hue component **MUST** be encoded - % in the range [0, 1] before calling this function. - % This is because the function assumes that the - % hue component are divided by a factor of 360 - % in order to meet the range requirements of the - % PDF specification. - - % First we do H = (H * 360.0) % 360 - 3 2 roll 360 mul 3 1 roll - - % Compute C = (1 - |2 * L - 1|) * S - dup 1 exch 2 mul 1 sub abs sub 3 2 roll mul - - % P = (H / 60) % 2 - 3 2 roll dup 60 div 2 - 2 copy div cvi mul exch sub abs - - % X = C * (1 - |P - 1|) - 1 exch 1 sub abs sub 3 2 roll dup 3 1 roll mul - - % Compute m = L - C / 2 - exch dup 2 div 5 4 roll exch sub - - % Rotate so H is top - 4 3 roll exch 4 1 roll - - % Construct the RGB stack - dup 60 lt { - % We need to build: (C, X, 0) - pop 0 3 1 roll - } { - dup 120 lt { - % We need to build: (X, C, 0) - pop exch 0 3 1 roll - } { - dup 180 lt { - % We need to build: (0, C, X) - pop 0 - } { - dup 240 lt { - % We need to build: (0, X, C) - pop exch 0 - } { - 300 lt { - % We need to build: (X, 0, C) - 0 3 2 roll - } { - % We need to build: (C, 0, X) - 0 exch - } ifelse - } ifelse - } ifelse - } ifelse - } ifelse - - 4 3 roll - - % Add m to each component - dup dup 6 2 roll add 5 2 roll add exch 4 3 roll add exch -}
\ No newline at end of file diff --git a/crates/typst-pdf/src/postscript/hsv.ps b/crates/typst-pdf/src/postscript/hsv.ps deleted file mode 100644 index b29adf11..00000000 --- a/crates/typst-pdf/src/postscript/hsv.ps +++ /dev/null @@ -1,62 +0,0 @@ -{ - % Starting stack: H, S, V - % /!\ WARNING: The hue component **MUST** be encoded - % in the range [0, 1] before calling this function. - % This is because the function assumes that the - % hue component are divided by a factor of 360 - % in order to meet the range requirements of the - % PDF specification. - - % First we do H = (H * 360.0) % 360 - 3 2 roll 360 mul 3 1 roll - - % Compute C = V * S - dup 3 1 roll mul - - % P = (H / 60) % 2 - 3 2 roll dup 60 div 2 - 2 copy div cvi mul exch sub abs - - % X = C * (1 - |P - 1|) - 1 exch 1 sub abs sub 3 2 roll dup 3 1 roll mul - - % Compute m = V - C - exch dup 5 4 roll exch sub - - % Rotate so H is top - 4 3 roll exch 4 1 roll - - % Construct the RGB stack - dup 60 lt { - % We need to build: (C, X, 0) - pop 0 3 1 roll - } { - dup 120 lt { - % We need to build: (X, C, 0) - pop exch 0 3 1 roll - } { - dup 180 lt { - % We need to build: (0, C, X) - pop 0 - } { - dup 240 lt { - % We need to build: (0, X, C) - pop exch 0 - } { - 300 lt { - % We need to build: (X, 0, C) - 0 3 2 roll - } { - % We need to build: (C, 0, X) - 0 exch - } ifelse - } ifelse - } ifelse - } ifelse - } ifelse - - 4 3 roll - - % Add m to each component - dup dup 6 2 roll add 5 2 roll add exch 4 3 roll add exch -}
\ No newline at end of file |
