tkormann 01/07/26 07:01:58 Modified: sources/org/apache/batik/bridge CSSUtilities.java Log: Add some documentation about how the Java2D rendering hints and the SVG rendering hints are marched in the bridge module. Revision Changes Path 1.30 +107 -3 xml-batik/sources/org/apache/batik/bridge/CSSUtilities.java Index: CSSUtilities.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/CSSUtilities.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- CSSUtilities.java 2001/07/25 14:44:49 1.29 +++ CSSUtilities.java 2001/07/26 14:01:58 1.30 @@ -66,7 +66,7 @@ * concrete objects regarding to CSS properties. * * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> - * @version $Id: CSSUtilities.java,v 1.29 2001/07/25 14:44:49 deweese Exp $ + * @version $Id: CSSUtilities.java,v 1.30 2001/07/26 14:01:58 tkormann Exp $ */ public abstract class CSSUtilities implements CSSConstants, ErrorConstants { @@ -198,6 +198,33 @@ * Returns the rendering hints for the specified shape element or null * none has been specified. Checks the 'shape-rendering' property. * + * <p>Here is how the mapping between SVG rendering hints and the Java2D + * rendering hints is done:</p> + * + * <dl> + * <dt>'optimizeSpeed':</dt> + * <dd> + * <ul> + * <li>KEY_RENDERING=VALUE_RENDER_SPEED</li> + * <li>KEY_ANTIALIASING=VALUE_ANTIALIAS_OFF</li> + * </ul> + * </dd> + * <dt>'crispEdges':</dt> + * <dd> + * <ul> + * <li>KEY_RENDERING=VALUE_RENDER_DEFAULT</li> + * <li>KEY_ANTIALIASING=VALUE_ANTIALIAS_OFF</li> + * </ul> + * </dd> + * <dt>'geometricPrecision':</dt> + * <dd> + * <ul> + * <li>KEY_RENDERING=VALUE_RENDER_QUALITY</li> + * <li>KEY_ANTIALIASING=VALUE_ANTIALIAS_ON</li> + * </ul> + * </dd> + * </dl> + * * @param e the element */ public static Map convertShapeRendering(Element e) { @@ -236,6 +263,43 @@ * Returns the rendering hints for the specified text element or null * none has been specified. Checks the 'text-rendering' property. * + * <p>Here is how the mapping between SVG rendering hints and the Java2D + * rendering hints is done:</p> + * + * <dl> + * <dt>'optimizeSpeed':</dt> + * <dd> + * <ul> + * <li>KEY_RENDERING=VALUE_RENDER_SPEED</li> + * <li>KEY_ANTIALIASING=VALUE_ANTIALIAS_OFF</li> + * <li>KEY_TEXT_ANTIALIASING=VALUE_TEXT_ANTIALIAS_OFF</li> + * <li>KEY_FRACTIONALMETRICS=VALUE_FRACTIONALMETRICS_OFF</li> + * </ul> + * </dd> + * <dt>'optimizeLegibility':</dt> + * <dd> + * <ul> + * <li>KEY_RENDERING=VALUE_RENDER_QUALITY</li> + * <li>KEY_ANTIALIASING=VALUE_ANTIALIAS_ON</li> + * <li>KEY_TEXT_ANTIALIASING=VALUE_TEXT_ANTIALIAS_ON</li> + * <li>KEY_FRACTIONALMETRICS=VALUE_FRACTIONALMETRICS_OFF</li> + * </ul> + * </dd> + * <dt>'geometricPrecision':</dt> + * <dd> + * <ul> + * <li>KEY_RENDERING=VALUE_RENDER_QUALITY</li> + * <li>KEY_ANTIALIASING=VALUE_ANTIALIAS_DEFAULT</li> + * <li>KEY_TEXT_ANTIALIASING=VALUE_TEXT_ANTIALIAS_DEFAULT</li> + * <li>KEY_FRACTIONALMETRICS=VALUE_FRACTIONALMETRICS_ON</li> + * </ul> + * </dd> + * </dl> + * + * <p>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...).</p> + * * @param e the element */ public static Map convertTextRendering(Element e) { @@ -286,6 +350,26 @@ * Returns the rendering hints for the specified image element or null * none has been specified. Checks the 'image-rendering' property. * + * <p>Here is how the mapping between SVG rendering hints and the Java2D + * rendering hints is done:</p> + * + * <dl> + * <dt>'optimizeSpeed':</dt> + * <dd> + * <ul> + * <li>KEY_RENDERING=VALUE_RENDER_SPEED</li> + * <li>KEY_INTERPOLATION=VALUE_INTERPOLATION_NEAREST_NEIGHBOR</li> + * </ul> + * </dd> + * <dt>'optimizeQuality':</dt> + * <dd> + * <ul> + * <li>KEY_RENDERING=VALUE_RENDER_QUALITY</li> + * <li>KEY_INTERPOLATION=VALUE_INTERPOLATION_BICUBIC</li> + * </ul> + * </dd> + * </dl> + * * @param e the element */ public static Map convertImageRendering(Element e) { @@ -318,6 +402,26 @@ * Returns the rendering hints for the specified element or null * none has been specified. Checks the 'color-rendering' property. * + * <p>Here is how the mapping between SVG rendering hints and the Java2D + * rendering hints is done:</p> + * + * <dl> + * <dt>'optimizeSpeed':</dt> + * <dd> + * <ul> + * <li>KEY_COLOR_RENDERING=VALUE_COLOR_RENDER_SPEED</li> + * <li>KEY_ALPHA_INTERPOLATION=VALUE_ALPHA_INTERPOLATION_SPEED</li> + * </ul> + * </dd> + * <dt>'optimizeQuality':</dt> + * <dd> + * <ul> + * <li>KEY_COLOR_RENDERING=VALUE_COLOR_RENDER_QUALITY</li> + * <li>KEY_ALPHA_INTERPOLATION=VALUE_ALPHA_INTERPOLATION_QUALITY</li> + * </ul> + * </dd> + * </dl> + * * @param e the element */ public static Map convertColorRendering(Element e) { @@ -391,7 +495,7 @@ // 'opacity' ///////////////////////////////////////////////////////////////////////// - public final static Composite transparent = + public final static Composite TRANSPARENT = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0); /** @@ -406,7 +510,7 @@ (CSS_OPACITY_PROPERTY); float opacity = PaintServer.convertOpacity(v); if (opacity <= 0f) { - return transparent; + return TRANSPARENT; } else if (opacity >= 1f) { return AlphaComposite.SrcOver; } else { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]