org.apache.batik.bridge
Class CSSUtilities

java.lang.Object
  |
  +--org.apache.batik.bridge.CSSUtilities
All Implemented Interfaces:
CSSConstants, ErrorConstants, XMLConstants

public abstract class CSSUtilities
extends java.lang.Object
implements CSSConstants, ErrorConstants, XMLConstants

A collection of utility method involving CSS property. The listed methods bellow could be used as convenient methods to create concrete objects regarding to CSS properties.


Field Summary
static java.awt.Composite TRANSPARENT
           
 
Fields inherited from interface org.apache.batik.util.CSSConstants
CSS_ACCUMULATE_VALUE, CSS_ACTIVEBORDER_VALUE, CSS_ACTIVECAPTION_VALUE, CSS_AFTER_EDGE_VALUE, CSS_ALICEBLUE_VALUE, CSS_ALIGNMENT_BASELINE_PROPERTY, CSS_ALL_VALUE, CSS_ALPHABETIC_VALUE, CSS_ANTIQUEWHITE_VALUE, CSS_APPWORKSPACE_VALUE, CSS_AQUA_VALUE, CSS_AQUAMARINE_VALUE, CSS_AUTO_VALUE, CSS_AUTOSENSE_SCRIPT_VALUE, CSS_AZURE_VALUE, CSS_BACKGROUND_VALUE, CSS_BASELINE_SHIFT_PROPERTY, CSS_BASELINE_VALUE, CSS_BEFORE_EDGE_VALUE, CSS_BEIGE_VALUE, CSS_BEVEL_VALUE, CSS_BIDI_OVERRIDE_VALUE, CSS_BISQUE_VALUE, CSS_BLACK_VALUE, CSS_BLANCHEDALMOND_VALUE, CSS_BLINK_VALUE, CSS_BLOCK_VALUE, CSS_BLUE_VALUE, CSS_BLUEVIOLET_VALUE, CSS_BOLD_VALUE, CSS_BOLDER_VALUE, CSS_BOTTOM_VALUE, CSS_BROWN_VALUE, CSS_BURLYWOOD_VALUE, CSS_BUTT_VALUE, CSS_BUTTONFACE_VALUE, CSS_BUTTONHIGHLIGHT_VALUE, CSS_BUTTONSHADOW_VALUE, CSS_BUTTONTEXT_VALUE, CSS_CADETBLUE_VALUE, CSS_CAPTIONTEXT_VALUE, CSS_CENTER_VALUE, CSS_CENTRAL_VALUE, CSS_CHARTREUSE_VALUE, CSS_CHOCOLATE_VALUE, CSS_CLIP_PATH_PROPERTY, CSS_CLIP_PROPERTY, CSS_CLIP_RULE_PROPERTY, CSS_COLLAPSE_VALUE, CSS_COLOR_INTERPOLATION_FILTERS_PROPERTY, CSS_COLOR_INTERPOLATION_PROPERTY, CSS_COLOR_PROFILE_PROPERTY, CSS_COLOR_PROPERTY, CSS_COLOR_RENDERING_PROPERTY, CSS_COMPACT_VALUE, CSS_CONDENSED_VALUE, CSS_CORAL_VALUE, CSS_CORNFLOWERBLUE_VALUE, CSS_CORNSILK_VALUE, CSS_CRIMSON_VALUE, CSS_CRISPEDGES_VALUE, CSS_CROSSHAIR_VALUE, CSS_CURRENTCOLOR_VALUE, CSS_CURSIVE_VALUE, CSS_CURSOR_PROPERTY, CSS_CYAN_VALUE, CSS_DARKBLUE_VALUE, CSS_DARKCYAN_VALUE, CSS_DARKGOLDENROD_VALUE, CSS_DARKGRAY_VALUE, CSS_DARKGREEN_VALUE, CSS_DARKGREY_VALUE, CSS_DARKKHAKI_VALUE, CSS_DARKMAGENTA_VALUE, CSS_DARKOLIVEGREEN_VALUE, CSS_DARKORANGE_VALUE, CSS_DARKORCHID_VALUE, CSS_DARKRED_VALUE, CSS_DARKSALMON_VALUE, CSS_DARKSEAGREEN_VALUE, CSS_DARKSLATEBLUE_VALUE, CSS_DARKSLATEGRAY_VALUE, CSS_DARKSLATEGREY_VALUE, CSS_DARKTURQUOISE_VALUE, CSS_DARKVIOLET_VALUE, CSS_DEEPPINK_VALUE, CSS_DEEPSKYBLUE_VALUE, CSS_DEFAULT_VALUE, CSS_DIMGRAY_VALUE, CSS_DIMGREY_VALUE, CSS_DIRECTION_PROPERTY, CSS_DISPLAY_PROPERTY, CSS_DODGERBLUE_VALUE, CSS_DOMINANT_BASELINE_PROPERTY, CSS_E_RESIZE_VALUE, CSS_EMBED_VALUE, CSS_ENABLE_BACKGROUND_PROPERTY, CSS_END_VALUE, CSS_EVENODD_VALUE, CSS_EXPANDED_VALUE, CSS_EXTRA_CONDENSED_VALUE, CSS_EXTRA_EXPANDED_VALUE, CSS_FANTASY_VALUE, CSS_FILL_OPACITY_PROPERTY, CSS_FILL_PROPERTY, CSS_FILL_RULE_PROPERTY, CSS_FILL_VALUE, CSS_FILLSTROKE_VALUE, CSS_FILTER_PROPERTY, CSS_FIREBRICK_VALUE, CSS_FLOOD_COLOR_PROPERTY, CSS_FLOOD_OPACITY_PROPERTY, CSS_FLORALWHITE_VALUE, CSS_FONT_FAMILY_PROPERTY, CSS_FONT_PROPERTY, CSS_FONT_SIZE_ADJUST_PROPERTY, CSS_FONT_SIZE_PROPERTY, CSS_FONT_STRETCH_PROPERTY, CSS_FONT_STYLE_PROPERTY, CSS_FONT_VARIANT_PROPERTY, CSS_FONT_WEIGHT_PROPERTY, CSS_FORESTGREEN_VALUE, CSS_FUCHSIA_VALUE, CSS_GAINSBORO_VALUE, CSS_GEOMETRICPRECISION_VALUE, CSS_GHOSTWHITE_VALUE, CSS_GLYPH_ORIENTATION_HORIZONTAL_PROPERTY, CSS_GLYPH_ORIENTATION_VERTICAL_PROPERTY, CSS_GOLD_VALUE, CSS_GOLDENROD_VALUE, CSS_GRAY_VALUE, CSS_GRAYTEXT_VALUE, CSS_GREEN_VALUE, CSS_GREENYELLOW_VALUE, CSS_GREY_VALUE, CSS_HANGING_VALUE, CSS_HELP_VALUE, CSS_HIDDEN_VALUE, CSS_HIGHLIGHT_VALUE, CSS_HIGHLIGHTTEXT_VALUE, CSS_HONEYDEW_VALUE, CSS_HOTPINK_VALUE, CSS_IDEOGRAPHIC_VALUE, CSS_IMAGE_RENDERING_PROPERTY, CSS_INACTIVEBORDER_VALUE, CSS_INACTIVECAPTION_VALUE, CSS_INACTIVECAPTIONTEXT_VALUE, CSS_INDIANRED_VALUE, CSS_INDIGO_VALUE, CSS_INFOBACKGROUND_VALUE, CSS_INFOTEXT_VALUE, CSS_INLINE_TABLE_VALUE, CSS_INLINE_VALUE, CSS_ITALIC_VALUE, CSS_IVORY_VALUE, CSS_KERNING_PROPERTY, CSS_KHAKI_VALUE, CSS_LARGE_VALUE, CSS_LARGER_VALUE, CSS_LAVENDER_VALUE, CSS_LAVENDERBLUSH_VALUE, CSS_LAWNGREEN_VALUE, CSS_LEMONCHIFFON_VALUE, CSS_LETTER_SPACING_PROPERTY, CSS_LIGHTBLUE_VALUE, CSS_LIGHTCORAL_VALUE, CSS_LIGHTCYAN_VALUE, CSS_LIGHTER_VALUE, CSS_LIGHTGOLDENRODYELLOW_VALUE, CSS_LIGHTGRAY_VALUE, CSS_LIGHTGREEN_VALUE, CSS_LIGHTGREY_VALUE, CSS_LIGHTING_COLOR_PROPERTY, CSS_LIGHTPINK_VALUE, CSS_LIGHTSALMON_VALUE, CSS_LIGHTSEAGREEN_VALUE, CSS_LIGHTSKYBLUE_VALUE, CSS_LIGHTSLATEGRAY_VALUE, CSS_LIGHTSLATEGREY_VALUE, CSS_LIGHTSTEELBLUE_VALUE, CSS_LIGHTYELLOW_VALUE, CSS_LIME_VALUE, CSS_LIMEGREEN_VALUE, CSS_LINE_HEIGHT_PROPERTY, CSS_LINE_THROUGH_VALUE, CSS_LINEARRGB_VALUE, CSS_LINEN_VALUE, CSS_LIST_ITEM_VALUE, CSS_LOWER_VALUE, CSS_LR_TB_VALUE, CSS_LR_VALUE, CSS_LTR_VALUE, CSS_MAGENTA_VALUE, CSS_MARKER_END_PROPERTY, CSS_MARKER_MID_PROPERTY, CSS_MARKER_PROPERTY, CSS_MARKER_START_PROPERTY, CSS_MARKER_VALUE, CSS_MAROON_VALUE, CSS_MASK_PROPERTY, CSS_MATHEMATICAL_VALUE, CSS_MEDIUM_VALUE, CSS_MEDIUMAQUAMARINE_VALUE, CSS_MEDIUMBLUE_VALUE, CSS_MEDIUMORCHID_VALUE, CSS_MEDIUMPURPLE_VALUE, CSS_MEDIUMSEAGREEN_VALUE, CSS_MEDIUMSLATEBLUE_VALUE, CSS_MEDIUMSPRINGGREEN_VALUE, CSS_MEDIUMTURQUOISE_VALUE, CSS_MEDIUMVIOLETRED_VALUE, CSS_MENU_VALUE, CSS_MENUTEXT_VALUE, CSS_MIDDLE_VALUE, CSS_MIDNIGHTBLUE_VALUE, CSS_MIME_TYPE, CSS_MINTCREAM_VALUE, CSS_MISTYROSE_VALUE, CSS_MITER_VALUE, CSS_MOCCASIN_VALUE, CSS_MONOSPACE_VALUE, CSS_MOVE_VALUE, CSS_N_RESIZE_VALUE, CSS_NARROWER_VALUE, CSS_NAVAJOWHITE_VALUE, CSS_NAVY_VALUE, CSS_NE_RESIZE_VALUE, CSS_NEW_VALUE, CSS_NO_CHANGE_VALUE, CSS_NONE_VALUE, CSS_NONZERO_VALUE, CSS_NORMAL_VALUE, CSS_NW_RESIZE_VALUE, CSS_OBLIQUE_VALUE, CSS_OLDLACE_VALUE, CSS_OLIVE_VALUE, CSS_OLIVEDRAB_VALUE, CSS_OPACITY_PROPERTY, CSS_OPTIMIZELEGIBILITY_VALUE, CSS_OPTIMIZEQUALITY_VALUE, CSS_OPTIMIZESPEED_VALUE, CSS_ORANGE_VALUE, CSS_ORANGERED_VALUE, CSS_ORCHID_VALUE, CSS_OVERFLOW_PROPERTY, CSS_OVERLINE_VALUE, CSS_PAINTED_VALUE, CSS_PALEGOLDENROD_VALUE, CSS_PALEGREEN_VALUE, CSS_PALETURQUOISE_VALUE, CSS_PALEVIOLETRED_VALUE, CSS_PAPAYAWHIP_VALUE, CSS_PEACHPUFF_VALUE, CSS_PERU_VALUE, CSS_PINK_VALUE, CSS_PLUM_VALUE, CSS_POINTER_EVENTS_PROPERTY, CSS_POINTER_VALUE, CSS_POWDERBLUE_VALUE, CSS_PURPLE_VALUE, CSS_RED_VALUE, CSS_RESET_SIZE_VALUE, CSS_RESET_VALUE, CSS_RL_TB_VALUE, CSS_RL_VALUE, CSS_ROSYBROWN_VALUE, CSS_ROUND_VALUE, CSS_ROYALBLUE_VALUE, CSS_RTL_VALUE, CSS_RUN_IN_VALUE, CSS_S_RESIZE_VALUE, CSS_SADDLEBROWN_VALUE, CSS_SALMON_VALUE, CSS_SANDYBROWN_VALUE, CSS_SANS_SERIF_VALUE, CSS_SCROLL_VALUE, CSS_SCROLLBAR_VALUE, CSS_SE_RESIZE_VALUE, CSS_SEAGREEN_VALUE, CSS_SEASHELL_VALUE, CSS_SEMI_CONDENSED_VALUE, CSS_SEMI_EXPANDED_VALUE, CSS_SERIF_VALUE, CSS_SHAPE_RENDERING_PROPERTY, CSS_SIENNA_VALUE, CSS_SILVER_VALUE, CSS_SKYBLUE_VALUE, CSS_SLATEBLUE_VALUE, CSS_SLATEGRAY_VALUE, CSS_SLATEGREY_VALUE, CSS_SMALL_CAPS_VALUE, CSS_SMALL_VALUE, CSS_SMALLER_VALUE, CSS_SNOW_VALUE, CSS_SPRINGGREEN_VALUE, CSS_SQUARE_VALUE, CSS_SRGB_VALUE, CSS_START_VALUE, CSS_STEELBLUE_VALUE, CSS_STOP_COLOR_PROPERTY, CSS_STOP_OPACITY_PROPERTY, CSS_STROKE_DASHARRAY_PROPERTY, CSS_STROKE_DASHOFFSET_PROPERTY, CSS_STROKE_LINECAP_PROPERTY, CSS_STROKE_LINEJOIN_PROPERTY, CSS_STROKE_MITERLIMIT_PROPERTY, CSS_STROKE_OPACITY_PROPERTY, CSS_STROKE_PROPERTY, CSS_STROKE_VALUE, CSS_STROKE_WIDTH_PROPERTY, CSS_SUB_VALUE, CSS_SUPER_VALUE, CSS_SW_RESIZE_VALUE, CSS_TABLE_CAPTION_VALUE, CSS_TABLE_CELL_VALUE, CSS_TABLE_COLUMN_GROUP_VALUE, CSS_TABLE_COLUMN_VALUE, CSS_TABLE_FOOTER_GROUP_VALUE, CSS_TABLE_HEADER_GROUP_VALUE, CSS_TABLE_ROW_GROUP_VALUE, CSS_TABLE_ROW_VALUE, CSS_TABLE_VALUE, CSS_TAN_VALUE, CSS_TB_RL_VALUE, CSS_TB_VALUE, CSS_TEAL_VALUE, CSS_TEXT_AFTER_EDGE_VALUE, CSS_TEXT_ANCHOR_PROPERTY, CSS_TEXT_BEFORE_EDGE_VALUE, CSS_TEXT_BOTTOM_VALUE, CSS_TEXT_DECORATION_PROPERTY, CSS_TEXT_RENDERING_PROPERTY, CSS_TEXT_TOP_VALUE, CSS_TEXT_VALUE, CSS_THISTLE_VALUE, CSS_THREEDDARKSHADOW_VALUE, CSS_THREEDFACE_VALUE, CSS_THREEDHIGHLIGHT_VALUE, CSS_THREEDLIGHTSHADOW_VALUE, CSS_THREEDSHADOW_VALUE, CSS_TOMATO_VALUE, CSS_TOP_VALUE, CSS_TURQUOISE_VALUE, CSS_ULTRA_CONDENSED_VALUE, CSS_ULTRA_EXPANDED_VALUE, CSS_UNDERLINE_VALUE, CSS_UNICODE_BIDI_PROPERTY, CSS_USE_SCRIPT_VALUE, CSS_VIOLET_VALUE, CSS_VISIBILITY_PROPERTY, CSS_VISIBLE_VALUE, CSS_VISIBLEFILL_VALUE, CSS_VISIBLEFILLSTROKE_VALUE, CSS_VISIBLEPAINTED_VALUE, CSS_VISIBLESTROKE_VALUE, CSS_W_RESIZE_VALUE, CSS_WAIT_VALUE, CSS_WHEAT_VALUE, CSS_WHITE_VALUE, CSS_WHITESMOKE_VALUE, CSS_WIDER_VALUE, CSS_WINDOW_VALUE, CSS_WINDOWFRAME_VALUE, CSS_WINDOWTEXT_VALUE, CSS_WORD_SPACING_PROPERTY, CSS_WRITING_MODE_PROPERTY, CSS_X_LARGE_VALUE, CSS_X_SMALL_VALUE, CSS_XX_LARGE_VALUE, CSS_XX_SMALL_VALUE, CSS_YELLOW_VALUE, CSS_YELLOWGREEN_VALUE
 
