Paint.java revision 0
0N/A * Copyright 1997-2007 Sun Microsystems, Inc. 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 0N/A * published by the Free Software Foundation. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Sun 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. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A * This <code>Paint</code> interface defines how color patterns 0N/A * can be generated for {@link Graphics2D} operations. A class 0N/A * implementing the <code>Paint</code> interface is added to the 0N/A * <code>Graphics2D</code> context in order to define the color 0N/A * pattern used by the <code>draw</code> and <code>fill</code> methods. 0N/A * Instances of classes implementing <code>Paint</code> must be 0N/A * read-only because the <code>Graphics2D</code> does not clone 0N/A * these objects when they are set as an attribute with the 0N/A * <code>setPaint</code> method or when the <code>Graphics2D</code> 0N/A * object is itself cloned. 0N/A * @see GradientPaint 0N/A * @see Graphics2D#setPaint 0N/A * Creates and returns a {@link PaintContext} used to 0N/A * generate the color pattern. 0N/A * Since the ColorModel argument to createContext is only a 0N/A * hint, implementations of Paint should accept a null argument 0N/A * for ColorModel. Note that if the application does not 0N/A * prefer a specific ColorModel, the null ColorModel argument 0N/A * will give the Paint implementation full leeway in using the 0N/A * most efficient ColorModel it prefers for its raster processing. 0N/A * Since the API documentation was not specific about this in 0N/A * releases before 1.4, there may be implementations of 0N/A * <code>Paint</code> that do not accept a null 0N/A * <code>ColorModel</code> argument. 0N/A * If a developer is writing code which passes a null 0N/A * <code>ColorModel</code> argument to the 0N/A * <code>createContext</code> method of <code>Paint</code> 0N/A * objects from arbitrary sources it would be wise to code defensively 0N/A * by manufacturing a non-null <code>ColorModel</code> for those 0N/A * objects which throw a <code>NullPointerException</code>. 0N/A * @param cm the {@link ColorModel} that receives the 0N/A * <code>Paint</code> data. This is used only as a hint. 0N/A * @param deviceBounds the device space bounding box 0N/A * of the graphics primitive being rendered 0N/A * @param userBounds the user space bounding box 0N/A * of the graphics primitive being rendered 0N/A * @param xform the {@link AffineTransform} from user 0N/A * space into device space 0N/A * @param hints the hint that the context object uses to 0N/A * choose between rendering alternatives 0N/A * @return the <code>PaintContext</code> for 0N/A * generating color patterns