diff options
author | Mark Oteiza <mvoteiza@udel.edu> | 2017-09-26 17:13:36 -0400 |
---|---|---|
committer | Mark Oteiza <mvoteiza@udel.edu> | 2017-09-30 08:00:53 -0400 |
commit | 645ff6c7029daef082b3a558407121207fa64ff5 (patch) | |
tree | 2a19d973cdb446169347fb3b7848ce753a8cac51 /test/src/lcms-tests.el | |
parent | 157007b58e41afc848f79c99aced0f09109dfdac (diff) | |
download | emacs-645ff6c7029daef082b3a558407121207fa64ff5.tar.gz emacs-645ff6c7029daef082b3a558407121207fa64ff5.tar.bz2 emacs-645ff6c7029daef082b3a558407121207fa64ff5.zip |
Add CAM02 JCh and CAM02-UCS J'a'b' conversions
* src/lcms.c (rad2deg, parse_jch_list, parse_jab_list, xyz_to_jch):
(jch_to_xyz, jch_to_jab, jab_to_jch): New functions.
(lcms-jch->xyz, lcms-jch->xyz, lcms-jch->jab, lcms-jab->jch): New Lisp
functions.
(lcms-cam02-ucs): Refactor.
(syms_of_lcms2): Declare new functions.
* test/src/lcms-tests.el (lcms-roundtrip, lcms-ciecam02-gold):
(lcms-jmh->cam02-ucs-silver): New tests.
* etc/NEWS: Mention new functions.
Diffstat (limited to 'test/src/lcms-tests.el')
-rw-r--r-- | test/src/lcms-tests.el | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/src/lcms-tests.el b/test/src/lcms-tests.el index d6d1d16b9ad..cc324af68ba 100644 --- a/test/src/lcms-tests.el +++ b/test/src/lcms-tests.el @@ -94,6 +94,38 @@ B is considered the exact value." (apply #'color-xyz-to-xyy (lcms-temp->white-point 7504)) '(0.29902 0.31485 1.0)))) +(ert-deftest lcms-roundtrip () + "Test accuracy of converting to and from different color spaces" + (skip-unless (featurep 'lcms2)) + (should + (let ((color '(.5 .3 .7))) + (lcms-triple-approx-p (lcms-jch->xyz (lcms-xyz->jch color)) + color + 0.0001))) + (should + (let ((color '(.8 -.2 .2))) + (lcms-triple-approx-p (lcms-jch->jab (lcms-jab->jch color)) + color + 0.0001)))) + +(ert-deftest lcms-ciecam02-gold () + "Test CIE CAM02 JCh gold values" + (skip-unless (featurep 'lcms2)) + (should + (lcms-triple-approx-p + (lcms-xyz->jch '(0.1931 0.2393 0.1014) + '(0.9888 0.900 0.3203) + '(18 200 1 1.0)) + '(48.0314 38.7789 191.0452) + 0.02)) + (should + (lcms-triple-approx-p + (lcms-xyz->jch '(0.1931 0.2393 0.1014) + '(0.9888 0.90 0.3203) + '(18 20 1 1.0)) + '(47.6856 36.0527 185.3445) + 0.09))) + (ert-deftest lcms-dE-cam02-ucs-silver () "Test CRI-CAM02-UCS deltaE metric values from colorspacious." (skip-unless (featurep 'lcms2)) @@ -114,4 +146,16 @@ B is considered the exact value." 8.503323264883667 0.04))) +(ert-deftest lcms-jmh->cam02-ucs-silver () + "Compare JCh conversion to CAM02-UCS to values from colorspacious." + (skip-unless (featurep 'lcms2)) + (should + (lcms-triple-approx-p (lcms-jch->jab '(50 20 10)) + '(62.96296296 16.22742674 2.86133316) + 0.05)) + (should + (lcms-triple-approx-p (lcms-jch->jab '(10 60 100)) + '(15.88785047 -6.56546789 37.23461867) + 0.04))) + ;;; lcms-tests.el ends here |