Fields inherited from interface org.apache.batik.bridge.ErrorConstants
ERR_ATTRIBUTE_MISSING, ERR_ATTRIBUTE_VALUE_MALFORMED, ERR_CSS_LENGTH_NEGATIVE, ERR_CSS_URI_BAD_TARGET, ERR_LENGTH_NEGATIVE, ERR_URI_BAD_TARGET, ERR_URI_IMAGE_INVALID, ERR_URI_IO, ERR_URI_MALFORMED, ERR_URI_REFERENCE_A_DOCUMENT, ERR_URI_UNSECURE, ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, MSG_BROKEN_LINK_TITLE
 
Fields inherited from interface org.apache.batik.util.XMLConstants
XLINK_NAMESPACE_URI, XLINK_PREFIX, XML_CHAR_AMP, XML_CHAR_APOS, XML_CHAR_GT, XML_CHAR_LT, XML_CHAR_QUOT, XML_CHAR_REF_PREFIX, XML_CHAR_REF_SUFFIX, XML_CLOSE_TAG_END, XML_CLOSE_TAG_START, XML_DEFAULT_VALUE, XML_DOUBLE_QUOTE, XML_ENTITY_AMP, XML_ENTITY_APOS, XML_ENTITY_GT, XML_ENTITY_LT, XML_ENTITY_QUOT, XML_EQUAL_QUOT, XML_EQUAL_SIGN, XML_LANG_ATTRIBUTE, XML_NAMESPACE_URI, XML_OPEN_TAG_END_CHILDREN, XML_OPEN_TAG_END_NO_CHILDREN, XML_OPEN_TAG_START, XML_PREFIX, XML_PRESERVE_VALUE, XML_SPACE, XML_SPACE_ATTRIBUTE, XML_TAB, XMLNS_NAMESPACE_URI, XMLNS_PREFIX
 
