Gents,

I have recently started the process of modifying Ghostscript to be
able to use lcms v2 rather than v1 as is currently the case.

In so doing, I have found a couple of things I've had to tweak within
the library. I plan to start to feed these back in the hopes that
either they will be adopted within the release versions of the
library, or that you can inform me how to get the same effects
without such modifications.

I'll break these submissions down into 1 per email for simplicity. So
the first one...

In lcms v1, the profile structure type was public, so we could read
the current input and output types for a given transform directly. In
lcms v2 you have taken the (very reasonable) step of hiding the
structure away as an opaque type. In order to easily use our code
that calls cmsChangeBuffersFormat, we'd like the ability to get the
current input and output format for a transform.

I have therefore added 2 trivial functions to the API to achieve
this. Patch attached below.

Thanks,

Robin
-- 
diff --git a/include/lcms2.h b/include/lcms2.h
index 16c1b46..c53ff36 100644
--- a/include/lcms2.h
+++ b/include/lcms2.h
@@ -1620,6 +1620,8 @@ CMSAPI cmsBool          CMSEXPORT 
cmsChangeBuffersFormat(cmsHTRANSFORM hTransfor
                                                          cmsUInt32Number 
InputFormat, 
                                                          cmsUInt32Number 
OutputFormat);
 
+CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformInputFormat(cmsHTRANSFORM);
+CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformOutputFormat(cmsHTRANSFORM);
 
 
 // PostScript ColorRenderingDictionary and ColorSpaceArray 
----------------------------------------------------
diff --git a/src/cmsxform.c b/src/cmsxform.c
index 0d34001..04b4efb 100644
--- a/src/cmsxform.c
+++ b/src/cmsxform.c
@@ -787,3 +787,17 @@ cmsBool CMSEXPORT cmsChangeBuffersFormat(cmsHTRANSFORM 
hTransform,
     xform ->ToOutput     = ToOutput;
     return TRUE;
 }
+
+CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformInputFormat(cmsHTRANSFORM 
hTransform)
+{
+    _cmsTRANSFORM* xform = (_cmsTRANSFORM*) hTransform;
+
+    return xform->InputFormat;
+}
+
+CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformOutputFormat(cmsHTRANSFORM 
hTransform)
+{
+    _cmsTRANSFORM* xform = (_cmsTRANSFORM*) hTransform;
+
+    return xform->OutputFormat;
+}
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to