Skip to content

Commit 422e3bf

Browse files
authored
Merge pull request #12 from lehins/apply-luma
Apply luma
2 parents a91cb90 + 5681ca4 commit 422e3bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1003
-176
lines changed

.github/workflows/haskell.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ jobs:
209209
if: steps.install-doctest.outcome == 'success'
210210
run: |
211211
set -ex
212-
cabal repl Color --build-depends=QuickCheck --build-depends=JuicyPixels --build-depends=QuickCheck --with-compiler=doctest --repl-options='-w -Wdefault'
212+
./scripts/doctest.sh
213213
214214
- name: Check Cabal Files
215215
run: |

Color/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog for Color
22

3+
## 0.4.0
4+
5+
* Addition of `DIN99` color space.
6+
* Scale `L*a*b*` color space to `[0, 1]` range from the more common `[0, 100]` for
7+
consistency.
8+
* Addition of: `toGrayscale`, `applyGrayscale` and `replaceGrayscale`.
9+
* Addition of: `ChannelCount`, `channelCount`, `channelNames` and `channelColors`
10+
* Remove `RealFloat` constraint from `ColorSpace` for `Y'`
11+
312
## 0.3.3
413

514
Addition of `SVG` colors

Color/Color.cabal

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: Color
2-
version: 0.3.3
2+
version: 0.4.0
33
synopsis: Color spaces and conversions between them
44
description: Please see the README on GitHub at <https://github.com/lehins/Color#readme>
55
homepage: https://github.com/lehins/Color
66
license: BSD3
77
license-file: LICENSE
88
author: Alexey Kuleshevich
99
maintainer: [email protected]
10-
copyright: 2019-2021 Alexey Kuleshevich
10+
copyright: 2019-2025 Alexey Kuleshevich
1111
category: Graphics
1212
extra-source-files: README.md
1313
, CHANGELOG.md
@@ -182,6 +182,19 @@ benchmark conversion
182182
, random
183183
default-language: Haskell2010
184184

185+
benchmark ycbcr
186+
type: exitcode-stdio-1.0
187+
hs-source-dirs: bench
188+
main-is: YCbCr.hs
189+
ghc-options: -Wall
190+
-threaded
191+
-O2
192+
build-depends: base
193+
, criterion
194+
, Color
195+
, deepseq
196+
default-language: Haskell2010
197+
185198
source-repository head
186199
type: git
187200
location: https://github.com/lehins/Color

Color/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright Alexey Kuleshevich (c) 2019-2020
1+
Copyright Alexey Kuleshevich (c) 2019-2025
22

33
All rights reserved.
44

Color/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Currently supported:
3838
* `Y'` - luma
3939
* `CIE XYZ`
4040
* `CIE L*a*b*`
41+
* `DIN99`
4142
* `RGB`:
4243

4344
* `sRGB` - both standardized and derived