Constructor Summary
protected CSSUtilities()
          No instance of this class is required.
 
Method Summary
static void computeStyleAndURIs(Element refElement, Element localRefElement, java.lang.String uri)
          Partially computes the style in the 'def' tree and set it in the 'use' tree.
static float[] convertClip(Element e)
          Returns an array of floating offsets representing the 'clip' property or null if 'auto'.
static ClipRable convertClipPath(Element clippedElement, GraphicsNode clippedNode, BridgeContext ctx)
          Returns a Clip referenced by the specified element and which applies on the specified graphics node.
static int convertClipRule(Element e)
          Returns the 'clip-rule' for the specified element.
static MultipleGradientPaint.ColorSpaceEnum convertColorInterpolation(Element e)
          Returns the color space for the specified element.
static boolean convertColorInterpolationFilters(Element e)
          Returns the color space for the specified filter element.
static java.awt.RenderingHints convertColorRendering(Element e, java.awt.RenderingHints hints)
          Fills the rendering hints for the specified element or do nothing if none has been specified.
static boolean convertDisplay(Element e)
          Returns true if the specified element has to be displayed, false otherwise.
static java.awt.geom.Rectangle2D convertEnableBackground(Element e)
          Returns the subregion of user space where access to the background image is allowed to happen.
static int convertFillRule(Element e)
          Returns the 'fill-rule' for the specified element.
