diff options
author | Marti Maria <marti.maria@littlecms.com> | 2023-04-23 17:54:36 +0200 |
---|---|---|
committer | Marti Maria <marti.maria@littlecms.com> | 2023-04-23 17:54:36 +0200 |
commit | 88b4c773d06368f1ecdd4b4ba1b75e1c6694531d (patch) | |
tree | 3115d0faafbf38139fcb82ed31a1109a8d269303 | |
parent | b3144b8018a26df755b46a02583ff6ea466f532c (diff) | |
download | lcms2-88b4c773d06368f1ecdd4b4ba1b75e1c6694531d.tar.gz |
add a way to get segments from tone curves
- Add a way to get segments from tone curves
- Add a check for windows in meson file of fast-float plugin
-rw-r--r-- | include/lcms2.h | 2 | ||||
-rw-r--r-- | plugins/fast_float/src/meson.build | 15 | ||||
-rw-r--r-- | src/cmsgamma.c | 10 | ||||
-rw-r--r-- | src/lcms2.def | 2 |
4 files changed, 17 insertions, 12 deletions
diff --git a/include/lcms2.h b/include/lcms2.h index 924d40b..2876ac8 100644 --- a/include/lcms2.h +++ b/include/lcms2.h @@ -1222,6 +1222,8 @@ CMSAPI cmsInt32Number CMSEXPORT cmsGetToneCurveParametricType(const cmsToneCu CMSAPI cmsFloat64Number CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Number Precision); CMSAPI cmsFloat64Number* CMSEXPORT cmsGetToneCurveParams(const cmsToneCurve* t); +CMSAPI const cmsCurveSegment* CMSEXPORT cmsGetToneCurveSegment(cmsInt32Number n, const cmsToneCurve* t); + // Tone curve tabular estimation CMSAPI cmsUInt32Number CMSEXPORT cmsGetToneCurveEstimatedTableEntries(const cmsToneCurve* t); CMSAPI const cmsUInt16Number* CMSEXPORT cmsGetToneCurveEstimatedTable(const cmsToneCurve* t); diff --git a/plugins/fast_float/src/meson.build b/plugins/fast_float/src/meson.build index e907c3b..c53639c 100644 --- a/plugins/fast_float/src/meson.build +++ b/plugins/fast_float/src/meson.build @@ -19,13 +19,16 @@ lcms2_fast_float_sources = files( lcms2_fast_float_incdir = include_directories('../include', '.') if host_machine.system() == 'windows' - lcms2_fast_float_rc = configure_file( - input: 'lcms2_fast_float.rc.in', - configuration: version_cfg, - output: 'lcms2_fast_float.rc', - ) + if get_option('default_library') == 'shared' - lcms2_fast_float_sources += win.compile_resources(lcms2_fast_float_rc) + lcms2_fast_float_rc = configure_file( + input: 'lcms2_fast_float.rc.in', + configuration: version_cfg, + output: 'lcms2_fast_float.rc', + ) + + lcms2_fast_float_sources += win.compile_resources(lcms2_fast_float_rc) + endif endif liblcms2_fast_float = library( diff --git a/src/cmsgamma.c b/src/cmsgamma.c index 1031fc1..24b2ada 100644 --- a/src/cmsgamma.c +++ b/src/cmsgamma.c @@ -1491,13 +1491,13 @@ cmsFloat64Number CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Num return (sum / n); // The mean } +// Retrieve segments on tone curves -// Retrieve parameters on one-segment tone curves - -cmsFloat64Number* CMSEXPORT cmsGetToneCurveParams(const cmsToneCurve* t) +const cmsCurveSegment* CMSEXPORT cmsGetToneCurveSegment(cmsInt32Number n, const cmsToneCurve* t) { _cmsAssert(t != NULL); - if (t->nSegments != 1) return NULL; - return t->Segments[0].Params; + if (n < 0 || n >= (cmsInt32Number) t->nSegments) return NULL; + return t->Segments + n; } + diff --git a/src/lcms2.def b/src/lcms2.def index b9ce630..5bd2678 100644 --- a/src/lcms2.def +++ b/src/lcms2.def @@ -362,7 +362,7 @@ cmsMD5add = cmsMD5add cmsMD5alloc = cmsMD5alloc
cmsMD5finish = cmsMD5finish
_cmsComputeInterpParams = _cmsComputeInterpParams
-cmsGetToneCurveParams = cmsGetToneCurveParams
+cmsGetToneCurveSegment = cmsGetToneCurveSegment
cmsDetectRGBProfileGamma = cmsDetectRGBProfileGamma
_cmsOptimizePipeline = _cmsOptimizePipeline
_cmsReasonableGridpointsByColorspace = _cmsReasonableGridpointsByColorspace
|