OASIS Open Document Format for Office Applications (OpenDocument) TC

 View Only
  • 1.  gradient proposal

    Posted 06-13-2003 12:28
    Dear TC members,
    
    my action item is a proposal for gradients in the Open Office XML format.
    
    First of all, I would like to start with a comparison between the 
    gradients in SVG and in the  OpenOffice.org XML format, by going along 
    the SVG specification
    
    Comparison
    ==========
    
    <linearGradient>
    ----------------
    This element is equivalent to <draw:gradient>/<draw:transparency> with 
    draw:style="linear|axial" in the OpenOffice.org (OOo) XML spec.
    
    gradientUnits="userSpaceOnUse|objectBoundingBox": This attribute does 
    not exist in the OOo XML spec, but the behavior is like 
    gradientUnits="objectBoundingBox". This equals to the default value of SVG.
    
    gradientTransform="<transform-list>" : This attribute does not exist in 
    the OOo XML spec. However, very simple transformations can be achieved 
    by the draw:angle attribute.
    
    x1, x2, y1, y2="<coordinate>": These attributes are not supported by the 
    OOo XML spec. Instead of this, draw:style="linear|axial" and draw:angle 
    can be used to specify the gradient direction.
    
    spreadMethod="pad|reflect|repeat" : This attribute is not supported by 
    the OOo XML spec, but the behavior is like spreadMethod = "pad", that is 
    also the SVG default.
    
    xlink:href="<uri>" : This attribute is not supported by the OOo XML 
    spec. If inheritance of gradients would be supported, then most likely 
    by a style:parent-style-name attribute that is used for other kind of 
    styles already.
    
    
    <radialGradient>
    ----------------
    This element is equivalent to <draw:gradient>/<draw:transparency> with 
    draw:style="radial".
    
    gradientUnits, gradientTransform, spreadMethod, xlink:href: See 
    <linearGradient>
    
    cx, cy="<coordinate>": equivalent to draw:cx and draw:cy
    
    r="<length>: This attribute is not supported by the OOo XML spec. The 
    radius is calculated based on the target objects width and height, and 
    the gradient's center. The details need to be clarified. However, the 
    SVG specification also seems not to specify clearly how for instance 
    r="50%" is interpreted if applied to a real rectangle.
    
    fx, fy="<coordinate>": These attributes are not supported, but the 
    behavior is like fx=cx and fy=cy. This equals to SVG's defaults.
    
    
    <stop>
    ------
    
    This element is not supported, but the OOo XML gradient specification 
    equals a SVG gradient specification with exactly two stops.
    
    offset="<number>|<percentage>": For the first stop, this attribute 
    equals the draw:border attribute. For the second stop, this attribute's 
    value is "100%".
    
    stop-color: For the first stop, this attribute equals the 
    draw:start-color of <gradient>. For the second stop, this attribute 
    equals draw:end-color of <gradient>.
    
    stop-opacity: For the first stop, this attribute is the opposite of the 
    draw:start transparency of <transparency>. For the second stop, this 
    attribute is the opposite of the draw:end transparency of <transparency>.
    
    Missing Features
    ================
    
    The following features exist in the OpenOffice.org XML specification, 
    but do not exist in SVG:
    
    - OOo XML supports ellipsoid, square and rectangular gradients (it might 
    be that ellipsoid gradients can be archived in SVG by applying 
    transformations).
    
    - OOo XML supports an intensity for the start and end color values .
    
    - OOo XML supports specifying a gradient and a transparency 
    simultaneously to one target object.
    
    - All OOo XML gradients have a name. This name is required to be 
    referencable from a graphics style.
    
    
    Proposal
    ========
    Based on this comparison, I would like to make the following proposals, 
    that are in fact more or less independent of each other:
    
    a) Since the SVG gradient specification is more powerful than the OOo 
    XML gradient specification, the Open Office XML format supports SVG's 
    gradient definition in addition to the ones already existing. If a SVG 
    gradient definition is used within the Open Office XML format, it must 
    have a draw:name attribute attached. For simplicity, the gradientUnits 
    attribute will be ignored. Parent gradients are only evaluated, if they 
    are specified by an style:parent-style-name attribute (xlink:href might 
    be specified additionally for SVG compatibility). SVG gradients are only 
    evaluated if they are referenced by a draw:gradient attribute, but not 
    if they are referenced by a draw:opacity attribute. The result of 
    referencing a SVG gradient with draw:gradient and an opacity gradient 
    additionally (with draw:opacity) is unspecified.
    
    b) The <draw:transparency> element will be renamed to <draw:opacity>, 
    draw:start and draw:end to draw:start-opacity and draw:end-opacity, and 
    their meaning will be reversed. The draw:transparency attribute that can 
    occur in <style:properties> will be renamed to <draw:opacity>.
    
    c) Additional gradient definitions that are neither supported by OOo XML 
    nor by SVG might be added if they are supported by existing applications.
    
    d) We get in contact with the SVG working group to check whether the 
    missing features (except the name that is office specific) can be added 
    to SVG and to coordinate future gradient extensions with SVG.
    
    Best regards
    
    Michael