static Filter convertFilter(Element filteredElement, GraphicsNode filteredNode, BridgeContext ctx)
          Returns a Filter referenced by the specified element and which applies on the specified graphics node.
static java.awt.Color convertFloodColor(Element e, BridgeContext ctx)
          Converts the color defined on the specified <feFlood> element to a Color.
static java.awt.RenderingHints convertImageRendering(Element e, java.awt.RenderingHints hints)
          Fills the rendering hints for the specified image element or do nothing if none has been specified.
static java.awt.Color convertLightingColor(Element e, BridgeContext ctx)
          Converts the color defined on the specified lighting filter element to a Color.
static Mask convertMask(Element maskedElement, GraphicsNode maskedNode, BridgeContext ctx)
          Returns a Mask referenced by the specified element and which applies on the specified graphics node.
static java.awt.Composite convertOpacity(Element e)
          Returns a composite object that represents the 'opacity' of the specified element.
static boolean convertOverflow(Element e)
          Returns true if the 'overflow' property indicates that an additional clip is required, false otherwise.
static int convertPointerEvents(Element e)
          Returns the type that describes how this graphics node reacts to events.
static java.awt.RenderingHints convertShapeRendering(Element e, java.awt.RenderingHints hints)
          Fills the rendering hints for the specified shape element or do nothing none has been specified.
