xmlgraphics-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Xmlgraphics Wiki] Update of "ColorHandling" by JeremiasMaerki
Date Tue, 15 Jun 2010 08:26:34 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Xmlgraphics Wiki" for change notification.

The "ColorHandling" page has been changed by JeremiasMaerki.
The comment on this change is: Some more notes.
http://wiki.apache.org/xmlgraphics/ColorHandling?action=diff&rev1=1&rev2=2

--------------------------------------------------

  
  Not all possible output formats for SVG and XSL-FO documents support all of the above color
specifications. In all cases, fallback colors in sRGB color space are specified to achieve
at least an approximation of the intended color. What's intended here is to find a way to
represent these colors as primary color specifications for output formats that support them.
In all other case, the sRGB fallback shall be used.
  
+ === FOP-specific requirements ==
+ 
+ Apache FOP has two XML-based intermediate formats which makes it necessary to generate textual
representations from the decoded original color specification. So there is need for a round-trip
possibility. That means that we can't simply use the ColorSpace instance but also have to
carry a name and a URI for the color profile/space.
+ 
  == Color in the Java class library ==
  
  {{{java.awt.Color}}} is Java's way to specify color, primarily in the sRGB color space.
But it also has constructors taking a ColorSpace parameter, so arbitrary colors with n components
and color values between 0.0 and 1.0 can be specified. The class uses the {{{float[] ColorSpace.toRGB(float[])}}}
method to calculate the sRGB fallback value for such a color.
  
  What the class doesn't support is the specification of named colors based on an ICC named
color profile (or any other source for named colors). A possible work-around is thinkable:
A named color profile is split up into its various named colors and a ColorSpace object is
created for each of them with one component each for the tint (see notes below).
+ 
+ == Current state (2010-06-15) ==
+ 
+ A {{{ColorExt}}} class was moved from FOP to XGC. It has its own set of RGB replacement
values and fields for the name and URI of a color profile. Some code in there seems not to
be used anywhere and other code appears to duplicate functionality of the superclass ({{{Color}}}).
The {{{ColorExt}}} class is not sufficient to carry named colors, for example.
+ 
+ == Ideas ==
+ 
+ It may make sense to create multiple subclasses of the {{{Color}}} class for the various
color specifications, but:
+ 
+ Right now, SVG and XSL define an optional "real" color and a mandatory sRGB fallback. XSL
uses single functions which include the sRGB fallback as part of the function. SVG, however,
specifies the sRGB fallback in front and the color function after that. The latter has greater
flexibility since it would allow to extend the paint specification so it can specify more
than 2 colors as a prioritized list. The implementation could then choose the best color that
the selected output format supports. Example: PDF supports to specify and use multiple calibrated
color spaces. When generating a bitmap, only one color space may be used which means that
colors not matching that color space have to be converted via CIE XYZ or CIE LAB color spaces.
However, color conversions can be lossy. But this is might go too far. Still, implementation
will have to deal with certain color conversions if they don't always want to fallback to
the sRGB values since that has a smaller gamut than other color spaces and is using additive
colors rather than subtractive ones better suited for printing.
+ 
+ So, another possibility is to attach additional color specifications to the main Color(Ext)
instance and the super class' constructor simply receives the fallback sRGB color. The additional
color specifications would be held as an ordered list which also represents the prioritized
order of the color with the sRGB always being the last in the chain.
  
  == Various notes ==
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Mime
View raw message