dufy

API Reference

dufy

Color library for Common Lisp

No packages.

dufy-core

DUFY.PACKAGE.DEF.CORE

No exported symbols.

DUFY-CORE

  • Function XYY-TO-XYZ (small-x small-y y)
    xyY to XYZ. The nominal range of Y is [0, 1], though all real values are accepted.
  • Function XYZ-TO-XYY (x y z)
    XYZ to xyY. The nominal range of Y is [0, 1], though all real values are accepted.
  • Function GEN-SPECTRUM (spectrum-seq &optional (begin-wl 360) (end-wl 830))
    A spectrum is just a function which receives a real number as wavelength (nm) and returns a double-float. GEN-SPECTRUM returns a spectral power distribution function, #'(lambda (wavelength-nm) ...), which interpolates SPECTRUM-SEQ linearly. Note: SPECTRUM-SEQ must be a sequence of double-float. If the type of SPECTRUM-SEQ is (simple-array double-float (*)), it is not copied but referenced, otherwise it is copied by (coerce spectrum-seq '(simple-array double-float (*))).
  • Function APPROXIMATE-SPECTRUM (spectrum &optional (begin-wl 360.0d0) (end-wl 830.0d0) (band 1.0d0))
    Generates an approximate spectrum of SPECTRUM by pieacewise linearization. It is used to lighten a "heavy" spectrum function.
  • Struct OBSERVER
    OBSERVER is a structure of color matching functions.
    BEGIN-WL
    END-WL
    CMF-ARR
    CMF-X
    CMF-Y
    CMF-Z
    CMF
  • Function OBSERVER-BEGIN-WL (instance)
  • Function (setf OBSERVER-BEGIN-WL) (value instance)
  • Function OBSERVER-END-WL (instance)
  • Function (setf OBSERVER-END-WL) (value instance)
  • Function OBSERVER-CMF-ARR (instance)
  • Function (setf OBSERVER-CMF-ARR) (value instance)
  • Function OBSERVER-CMF-X (instance)
  • Function (setf OBSERVER-CMF-X) (value instance)
  • Function OBSERVER-CMF-Y (instance)
  • Function (setf OBSERVER-CMF-Y) (value instance)
  • Function OBSERVER-CMF-Z (instance)
  • Function (setf OBSERVER-CMF-Z) (value instance)
  • Function OBSERVER-CMF (instance)
  • Function (setf OBSERVER-CMF) (value instance)
  • Function MAKE-OBSERVER (cmf-arr &optional (begin-wl 360) (end-wl 830))
    Generates an observer based on CMF arrays, which must be (SIMPLE-ARRAY DOUBLE-FLOAT (* 3)).
  • Variable +OBS-CIE1931+
    (dufy-core:make-observer dufy-core::cmf-arr-cie1931)
    CIE 1931 Standard Colorimetric Observer (2-degree).
  • Variable +OBS-CIE1964+
    (dufy-core:make-observer dufy-core::cmf-arr-cie1964)
    CIE 1964 Standard Colorimetric Observer (10-degree).
  • Function GEN-ILLUM-D-SPECTRUM (temperature &key rectify)
    Generates the spectrum of the illuminant series D for a given temperature. If RECTIFY is t, the temperature multiplied by (/ 1.43880 1.438) is used instead. (roughly 6504K for 6500K, etc.)
  • Function SPECTRUM-SUM (spectrum &optional (begin-wl 300) (end-wl 830) (band 1))
  • Function BB-SPECTRUM (wavelength-nm &optional (temperature 5000.0d0))
    Spectrum function of a blackbody, which is not normalized.
  • Function OPTIMAL-SPECTRUM1 (wavelength-nm &optional (wl1 300.0d0) (wl2 830.0d0))
    Spectrum function of optimal colors: f(x) = 1d0 if wl1 <= x <= wl2, f(x) = 0d0 otherwise.
  • Function OPTIMAL-SPECTRUM2 (wavelength-nm &optional (wl1 300.0d0) (wl2 830.0d0))
    Spectrum function of optimal colors: f(x) = 1d0 if x <=wl2 or wl1 <= x, f(x) = 0d0 otherwise.
  • Function FLAT-SPECTRUM (wavelength-nm)
    (constantly 1d0)
  • Struct ILLUMINANT
    X
    Z
    SPECTRUM
    OBSERVER
    TO-SPECTRUM-MATRIX
  • Function ILLUMINANT-X (instance)
  • Function (setf ILLUMINANT-X) (value instance)
  • Function ILLUMINANT-Z (instance)
  • Function (setf ILLUMINANT-Z) (value instance)
  • Function ILLUMINANT-SPECTRUM (instance)
  • Function (setf ILLUMINANT-SPECTRUM) (value instance)
  • Function ILLUMINANT-OBSERVER (instance)
  • Function (setf ILLUMINANT-OBSERVER) (value instance)
  • Function ILLUMINANT-XY (illuminant)
    Returns the xy chromacity coordinates of the given illuminant.
  • Condition NO-SPD-ERROR  (SIMPLE-ERROR)
  • Variable +ILLUM-D65+
  • Variable +ILLUM-C+
  • Function SPECTRUM-TO-XYZ (spectrum &key (illuminant +illum-d65+) (begin-wl 360) (end-wl 830) (band 1))
  • Function XYZ-TO-SPECTRUM (x y z &key (illuminant +illum-d65+))
    Converts XYZ to spectrum, which is, of course, a spectrum among many and may contain a negative spectral density.
  • Function MAKE-ILLUMINANT (&key x z spectrum (observer +obs-cie1931+) (compile-time nil))
    Generates an illuminant with an SPD. Although the white point (X, 1d0, Z) is automatically calculated if X and Z are nil, you can designate X and Z explicitly. Note that no error occurs, even if the given white point and SPD contradicts to each other. (make-illuminant :x 1.0 :z 1.0 :spectrum #'flat-spectrum) (make-illuminant :spectrum #'flat-spectrum) ;; => almost same illuminants If X and Y are NIL and COMPILE-TIME is T, the white point is calculated at compile time.
  • Variable +ILLUM-A+
    (dufy-core:make-illuminant :spectrum
                               #'(lambda (dufy-core::wl)
                                   (declare (optimize (speed 3) (safety 1)))
                                   (let ((dufy-core::wl
                                          (float dufy-core::wl 1.0d0)))
                                     (check-type dufy-core::wl
                                                 (double-float 0.0d0))
                                     (* 100.0d0 (expt (/ 560.0d0 dufy-core::wl) 5)
                                        (/ 8082.19209556661d0
                                           (-
                                            (exp
                                             (/ 1.435d7
                                                (* 2848.0d0 dufy-core::wl)))
                                            1.0d0)))))
                               :compile-time t)
  • Variable +ILLUM-C+
    (dufy-core:make-illuminant :x 0.980705971659919d0 :z 1.1822494939271255d0
                               :spectrum
                               (dufy-core:gen-spectrum dufy-core::+illum-c-arr+ 300
                                                       830))
  • Variable +ILLUM-D50+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-illum-d-spectrum 5000 :rectify t)
                               :compile-time t)
  • Variable +ILLUM-D65+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-illum-d-spectrum 6500 :rectify t)
                               :compile-time t)
  • Variable +ILLUM-E+
    (dufy-core:make-illuminant :x 1.0d0 :z 1.0d0 :spectrum
                               #'dufy-core:flat-spectrum)
  • Function GEN-LINEARIZER (gamma)
    Returns a linearization function for a given gamma value. You shouldn't call the returned function on your own, as it is not safe.
  • Function GEN-DELINEARIZER (gamma)
    Returns a gamma-correction function for a given gamma value. You shouldn't call the returned function on your own, as it is not safe.
  • Struct RGBSPACE
    Structure of RGB space, including encoding characteristics
    XR
    YR
    XG
    YG
    XB
    YB
    ILLUMINANT
    TO-XYZ-MATRIX
    FROM-XYZ-MATRIX
    LMIN
    LMAX
    LINEARIZER
    DELINEARIZER
    MIN
    MAX
    LENGTH
    /LENGTH
    NORMAL
    BIT-PER-CHANNEL
    QMAX
    QMAX-FLOAT
    LENGTH/QMAX-FLOAT
    QMAX-FLOAT/LENGTH
  • Function RGBSPACE-XR (instance)
  • Function (setf RGBSPACE-XR) (value instance)
  • Function RGBSPACE-YR (instance)
  • Function (setf RGBSPACE-YR) (value instance)
  • Function RGBSPACE-XG (instance)
  • Function (setf RGBSPACE-XG) (value instance)
  • Function RGBSPACE-YG (instance)
  • Function (setf RGBSPACE-YG) (value instance)
  • Function RGBSPACE-XB (instance)
  • Function (setf RGBSPACE-XB) (value instance)
  • Function RGBSPACE-YB (instance)
  • Function (setf RGBSPACE-YB) (value instance)
  • Function RGBSPACE-ILLUMINANT (instance)
  • Function (setf RGBSPACE-ILLUMINANT) (value instance)
  • Function RGBSPACE-TO-XYZ-MATRIX (instance)
  • Function (setf RGBSPACE-TO-XYZ-MATRIX) (value instance)
  • Function RGBSPACE-FROM-XYZ-MATRIX (instance)
  • Function (setf RGBSPACE-FROM-XYZ-MATRIX) (value instance)
  • Function RGBSPACE-LMIN (instance)
  • Function (setf RGBSPACE-LMIN) (value instance)
  • Function RGBSPACE-LMAX (instance)
  • Function (setf RGBSPACE-LMAX) (value instance)
  • Function RGBSPACE-MIN (instance)
  • Function (setf RGBSPACE-MIN) (value instance)
  • Function RGBSPACE-MAX (instance)
  • Function (setf RGBSPACE-MAX) (value instance)
  • Function RGBSPACE-NORMAL (instance)
  • Function (setf RGBSPACE-NORMAL) (value instance)
  • Function RGBSPACE-BIT-PER-CHANNEL (instance)
  • Function (setf RGBSPACE-BIT-PER-CHANNEL) (value instance)
  • Function RGBSPACE-QMAX (instance)
  • Function (setf RGBSPACE-QMAX) (value instance)
  • Function MAKE-RGBSPACE (xr yr xg yg xb yb &key (illuminant +illum-d65+) (lmin 0.0d0) (lmax 1.0d0) (linearizer (rcurry #'float 1.0d0)) (delinearizer (rcurry #'float 1.0d0)) (bit-per-channel 8) (force-normal nil))
    xr, yr, xg, yg, xb, yb: primary coordinates in the xy plane. [lmin, lmax] := range of linear values ([0, 1] typically). LINEARIZER and DELINEARIZER must be (FUNCTION * DOUBLE-FLOAT). If FORCE-NORMAL is T, the nominal range of gamma-corrected value is forcibly set to [0, 1].
  • Variable +SRGB+
  • Function XYZ-TO-LRGB (x y z &key (rgbspace +srgb+))
  • Function LRGB-TO-XYZ (lr lg lb &key (rgbspace +srgb+))
  • Function LRGB-OUT-OF-GAMUT-P (lr lg lb &key (rgbspace +srgb+) (threshold 1.d-4))
  • Function LINEARIZE (x &key (rgbspace +srgb+))
  • Function DELINEARIZE (x &key (rgbspace +srgb+))
  • Function LRGB-TO-RGB (lr lg lb &key (rgbspace +srgb+))
  • Function RGB-TO-LRGB (r g b &key (rgbspace +srgb+))
  • Function RGB-OUT-OF-GAMUT-P (r g b &key (rgbspace +srgb+) (threshold 1.d-4))
    Returns true, if at least one of R, G and B is outside the interval [RGBSPACE-MIN - THRESHOLD, RGBSPACE-MAX + THRESHOLD]
  • Function XYZ-TO-RGB (x y z &key (rgbspace +srgb+))
  • Function RGB-TO-XYZ (r g b &key (rgbspace +srgb+))
  • Function QRGB-OUT-OF-GAMUT-P (qr qg qb &key (rgbspace +srgb+) (threshold 0))
  • Function QUANTIZE (x &key (rgbspace +srgb+) (clamp t))
    RGB value to QRGB value
  • Function DEQUANTIZE (n &key (rgbspace +srgb+))
    QRGB value to RGB value
  • Function RGB-TO-QRGB (r g b &key (rgbspace +srgb+) (clamp t))
    Quantizes RGB values from [RGBSPACE-MIN, RGBSPACE-MAX] ([0, 1], typically) to {0, 1, ..., RGBSPACE-QMAX} ({0, 1, ..., 255}, typically), though it accepts all the real values.
  • Function QRGB-TO-RGB (qr qg qb &key (rgbspace +srgb+))
  • Function LRGB-TO-QRGB (lr lg lb &key (rgbspace +srgb+) (clamp t))
  • Function QRGB-TO-LRGB (qr qg qb &key (rgbspace +srgb+))
  • Function XYZ-TO-QRGB (x y z &key (rgbspace +srgb+) (clamp t))
  • Function QRGB-TO-XYZ (qr qg qb &key (rgbspace +srgb+))
  • Function QRGB-TO-INT (qr qg qb &key (rgbspace +srgb+))
  • Function INT-TO-QRGB (int &key (rgbspace +srgb+))
  • Function INT-TO-RGB (int &key (rgbspace +srgb+))
  • Function RGB-TO-INT (r g b &key (rgbspace +srgb+))
  • Function INT-TO-LRGB (int &key (rgbspace +srgb+))
  • Function LRGB-TO-INT (lr lg lb &key (rgbspace +srgb+))
  • Function INT-TO-XYZ (int &key (rgbspace +srgb+))
  • Function XYZ-TO-INT (x y z &key (rgbspace +srgb+))
  • Function HSV-TO-RGB (hue sat val &key (rgbspace +srgb+))
    HUE is in the circle group R/360. The nominal range of SAT and VAL is [0, 1]; all the real values outside the interval are also acceptable.
  • Function HSV-TO-QRGB (hue sat val &key (rgbspace +srgb+) (clamp t))
  • Function HSV-TO-XYZ (hue sat val &key (rgbspace +srgb+))
  • Function RGB-TO-HSV (r g b &key (rgbspace +srgb+))
  • Function QRGB-TO-HSV (qr qg qb &key (rgbspace +srgb+))
  • Function XYZ-TO-HSV (x y z &key (rgbspace +srgb+))
  • Function HSL-TO-RGB (hue sat lum &key (rgbspace +srgb+))
    HUE is in the circle group R/360. The nominal range of SAT and LUM is [0, 1]; all the real values outside the interval are also acceptable.
  • Function HSL-TO-QRGB (hue sat lum &key (rgbspace +srgb+) (clamp t))
  • Function HSL-TO-XYZ (hue sat lum &key (rgbspace +srgb+))
  • Function RGB-TO-HSL (r g b &key (rgbspace +srgb+))
  • Function QRGB-TO-HSL (qr qg qb &key (rgbspace +srgb+))
  • Function XYZ-TO-HSL (x y z &key (rgbspace +srgb+))
  • Function XYZ-TO-LAB (x y z &key (illuminant +illum-d65+))
  • Function LAB-TO-XYZ (lstar astar bstar &key (illuminant +illum-d65+))
  • Function LSTAR-TO-Y (lstar)
  • Function LAB-TO-LCHAB (lstar astar bstar)
  • Function LCHAB-TO-LAB (lstar cstarab hab)
  • Function XYZ-TO-LCHAB (x y z &key (illuminant +illum-d65+))
  • Function LCHAB-TO-XYZ (lstar cstarab hab &key (illuminant +illum-d65+))
  • Function XYZ-TO-LUV (x y z &key (illuminant +illum-d65+))
  • Function LUV-TO-XYZ (lstar ustar vstar &key (illuminant +illum-d65+))
  • Function LUV-TO-LCHUV (lstar ustar vstar)
  • Function LCHUV-TO-LUV (lstar cstaruv huv)
  • Function XYZ-TO-LCHUV (x y z &key (illuminant +illum-d65+))
  • Function LCHUV-TO-XYZ (lstar cstaruv huv &key (illuminant +illum-d65+))
  • Struct CAT
    Model of chromatic adaptation transformation. Currently only linear models are available.
    MATRIX
    INV-MATRIX
  • Function CAT-MATRIX (instance)
  • Function (setf CAT-MATRIX) (value instance)
  • Function CAT-INV-MATRIX (instance)
  • Function (setf CAT-INV-MATRIX) (value instance)
  • Function MAKE-CAT (mat)
    Generates a (linear) CAT model by a 3*3 matrix.
  • Variable +BRADFORD+
    (dufy-core:make-cat
     '((0.8951d0 0.2664d0 -0.1614d0) (-0.7502d0 1.7135d0 0.0367d0)
       (0.0389d0 -0.0685d0 1.0296d0)))
  • Variable +XYZ-SCALING+
    (dufy-core:make-cat
     '((1.0d0 0.0d0 0.0d0) (0.0d0 1.0d0 0.0d0) (0.0d0 0.0d0 1.0d0)))
  • Variable +VON-KRIES+
    (dufy-core:make-cat
     '((0.4002d0 0.7076d0 -0.0808d0) (-0.2263d0 1.1653d0 0.0457d0)
       (0.0d0 0.0d0 0.9182d0)))
  • Variable +CMCCAT97+
    (dufy-core:make-cat
     '((0.8951d0 -0.7502d0 0.0389d0) (0.2664d0 1.7135d0 0.0685d0)
       (-0.1614d0 0.0367d0 1.0296d0)))
  • Variable +CMCCAT2000+
    (dufy-core:make-cat
     '((0.7982d0 0.3389d0 -0.1371d0) (-0.5918d0 1.5512d0 0.0406d0)
       (8.d-4 0.0239d0 0.9753d0)))
  • Variable +CAT97S-REVISED+
    (dufy-core:make-cat
     '((0.8562d0 0.3372d0 -0.1934d0) (-0.836d0 1.8327d0 0.0033d0)
       (0.0357d0 -0.0469d0 1.0112d0)))
    Fairchild, Mark D. (2001)."A Revision of CIECAM97s for Practical Applications" http://rit-mcsl.org/fairchild//PDFs/PAP10.pdf
  • Variable +CAT02+
    (dufy-core:make-cat
     '((0.7328d0 0.4296d0 -0.1624d0) (-0.7036d0 1.6975d0 0.0061d0)
       (0.003d0 0.0136d0 0.9834d0)))
    Note that the CAT function returned by (gen-cat-function illum-foo illum-bar :cat +cat02+) is different from the one in CIECAM02.
  • Function XYZ-TO-LMS (x y z &key (illuminant +illum-d65+) (cat +bradford+))
    If ILLUMINANT is NIL, the transform is virtually equivalent to that of illuminant E.
  • Function LMS-TO-XYZ (l m s &key (illuminant +illum-d65+) (cat +bradford+))
    If ILLUMINANT is NIL, the transform is virtually equivalent to that of illuminant E.
  • Function GEN-CAT-FUNCTION (from-illuminant to-illuminant &key (cat +bradford+) (target :xyz))
    Returns a chromatic adaptation function. An example for xyY spaces: > (funcall (gen-cat-function +illum-a+ +illum-e+ :target :xyy) 0.44757 0.40745 1) => 0.3333333257806802d0 0.33333331733957294d0 1.0000000029690765d0 ; transforms white point TARGET can be :XYZ, :XYY, :LAB, :LUV, :LCHAB or :LCHUV. If you want to choose RGB as target, you should use GEN-RGBSPACE-CHANGER instead.
  • Macro DEFINE-CAT-FUNCTION (name from-illuminant to-illuminant &key (cat +bradford+) (target :xyz))
    DEFINE-macro of GEN-CAT-FUNCTION. (define-cat-function d65-to-e +illum-d65+ +illum-e+ :target :xyz) (d65-to-e 0.9504d0 1.0d0 1.0889d0) => 0.9999700272441295d0 0.999998887365445d0 0.9999997282885571d0 TARGET can be :XYZ, :XYY, :LAB, :LUV, :LCHAB or :LCHUV.
  • Function GEN-RGBSPACE-CHANGER (from-rgbspace to-rgbspace &key (target :lrgb) (cat +bradford+))
    Returns a function for changing RGB working space. (funcall (gen-rgbspace-changer +srgb+ +adobe+ :target :rgb) 0 1 0) ;; => 0.5649506908657044d0 ;; 1.0d0 ;; 0.2344342037422755d0 ;; change from sRGB to Adobe RGB. TARGET can be :LRGB, :RGB, :QRGB or :INT. Note about clamping: LRGB case: no clamping; RGB case: no clamping; QRGB case: with clamping; INT case: with clamping.
  • Function COPY-RGBSPACE (rgbspace &key (illuminant nil) (bit-per-channel nil) (cat +bradford+))
    Returns a new RGBSPACE with different standard illuminant and/or bit-per-channel. All the parameters are properly recalculated. If both are nil, it is just a copier.
  • Variable +SRGB+
    (dufy-core:make-rgbspace 0.64d0 0.33d0 0.3d0 0.6d0 0.15d0 0.06d0 :linearizer
                             #'dufy-core::linearize-srgb :delinearizer
                             #'dufy-core::delinearize-srgb :force-normal t)
    sRGB, 8-bit per channel
  • Variable +BG-SRGB-10+
    (dufy-core:make-rgbspace 0.64d0 0.33d0 0.3d0 0.6d0 0.15d0 0.06d0 :linearizer
                             #'dufy-core::linearize-srgb :delinearizer
                             #'dufy-core::delinearize-srgb :lmin -0.53d0 :lmax
                             1.68d0 :bit-per-channel 10)
    bg-sRGB, 10-bit per channel http://www.color.org/chardata/rgb/bgsrgb.xalter
  • Variable +BG-SRGB-12+
    (dufy-core:copy-rgbspace dufy-core:+bg-srgb-10+ :bit-per-channel 12)
    bg-sRGB, 12-bit per channel, http://www.color.org/chardata/rgb/bgsrgb.xalter
  • Variable +BG-SRGB-16+
    (dufy-core:copy-rgbspace dufy-core:+bg-srgb-10+ :bit-per-channel 16)
    bg-sRGB, 16-bit per channel, http://www.color.org/chardata/rgb/bgsrgb.xalter
  • Variable +SCRGB-16+
    (dufy-core:make-rgbspace 0.64d0 0.33d0 0.3d0 0.6d0 0.15d0 0.06d0 :lmin -0.5d0
                             :lmax 7.4999d0 :bit-per-channel 16)
    scRGB(16), IEC 61966-2-2:2003 http://www.color.org/chardata/rgb/scrgb.xalter
  • Variable +SCRGB-NL+
    (dufy-core:make-rgbspace 0.64d0 0.33d0 0.3d0 0.6d0 0.15d0 0.06d0 :lmin
                             -0.6038d0 :lmax 7.5913d0 :linearizer
                             #'dufy-core::linearize-scrgb-nl :delinearizer
                             #'dufy-core::delinearize-scrgb-nl :bit-per-channel 12)
    scRGB-nl, IEC 61966-2-2:2003 http://www.color.org/chardata/rgb/scrgb-nl.xalter
  • Variable +CIE-RGB+
    (dufy-core:make-rgbspace 0.7347d0 0.2653d0 0.2738d0 0.7174d0 0.1666d0 0.0089d0
                             :illuminant dufy-core:+illum-e+)
    CIE RGB (1931), no gamma-correction, 8-bit per channel.
  • Variable +ADOBE+
    (dufy-core:make-rgbspace 0.64d0 0.33d0 0.21d0 0.71d0 0.15d0 0.06d0 :linearizer
                             (dufy-core:gen-linearizer 2.19921875d0) :delinearizer
                             (dufy-core:gen-delinearizer 2.19921875d0))
    Adobe RGB (1998), 8-bit per channel
  • Variable +ADOBE-16+
    (dufy-core:copy-rgbspace dufy-core:+adobe+ :bit-per-channel 16)
    Adobe RGB (1998), 16-bit per channel.
  • Variable +WIDE-GAMUT+
    (dufy-core:make-rgbspace 0.7347d0 0.2653d0 0.1152d0 0.8264d0 0.1566d0 0.0177d0
                             :illuminant dufy-core:+illum-d50+ :linearizer
                             (dufy-core:gen-linearizer 2.19921875d0) :delinearizer
                             (dufy-core:gen-delinearizer 2.19921875d0))
    Wide-gamut RGB, 8-bit per channel.
  • Variable +NTSC1953+
    (dufy-core:make-rgbspace 0.67d0 0.33d0 0.21d0 0.71d0 0.14d0 0.08d0 :illuminant
                             dufy-core:+illum-c+ :linearizer
                             (dufy-core:gen-linearizer 2.2d0) :delinearizer
                             (dufy-core:gen-delinearizer 2.2d0))
    NTSC RGB, Rec. ITU-R BT.470-6, System M, 8-bit per channel. http://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.470-6-199811-S!!PDF-E.pdf
  • Variable +PAL/SECAM+
    (dufy-core:make-rgbspace 0.64d0 0.33d0 0.29d0 0.6d0 0.15d0 0.06d0 :linearizer
                             (dufy-core:gen-linearizer 2.8d0) :delinearizer
                             (dufy-core:gen-delinearizer 2.8d0))
    PAL/SECAM RGB, Rec. ITU-R BT.470-6, 8-bit per channel. http://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.470-6-199811-S!!PDF-E.pdf
  • Variable +PROPHOTO+
    (dufy-core:make-rgbspace 0.7347d0 0.2653d0 0.1596d0 0.8404d0 0.0366d0 1.d-4
                             :illuminant dufy-core:+illum-d50+ :linearizer
                             #'dufy-core::linearize-prophoto :delinearizer
                             #'dufy-core::delinearize-prophoto)
    Prophoto RGB (also known as ROMM RGB), 8-bit per channel, http://www.color.org/ROMMRGB.pdf
  • Variable +PROPHOTO-12+
    (dufy-core:copy-rgbspace dufy-core:+prophoto+ :bit-per-channel 12)
    Prophoto RGB (also known as ROMM RGB), 12-bit per channel, http://www.color.org/ROMMRGB.pdf
  • Variable +PROPHOTO-16+
    (dufy-core:copy-rgbspace dufy-core:+prophoto+ :bit-per-channel 16)
    Prophoto RGB (also known as ROMM RGB), 16-bit per channel, http://www.color.org/ROMMRGB.pdf
  • Function LAB-DELTAEAB (l1 a1 b1 l2 a2 b2)
    CIE 1976. Euclidean distance in L*a*b* space.
  • Function XYZ-DELTAEAB (x1 y1 z1 x2 y2 z2 &key (illuminant +illum-d65+))
  • Function QRGB-DELTAEAB (qr1 qg1 qb1 qr2 qg2 qb2 &key (rgbspace +srgb+))
  • Function LAB-DELTAE94 (l1 a1 b1 l2 a2 b2 &key (application :graphic-arts))
    CIE 1994. APPLICATION::= :graphic-arts | :textiles
  • Function XYZ-DELTAE94 (x1 y1 z1 x2 y2 z2 &key (application :graphic-arts) (illuminant +illum-d65+))
  • Function QRGB-DELTAE94 (qr1 qg1 qb1 qr2 qg2 qb2 &key (application :graphic-arts) (rgbspace +srgb+))
  • Function LAB-DELTAE00 (l1 a1 b1 l2 a2 b2)
    CIEDE2000.
  • Function XYZ-DELTAE00 (x1 y1 z1 x2 y2 z2 &key (illuminant +illum-d65+))
  • Function QRGB-DELTAE00 (qr1 qg1 qb1 qr2 qg2 qb2 &key (rgbspace +srgb+))

dufy-examples

Examples of dufy

DUFY-EXAMPLES

  • Function DRAW-SRGB-IN-MUNSELL (&optional (size 300) (framerate 10) (bg-color lispbuilder-sdl:*black*))
    Graphical demonstration with SDL. Renders the sRGB space in the Munsell space.

dufy-extra-data

DUFY-EXTRA-DATA

  • Variable +ILLUM-D55+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-illum-d-spectrum 5500 :rectify t)
                               :compile-time t)
  • Variable +ILLUM-D75+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-illum-d-spectrum 7500 :rectify t)
                               :compile-time t)
  • Variable +ILLUM-F1+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-spectrum
                                dufy-extra-data::+illum-f1-arr+ 380 780)
                               :compile-time t)
  • Variable +ILLUM-F2+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-spectrum
                                dufy-extra-data::+illum-f2-arr+ 380 780)
                               :compile-time t)
  • Variable +ILLUM-F3+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-spectrum
                                dufy-extra-data::+illum-f3-arr+ 380 780)
                               :compile-time t)
  • Variable +ILLUM-F4+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-spectrum
                                dufy-extra-data::+illum-f4-arr+ 380 780)
                               :compile-time t)
  • Variable +ILLUM-F5+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-spectrum
                                dufy-extra-data::+illum-f5-arr+ 380 780)
                               :compile-time t)
  • Variable +ILLUM-F6+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-spectrum
                                dufy-extra-data::+illum-f6-arr+ 380 780)
                               :compile-time t)
  • Variable +ILLUM-F7+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-spectrum
                                dufy-extra-data::+illum-f7-arr+ 380 780)
                               :compile-time t)
  • Variable +ILLUM-F8+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-spectrum
                                dufy-extra-data::+illum-f8-arr+ 380 780)
                               :compile-time t)
  • Variable +ILLUM-F9+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-spectrum
                                dufy-extra-data::+illum-f9-arr+ 380 780)
                               :compile-time t)
  • Variable +ILLUM-F10+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-spectrum
                                dufy-extra-data::+illum-f10-arr+ 380 780)
                               :compile-time t)
  • Variable +ILLUM-F11+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-spectrum
                                dufy-extra-data::+illum-f11-arr+ 380 780)
                               :compile-time t)
  • Variable +ILLUM-F12+
    (dufy-core:make-illuminant :spectrum
                               (dufy-core:gen-spectrum
                                dufy-extra-data::+illum-f12-arr+ 380 780)
                               :compile-time t)