static java.awt.Color convertStopColor(Element e, float opacity, BridgeContext ctx)
          Converts the color defined on the specified <stop> element to a Color.
static java.awt.RenderingHints convertTextRendering(Element e, java.awt.RenderingHints hints)
          Fills the rendering hints for the specified text element or do nothing if none has been specified.
static boolean convertVisibility(Element e)
          Returns true if the specified element is visible, false otherwise.
static Value getComputedStyle(Element e, int property)
          Returns the computed style of the given property.
static CSSEngine getCSSEngine(Element e)
          Returns CSSEngine associated to the specified element.
protected static int rule(CSSValue v)
          Returns the winding rule represented by the specified CSSValue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRANSPARENT

public static final java.awt.Composite TRANSPARENT
Constructor Detail

CSSUtilities

protected CSSUtilities()
No instance of this class is required.
Method Detail

getCSSEngine

public static CSSEngine getCSSEngine(Element e)
Returns CSSEngine associated to the specified element.
Parameters:
e - the element

getComputedStyle

public static Value getComputedStyle(Element e,
                                     int property)
Returns the computed style of the given property.

convertPointerEvents

public static int convertPointerEvents(Element e)
Returns the type that describes how this graphics node reacts to events.
Returns:
GraphicsNode.VISIBLE_PAINTED | GraphicsNode.VISIBLE_FILL | GraphicsNode.VISIBLE_STROKE | GraphicsNode.VISIBLE | GraphicsNode.PAINTED | GraphicsNode.FILL | GraphicsNode.STROKE | GraphicsNode.ALL | GraphicsNode.NONE