Color/bench/YCbCr.hs

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{-# LANGUAGE DataKinds #-}
2+
{-# LANGUAGE PolyKinds #-}
3+
{-# LANGUAGE FlexibleContexts #-}
4+
{-# LANGUAGE ScopedTypeVariables #-}
5+
module Main where
6+
7+
import Criterion.Main
8+
import Control.DeepSeq
9+
import qualified Graphics.Color.Model as CM
10+
import Graphics.Color.Space
11+
import Graphics.Color.Space.RGB.ITU.Rec601
12+
import Graphics.Color.Space.RGB.ITU.Rec709
13+
import Data.Coerce
14+
15+
main :: IO ()
16+
main = do
17+
defaultMain
18+
[ bgroup
19+
"toYCbCr"
20+
[ toYCbCrBench (CM.ColorRGB 0.1 0.2 0.3 :: Color CM.RGB Float) "Float"
21+
, toYCbCrBench (CM.ColorRGB 0.1 0.2 0.3 :: Color CM.RGB Double) "Double"
22+
]
23+
, bgroup
24+
"fromYCbCr"
25+
[ fromYCbCrBench (CM.ColorYCbCr 0.1 0.2 0.3 :: Color CM.YCbCr Float) "Float"
26+
, fromYCbCrBench (CM.ColorYCbCr 0.1 0.2 0.3 :: Color CM.YCbCr Double) "Double"
27+
]
28+
]
29+
30+
31+
toYCbCrBench ::
32+
forall e. (Elevator e, NFData e)
33+
=> Color CM.RGB e
34+
-> String
35+
-> Benchmark
36+
toYCbCrBench rgb tyName =
37+
bgroup
38+
tyName
39+
[ bgroup
40+
"Standard"
41+
[ bench "SRGB" $
42+
nf (fromBaseSpace :: Color (SRGB 'NonLinear) e -> Color (Y'CbCr SRGB) e) (mkColorRGB rgb)
43+
, bench "Rec601" $
44+
nf
45+
(fromBaseSpace :: Color (BT601_625 'NonLinear) e -> Color (Y'CbCr BT601_625) e)
46+
(mkColorRGB rgb)
47+
, bench "Rec709" $
48+
nf (fromBaseSpace :: Color (BT709 'NonLinear) e -> Color (Y'CbCr BT709) e) (mkColorRGB rgb)
49+
]
50+
]
51+
52+
fromYCbCrBench ::
53+
forall e. (Elevator e, NFData e)
54+
=> Color CM.YCbCr e
55+
-> String
56+
-> Benchmark
57+
fromYCbCrBench ycbcr tyName =
58+
bgroup
59+
tyName
60+
[ bgroup
61+
"Standard"
62+
[ bench "SRGB" $
63+
nf (toBaseSpace :: Color (Y'CbCr SRGB) e -> Color (SRGB 'NonLinear) e) (coerce ycbcr)
64+
, bench "Rec601" $
65+
nf
66+
(toBaseSpace :: Color (Y'CbCr BT601_625) e -> Color (BT601_625 'NonLinear) e)
67+
(coerce ycbcr)
68+
, bench "Rec709" $
69+
nf (toBaseSpace :: Color (Y'CbCr BT709) e -> Color (BT709 'NonLinear) e) (coerce ycbcr)
70+
]
71+
]

Color/src/Graphics/Color/Adaptation.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- |
22
-- Module : Graphics.Color.Adaptation
3-
-- Copyright : (c) Alexey Kuleshevich 2019-2020
3+
-- Copyright : (c) Alexey Kuleshevich 2019-2025
44
-- License : BSD3
55
-- Maintainer : Alexey Kuleshevich <[email protected]>
66
-- Stability : experimental

Color/src/Graphics/Color/Adaptation/Internal.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{-# LANGUAGE TypeOperators #-}
88
-- |
99
-- Module : Graphics.Color.Adaptation.Internal
10-
-- Copyright : (c) Alexey Kuleshevich 2019-2020
10+
-- Copyright : (c) Alexey Kuleshevich 2019-2025
1111
-- License : BSD3
1212
-- Maintainer : Alexey Kuleshevich <[email protected]>
1313
-- Stability : experimental

Color/src/Graphics/Color/Adaptation/VonKries.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#endif
1515
-- |
1616
-- Module : Graphics.Color.Adaptation.VonKries
17-
-- Copyright : (c) Alexey Kuleshevich 2018-2020
17+
-- Copyright : (c) Alexey Kuleshevich 2018-2025
1818
-- License : BSD3
1919
-- Maintainer : Alexey Kuleshevich <[email protected]>
2020
-- Stability : experimental

Color/src/Graphics/Color/Algebra.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{-# LANGUAGE ScopedTypeVariables #-}
55
-- |
66
-- Module : Graphics.Color.Algebra
7-
-- Copyright : (c) Alexey Kuleshevich 2019-2020
7+
-- Copyright : (c) Alexey Kuleshevich 2019-2025
88
-- License : BSD3
99
-- Maintainer : Alexey Kuleshevich <[email protected]>
1010
-- Stability : experimental

0 commit comments

Comments
 (0)