dufy-internal

Common definitions which are not external in the main package

DUFY-INTERNAL

  • Variable *DAT-DIR-PATH*
    (asdf/component:component-pathname
     (asdf/find-component:find-component (asdf/system:find-system :dufy) :dat))
  • Function PRINT-MAKE-ARRAY (var-name array &optional (stream t) (declaration t) (load-time-value nil))
    Prints a code like (defparameter VAR-NAME (make-array ...))
  • Variable TWO-PI
    (alexandria.0.dev::%reevaluate-constant 'dufy-internal:two-pi
                                            (float (+ pi pi) 1.0d0) 'eql)
  • Macro WITH-DOUBLE-FLOAT (vars &body body)
    Ensures that variables are double-float.
  • Macro TIME-AFTER-GC (&body body)
  • Macro STIME-AFTER-GC (&body body)
  • Macro TIME-MEDIAN (num &body body)
  • Macro WITH-PROFILE (&body body)
    For devel.
  • Function NEARLY= (threshold number &rest more-numbers)
  • Function NEARLY-EQUAL (threshold lst1 &rest lsts)
  • Function NEARLY<= (threshold number &rest more-numbers)
  • Function SUBTRACT-WITH-MOD (x y &optional (divisor two-pi))
    (X - Y) mod DIVISOR.
  • Function CIRCULAR-NEARER (theta1 x theta2 &optional (perimeter two-pi))
    Compares counterclockwise distances between THETA1 and X and between X and THETA2, returns THETA1 or THETA2 whichever is nearer.
  • Function CIRCULAR-CLAMP (number min max &optional (perimeter two-pi))
    A clamp function in a circle group. If NUMBER is not in the (counterclockwise) closed interval [MIN, MAX], CIRCULAR-CLAMP returns MIN or MAX, whichever is nearer to NUMBER.
  • Function CIRCULAR-LERP (coef theta1 theta2 &optional (perimeter two-pi))
    Counterclockwise linear interpolation from THETA1 to THETA2 in a circle group. The return value doesn't exceed the given interval from THETA1 to THETA2 if COEF is in [0, 1]. It is, however, slower than CIRCULAR-LERP-LOOSE.
  • Function CIRCULAR-LERP-LOOSE (coef theta1 theta2 &optional (perimeter two-pi))
    Counterclockwise linear interpolation from THETA1 to THETA2 in a circle group. There is a possibility that the return value slightly exceeds the interval [THETA1, THETA2], due to floating-point error. If that is incovenient, use CIRCULAR-LERP instead.
  • Function CIRCULAR-MEMBER (x theta1 theta2 &optional (perimeter two-pi))
    Returns true, if X is in the counterclockwise closed interval [THETA1, THETA2] in a circle group.
  • Type MATRIX33
  • Variable +IDENTITY-MATRIX+
    (make-array '(3 3) :element-type 'double-float :initial-contents
                '((1.0d0 0.0d0 0.0d0) (0.0d0 1.0d0 0.0d0) (0.0d0 0.0d0 1.0d0)))
  • Variable +EMPTY-MATRIX+
    (make-array '(3 3) :element-type 'double-float)
    Used instead of NIL
  • Function INVERT-MATRIX33 (mat)
  • Function MULTIPLY-MAT-VEC (matrix x y z)
  • Function MULTIPLY-MAT-MAT (mat1 mat2)
  • Function MULTIPLY-MATRICES (mat1 &rest mats)

dufy-munsell

DUFY-MUNSELL

  • Variable *MAXIMUM-CHROMA*
    most-positive-double-float
    The largest chroma which the Munsell converters accepts. It is in some cases less than MOST-POSITIVE-DOUBLE-FLOAT because of efficiency: e.g. in SBCL (64-bit) it is desirable that a float F fulfills (typep (round F) '(SIGNED-BYTE 64))
  • Function MAX-CHROMA-IN-MRD (hue40 value &key (use-dark t))
    Returns the largest chroma in the Munsell renotation data for a given hue and value.
  • Function MUNSELL-VALUE-TO-Y (v)
    Converts Munsell value to Y, whose nominal range is [0, 1]. The formula is based on ASTM D1535-08e1:
  • Function Y-TO-MUNSELL-VALUE (y)
    Interpolates the inversion table of MUNSELL-VALUE-TO-Y linearly, whose band width is 10^-3. The error, (abs (- (y (munsell-value-to-y (y-to-munsell-value y))))), is smaller than 10^-5.
  • Condition INVALID-MHVC-ERROR  (SIMPLE-ERROR)
  • Function MHVC-OUT-OF-MRD-P (hue40 value chroma)
    Checks if MHVC is out of the Munsell renotation data.
  • Function MHVC-TO-LCHAB-ILLUM-C (hue40 value chroma)
    Illuminant C.
  • Function MHVC-TO-XYZ-ILLUM-C (hue40 value chroma)
  • Function MHVC-TO-XYZ (hue40 value chroma)
    Illuminant D65. This converter includes the Bradford transformation from illuminant C to illuminant D65.
  • Function MHVC-TO-QRGB (hue40 value chroma &key (rgbspace +srgb+) (clamp t))
    Illuminant D65. The illuminant of RGBSPACE must also be D65.
  • Condition MUNSELLSPEC-PARSE-ERROR  (PARSE-ERROR)
  • Function MUNSELL-TO-MHVC (munsellspec)
    Usage Example: (dufy:munsell-to-mhvc "0.02RP 0.9/3.5") ;; => 36.008d0 ;; 0.9d0 ;; 3.5d0 Many other notations of numbers are acceptable; an ugly specification as follows are also available: (dufy:munsell-to-mhvc "2d-2RP .9/ #x0ffffff") ;; => 36.008d0 ;; 0.9d0 ;; 1.6777215d7 but the capital letters and '/' are reserved: (dufy:munsell-to-mhvc "2D-2RP 9/10 / #X0FFFFFF") => ERROR,
  • Function MHVC-TO-MUNSELL (hue40 value chroma &key (digits 2))
  • Function MUNSELL-OUT-OF-MRD-P (munsellspec)
  • Function MUNSELL-TO-LCHAB-ILLUM-C (munsellspec)
  • Function MUNSELL-TO-XYZ-ILLUM-C (munsellspec)
  • Function MUNSELL-TO-XYZ (munsellspec)
    Illuminant D65.
  • Function MUNSELL-TO-QRGB (munsellspec &key (rgbspace +srgb+) (clamp t))
    Illuminant D65. The illuminant of RGBSPACE must also be D65.
  • Condition LARGE-APPROXIMATION-ERROR  (ARITHMETIC-ERROR)
  • Function LCHAB-TO-MHVC-ILLUM-C (lstar cstarab hab &key (max-iteration 200) (if-reach-max :error) (factor 0.5d0) (threshold 1.d-6))
    An inverter of MHVC-TO-LCHAB-ILLUM-C with a simple iteration algorithm like the one in "An Open-Source Inversion Algorithm for the Munsell Renotation" by Paul Centore, 2011: V := LSTAR-TO-MUNSELL-VALUE(L*); C_0 := C*ab / 5.5; H_0 := Hab / 9; C_(n+1) := C_n + factor * delta(C_n); H_(n+1) := H_n + factor * delta(H_n), where delta(H_n) and delta(C_n) is internally calculated at every step. It returns Munsell HVC values if C_0 <= THRESHOLD or V <= THRESHOLD or max(delta(H_n), delta(C_n)) falls below THRESHOLD. IF-REACH-MAX specifies the action to be taken if the loop reaches the MAX-ITERATION: :error: Error of type DUFY:LARGE-APPROXIMATION-ERROR is signaled. :return40: Three 40d0s are returned. :raw: Just returns HVC as it is.
  • Function LCHAB-TO-MUNSELL-ILLUM-C (lstar cstarab hab &key (max-iteration :max-iteration) (if-reach-max :if-reach-max) (factor :factor) (threshold :threshold) (digits :digits))
  • Function XYZ-TO-MHVC-ILLUM-C (x y z &key (max-iteration :max-iteration) (if-reach-max :if-reach-max) (factor :factor) (threshold :threshold))
  • Function XYZ-TO-MHVC (x y z &key (max-iteration 200) (if-reach-max :error) (factor 0.5d0) (threshold 1.d-6))
    Illuminant D65. This converter includes the Bradford transformation from illuminant D65 to illuminant C.
  • Function XYZ-TO-MUNSELL-ILLUM-C (x y z &key (max-iteration :max-iteration) (if-reach-max :if-reach-max) (factor :factor) (threshold :threshold) (digits :digits))
  • Function XYZ-TO-MUNSELL (x y z &key (max-iteration 200) (if-reach-max :error) (factor 0.5d0) (threshold 1.d-6) (digits 2))
    Illuminant D65. This converter includes the Bradford transformation from illuminant D65 to illuminant C.