convertEnableBackground

public static java.awt.geom.Rectangle2D convertEnableBackground(Element e)
Returns the subregion of user space where access to the background image is allowed to happen.
Parameters:
e - the container element

convertColorInterpolationFilters

public static boolean convertColorInterpolationFilters(Element e)
Returns the color space for the specified filter element. Checks the 'color-interpolation-filters' property.
Parameters:
e - the element
Returns:
true if the color space is linear, false otherwise (sRGB).

convertColorInterpolation

public static MultipleGradientPaint.ColorSpaceEnum convertColorInterpolation(Element e)
Returns the color space for the specified element. Checks the 'color-interpolation' property
Parameters:
e - the element

convertShapeRendering

public static java.awt.RenderingHints convertShapeRendering(Element e,
                                                            java.awt.RenderingHints hints)
Fills the rendering hints for the specified shape element or do nothing none has been specified. Checks the 'shape-rendering' property. If the given RenderingHints is null, a new RenderingHints is created.

Here is how the mapping between SVG rendering hints and the Java2D rendering hints is done:

'optimizeSpeed':
  • KEY_RENDERING=VALUE_RENDER_SPEED
  • KEY_ANTIALIASING=VALUE_ANTIALIAS_OFF
'crispEdges':
  • KEY_RENDERING=VALUE_RENDER_DEFAULT
  • KEY_ANTIALIASING=VALUE_ANTIALIAS_OFF
