3909N/A * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * This class abstracts a number of features for which the Java 2D 0N/A * implementation relies on proprietary licensed software libraries. 0N/A * Access to those features is now achieved by retrieving the singleton 0N/A * instance of this class and calling the appropriate methods on it. 0N/A * The 3 primary features abstracted here include: 0N/A * <dt>Shape createStrokedShape(Shape, [BasicStroke attributes]); 0N/A * <dd>This method implements the functionality of the method of the 0N/A * same name on the {@link BasicStroke} class. 0N/A * <dt>void strokeTo(Shape, [rendering parameters], PathConsumer2D); 0N/A * <dd>This method performs widening of the source path on the fly 0N/A * and sends the results to the given {@link PathConsumer2D} object. 0N/A * This procedure avoids having to create an intermediate Shape 0N/A * object to hold the results of the {@code createStrokedShape} method. 0N/A * The main user of this method is the Java 2D non-antialiasing renderer. 0N/A * <dt>AATileGenerator getAATileGenerator(Shape, [rendering parameters]); 0N/A * <dd>This method returns an object which can iterate over the 0N/A * specified bounding box and produce tiles of coverage values for 0N/A * antialiased rendering. The details of the operation of the 0N/A * {@link AATileGenerator} object are explained in its class comments. 0N/A * Additionally, the following informational method supplies important 0N/A * data about the implementation. 0N/A * <dt>float getMinimumAAPenSize() 0N/A * <dd>This method provides information on how small the BasicStroke 0N/A * line width can get before dropouts occur. Rendering with a BasicStroke 0N/A * is defined to never allow the line to have breaks, gaps, or dropouts 0N/A * even if the width is set to 0.0f, so this information allows the 0N/A * {@link SunGraphics2D} class to detect the "thin line" case and set 0N/A * the rendering attributes accordingly. 0N/A * At startup the runtime will load a single instance of this class. 0N/A * It searches the classpath for a registered provider of this API 0N/A * and returns either the last one it finds, or the instance whose 0N/A * class name matches the value supplied in the System property 0N/A * Additionally, a runtime System property flag can be set to trace 0N/A * all calls to methods on the {@code RenderingEngine} in use by 0N/A * setting the sun.java2d.renderer.trace property to any non-null value. 0N/A * Parts of the system that need to use any of the above features should 0N/A * call {@code RenderingEngine.getInstance()} to obtain the properly 0N/A * registered (and possibly trace-enabled) version of the RenderingEngine. 0N/A * Returns an instance of {@code RenderingEngine} as determined 0N/A * by the installation environment and runtime flags. 0N/A * A specific instance of the {@code RenderingEngine} can be 0N/A * chosen by specifying the runtime flag: 1181N/A * If no specific {@code RenderingEngine} is specified on the command 1181N/A * or Ductus renderer is specified, it will attempt loading the 1181N/A * sun.dc.DuctusRenderingEngine class using Class.forName as a fastpath; 1181N/A * if not found, use the ServiceLoader. 0N/A * If no specific {@code RenderingEngine} is specified on the command 0N/A * line then the last one returned by enumerating all subclasses of 0N/A * {@code RenderingEngine} known to the ServiceLoader is used. 0N/A * Runtime tracing of the actions of the {@code RenderingEngine} 0N/A * can be enabled by specifying the runtime flag: 0N/A * @return an instance of {@code RenderingEngine} 0N/A * Create a widened path as specified by the parameters. 0N/A * The specified {@code src} {@link Shape} is widened according 0N/A * to the specified attribute parameters as per the 0N/A * {@link BasicStroke} specification. 0N/A * @param src the source path to be widened 0N/A * @param width the width of the widened path as per {@code BasicStroke} 0N/A * @param caps the end cap decorations as per {@code BasicStroke} 0N/A * @param join the segment join decorations as per {@code BasicStroke} 0N/A * @param miterlimit the miter limit as per {@code BasicStroke} 0N/A * @param dashes the dash length array as per {@code BasicStroke} 0N/A * @param dashphase the initial dash phase as per {@code BasicStroke} 0N/A * @return the widened path stored in a new {@code Shape} object 0N/A * Sends the geometry for a widened path as specified by the parameters 0N/A * to the specified consumer. 0N/A * The specified {@code src} {@link Shape} is widened according 0N/A * to the parameters specified by the {@link BasicStroke} object. 0N/A * Adjustments are made to the path as appropriate for the 0N/A * {@link VALUE_STROKE_NORMALIZE} hint if the {@code normalize} 0N/A * boolean parameter is true. 0N/A * Adjustments are made to the path as appropriate for the 0N/A * {@link VALUE_ANTIALIAS_ON} hint if the {@code antialias} 0N/A * boolean parameter is true. 0N/A * The geometry of the widened path is forwarded to the indicated 0N/A * {@link PathConsumer2D} object as it is calculated. 0N/A * @param src the source path to be widened 0N/A * @param bs the {@code BasicSroke} object specifying the 0N/A * decorations to be applied to the widened path 0N/A * @param normalize indicates whether stroke normalization should 0N/A * @param antialias indicates whether or not adjustments appropriate 0N/A * to antialiased rendering should be applied 0N/A * @param consumer the {@code PathConsumer2D} instance to forward 0N/A * the widened geometry to 0N/A * Construct an antialiased tile generator for the given shape with 0N/A * the given rendering attributes and store the bounds of the tile 0N/A * iteration in the bbox parameter. 0N/A * The {@code at} parameter specifies a transform that should affect 0N/A * both the shape and the {@code BasicStroke} attributes. 0N/A * The {@code clip} parameter specifies the current clip in effect 0N/A * in device coordinates and can be used to prune the data for the 0N/A * operation, but the renderer is not required to perform any 0N/A * If the {@code BasicStroke} parameter is null then the shape 0N/A * should be filled as is, otherwise the attributes of the 0N/A * {@code BasicStroke} should be used to specify a draw operation. 0N/A * The {@code thin} parameter indicates whether or not the 0N/A * transformed {@code BasicStroke} represents coordinates smaller 0N/A * than the minimum resolution of the antialiasing rasterizer as 0N/A * specified by the {@code getMinimumAAPenWidth()} method. 0N/A * Upon returning, this method will fill the {@code bbox} parameter 0N/A * with 4 values indicating the bounds of the iteration of the 0N/A * The iteration order of the tiles will be as specified by the 0N/A * for (y = bbox[1]; y < bbox[3]; y += tileheight) { 0N/A * for (x = bbox[0]; x < bbox[2]; x += tilewidth) { 0N/A * If there is no output to be rendered, this method may return 0N/A * @param s the shape to be rendered (fill or draw) 0N/A * @param at the transform to be applied to the shape and the 0N/A * @param clip the current clip in effect in device coordinates 0N/A * @param bs if non-null, a {@code BasicStroke} whose attributes 0N/A * should be applied to this operation 0N/A * @param thin true if the transformed stroke attributes are smaller 0N/A * than the minimum dropout pen width 0N/A * @param normalize true if the {@code VALUE_STROKE_NORMALIZE} 0N/A * {@code RenderingHint} is in effect 0N/A * @param bbox returns the bounds of the iteration 0N/A * @return the {@code AATileGenerator} instance to be consulted 0N/A * for tile coverages, or null if there is no output to render 3265N/A * Construct an antialiased tile generator for the given parallelogram 3265N/A * store the bounds of the tile iteration in the bbox parameter. 3265N/A * The parallelogram is specified as a starting point and 2 delta 3265N/A * vectors that indicate the slopes of the 2 pairs of sides of the 3265N/A * The 4 corners of the parallelogram are defined by the 4 points: 3265N/A * <li> {@code x}, {@code y} 3265N/A * <li> {@code x+dx1}, {@code y+dy1} 3265N/A * <li> {@code x+dx1+dx2}, {@code y+dy1+dy2} 3265N/A * <li> {@code x+dx2}, {@code y+dy2} 3265N/A * The {@code lw1} and {@code lw2} parameters provide a specification 3265N/A * for an optionally stroked parallelogram if they are positive numbers. 3265N/A * The {@code lw1} parameter is the ratio of the length of the {@code dx1}, 3265N/A * {@code dx2} delta vector to half of the line width in that same 3265N/A * The {@code lw2} parameter provides the same ratio for the other delta 3265N/A * If {@code lw1} and {@code lw2} are both greater than zero, then 3265N/A * the parallelogram figure is doubled by both expanding and contracting 3265N/A * each delta vector by its corresponding {@code lw} value. 3265N/A * If either (@code lw1) or {@code lw2} are also greater than 1, then 3265N/A * the inner (contracted) parallelogram disappears and the figure is 3265N/A * simply a single expanded parallelogram. 3265N/A * The {@code clip} parameter specifies the current clip in effect 3265N/A * in device coordinates and can be used to prune the data for the 3265N/A * operation, but the renderer is not required to perform any 3265N/A * Upon returning, this method will fill the {@code bbox} parameter 3265N/A * with 4 values indicating the bounds of the iteration of the 3265N/A * The iteration order of the tiles will be as specified by the 3265N/A * for (y = bbox[1]; y < bbox[3]; y += tileheight) { 3265N/A * for (x = bbox[0]; x < bbox[2]; x += tilewidth) { 3265N/A * If there is no output to be rendered, this method may return 3265N/A * @param x the X coordinate of the first corner of the parallelogram 3265N/A * @param y the Y coordinate of the first corner of the parallelogram 3265N/A * @param dx1 the X coordinate delta of the first leg of the parallelogram 3265N/A * @param dy1 the Y coordinate delta of the first leg of the parallelogram 3265N/A * @param dx2 the X coordinate delta of the second leg of the parallelogram 3265N/A * @param dy2 the Y coordinate delta of the second leg of the parallelogram 3265N/A * @param lw1 the line width ratio for the first leg of the parallelogram 3265N/A * @param lw2 the line width ratio for the second leg of the parallelogram 3265N/A * @param clip the current clip in effect in device coordinates 3265N/A * @param bbox returns the bounds of the iteration 3265N/A * @return the {@code AATileGenerator} instance to be consulted 3265N/A * for tile coverages, or null if there is no output to render 0N/A * Returns the minimum pen width that the antialiasing rasterizer 0N/A * can represent without dropouts occuring. 0N/A * Utility method to feed a {@link PathConsumer2D} object from a 0N/A * given {@link PathIterator}. 0N/A * This method deals with the details of running the iterator and 0N/A * feeding the consumer a segment at a time.