Let's take our example with the green logo from the previous post and assume that documents to print contain this logo. Further, we assume that if we print the document "as is" the logo color is wrong.
So the first thing we need is a mechanism to name a set of transforms for application to some input. We will use pseudo XML that use parends instead of greater/less than to avoid blogger bugs. So we might say:
We also need a way to talk about the colors (outside a mathematical context) we are interested and we need tell our system what to do with those colors. To do this we use sets of colorant values along with an identifying color type, for example CMYK(0,.2,0,.01). In practice we want to restrict our color specifications a bit more so we create some more complicated color types: "CMYK" means stroke CMYK color, "cmyk" means fill CMYK color, "icmyk" mean image CMYK color, and so on (the other types are just combinations of these basic types). So we could say something like:
(COLOR name="c1" type="CMYK0,.2,0,.01)" /)
Finally we need a way to talk about the mathematical transforms and what colors, if any, they might use. We're not going to put the mathematical parts out here. Instead we will assign names to them like this:
So here we have a transform called fix_green that takes as an input color c1 and transforms it to c2 via a function shader1. shader1 is controlled by some additional parameters identified by the param attribute. The shader1 function controls the stretching and shrinking operations we've describe earlier. For our purposes here we can imagine shader1 to use the param value to control how closely an input color has to match c1 in order to convert it to c2.
Putting it all together we might end up with something like this:
(APPLY name="fix_red" \)
Next we need a way to tell our system when to apply the fix_logo_A transform. To do this we need some meta data that associates a page in a stream of documents to alter with a transform. We might use something like this:
This let's us selectively apply transformations based on inputs.
Note: There is no reason that parameters like param='.75' have to be static relative to the document stream. We could, for example, also say
It really all depends on what you need to do.
So now we can describe the color changes we are interested in. We have a programmatic way that supports parameterization to allow us to control the color changes with data.
However, there are still some items we have to cover in order to define a complete system (which we will do in subsequent posts):
- How do we figure out what transforms should do?
- How do we figure out what color to change and what to change them to?
- How do we handle differences in color between devices?