'geometricPrecision':
  • KEY_RENDERING=VALUE_RENDER_QUALITY
  • KEY_ANTIALIASING=VALUE_ANTIALIAS_ON
Parameters:
e - the element
hints - a RenderingHints to fill, or null.

convertTextRendering

public static java.awt.RenderingHints convertTextRendering(Element e,
                                                           java.awt.RenderingHints hints)
Fills the rendering hints for the specified text element or do nothing if none has been specified. If the given RenderingHints is null, a new one is created. Checks the 'text-rendering' property.

Here is how the mapping between SVG rendering hints and the Java2D rendering hints is done:

'optimizeSpeed':
  • KEY_RENDERING=VALUE_RENDER_SPEED
  • KEY_ANTIALIASING=VALUE_ANTIALIAS_OFF
  • KEY_TEXT_ANTIALIASING=VALUE_TEXT_ANTIALIAS_OFF
  • KEY_FRACTIONALMETRICS=VALUE_FRACTIONALMETRICS_OFF
'optimizeLegibility':
  • KEY_RENDERING=VALUE_RENDER_QUALITY
  • KEY_ANTIALIASING=VALUE_ANTIALIAS_ON
  • KEY_TEXT_ANTIALIASING=VALUE_TEXT_ANTIALIAS_ON
  • KEY_FRACTIONALMETRICS=VALUE_FRACTIONALMETRICS_OFF
'geometricPrecision':
  • KEY_RENDERING=VALUE_RENDER_QUALITY
  • KEY_ANTIALIASING=VALUE_ANTIALIAS_DEFAULT
  • KEY_TEXT_ANTIALIASING=VALUE_TEXT_ANTIALIAS_DEFAULT
  • KEY_FRACTIONALMETRICS=VALUE_FRACTIONALMETRICS_ON

Note that for text both KEY_TEXT_ANTIALIASING and KEY_ANTIALIASING are set as there is no guarantee that a Java2D text rendering primitive will be used to draw text (eg. SVG Font...).

Parameters:
e - the element
hints - a RenderingHints to fill, or null.

convertImageRendering

public static java.awt.RenderingHints convertImageRendering(Element e,
                                                            java.awt.RenderingHints hints)
Fills the rendering hints for the specified image element or do nothing if none has been specified. If the given RenderingHints is null, a new one is created. Checks the 'image-rendering' property.

Here is how the mapping between SVG rendering hints and the Java2D rendering hints is done:

'optimizeSpeed':
  • KEY_RENDERING=VALUE_RENDER_SPEED
  • KEY_INTERPOLATION=VALUE_INTERPOLATION_NEAREST_NEIGHBOR
'optimizeQuality':
  • KEY_RENDERING=VALUE_RENDER_QUALITY
  • KEY_INTERPOLATION=VALUE_INTERPOLATION_BICUBIC
Parameters:
e - the element
hints - a RenderingHints to fill, or null.

convertColorRendering

public static java.awt.RenderingHints convertColorRendering(Element e,
                                                            java.awt.RenderingHints hints)
Fills the rendering hints for the specified element or do nothing if none has been specified. If the given RenderingHints is null, a new one is created. Checks the 'color-rendering' property.

Here is how the mapping between SVG rendering hints and the Java2D rendering hints is done:

'optimizeSpeed':
  • KEY_COLOR_RENDERING=VALUE_COLOR_RENDER_SPEED
  • KEY_ALPHA_INTERPOLATION=VALUE_ALPHA_INTERPOLATION_SPEED
'optimizeQuality':
  • KEY_COLOR_RENDERING=VALUE_COLOR_RENDER_QUALITY
  • KEY_ALPHA_INTERPOLATION=VALUE_ALPHA_INTERPOLATION_QUALITY
Parameters:
e - the element
hints - a RenderingHints to fill, or null.

convertDisplay

public static boolean convertDisplay(Element e)
Returns true if the specified element has to be displayed, false otherwise. Checks the 'display' property.
Parameters:
e - the element

convertVisibility

public static boolean convertVisibility(Element e)
Returns true if the specified element is visible, false otherwise. Checks the 'visibility' property.
Parameters:
e - the element

convertOpacity

public static java.awt.Composite convertOpacity(Element e)
Returns a composite object that represents the 'opacity' of the specified element.
Parameters:
e - the element

convertOverflow

public static boolean convertOverflow(Element e)
Returns true if the 'overflow' property indicates that an additional clip is required, false otherwise. An additional clip is needed if the 'overflow' property is 'scroll' or 'hidden'.
Parameters:
e - the element with the 'overflow' property

convertClip

public static float[] convertClip(Element e)
Returns an array of floating offsets representing the 'clip' property or null if 'auto'. The offsets are specified in the order top, right, bottom, left.
Parameters:
e - the element with the 'clip' property

convertFilter

public static Filter convertFilter(Element filteredElement,
                                   GraphicsNode filteredNode,
                                   BridgeContext ctx)
Returns a Filter referenced by the specified element and which applies on the specified graphics node. Handle the 'filter' property.
Parameters:
filteredElement - the element that references the filter
filteredNode - the graphics node associated to the element to filter.
ctx - the bridge context

convertClipPath

public static ClipRable convertClipPath(Element clippedElement,
                                        GraphicsNode clippedNode,
                                        BridgeContext ctx)
Returns a Clip referenced by the specified element and which applies on the specified graphics node. Handle the 'clip-path' property.
Parameters:
clippedElement - the element that references the clip
clippedNode - the graphics node associated to the element to clip
ctx - the bridge context

convertClipRule

public static int convertClipRule(Element e)
Returns the 'clip-rule' for the specified element.
Parameters:
e - the element interested in its a 'clip-rule'
Returns:
GeneralPath.WIND_NON_ZERO | GeneralPath.WIND_EVEN_ODD

convertMask

public static Mask convertMask(Element maskedElement,
                               GraphicsNode maskedNode,
                               BridgeContext ctx)
Returns a Mask referenced by the specified element and which applies on the specified graphics node. Handle the 'mask' property.
Parameters:
maskedElement - the element that references the mask
maskedNode - the graphics node associated to the element to mask
ctx - the bridge context

convertFillRule

public static int convertFillRule(Element e)
Returns the 'fill-rule' for the specified element.
Parameters:
e - the element interested in its a 'fill-rule'
Returns:
GeneralPath.WIND_NON_ZERO | GeneralPath.WIND_EVEN_ODD

convertLightingColor

public static java.awt.Color convertLightingColor(Element e,
                                                  BridgeContext ctx)
Converts the color defined on the specified lighting filter element to a Color.
Parameters:
e - the lighting filter element
ctx - the bridge context

convertFloodColor

public static java.awt.Color convertFloodColor(Element e,
                                               BridgeContext ctx)
Converts the color defined on the specified <feFlood> element to a Color.
Parameters:
e - the feFlood element
ctx - the bridge context

convertStopColor

public static java.awt.Color convertStopColor(Element e,
                                              float opacity,
                                              BridgeContext ctx)
Converts the color defined on the specified <stop> element to a Color.
Parameters:
e - the stop element
opacity - the paint opacity
ctx - the bridge context to use

computeStyleAndURIs

public static void computeStyleAndURIs(Element refElement,
                                       Element localRefElement,
                                       java.lang.String uri)
Partially computes the style in the 'def' tree and set it in the 'use' tree.

Note: This method must be called only when 'use' has been added to the DOM tree.

Parameters:
refElement - the referenced element
localRefElement - the referenced element in the current document

rule

protected static int rule(CSSValue v)
Returns the winding rule represented by the specified CSSValue.
Parameters:
v - the value that represents the rule
Returns:
GeneralPath.WIND_NON_ZERO | GeneralPath.WIND_EVEN_ODD


Copyright © 2002 Apache Software Foundation. All Rights Reserved.