0N/A/*
2362N/A * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
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 *
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 *
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 *
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
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.awt;
0N/A
0N/Aimport java.awt.image.ColorModel;
0N/A
0N/A/**
0N/A * The <code>Composite</code> interface, along with
0N/A * {@link CompositeContext}, defines the methods to compose a draw
0N/A * primitive with the underlying graphics area.
0N/A * After the <code>Composite</code> is set in the
0N/A * {@link Graphics2D} context, it combines a shape, text, or an image
0N/A * being rendered with the colors that have already been rendered
0N/A * according to pre-defined rules. The classes
0N/A * implementing this interface provide the rules and a method to create
0N/A * the context for a particular operation.
0N/A * <code>CompositeContext</code> is an environment used by the
0N/A * compositing operation, which is created by the <code>Graphics2D</code>
0N/A * prior to the start of the operation. <code>CompositeContext</code>
0N/A * contains private information and resources needed for a compositing
0N/A * operation. When the <code>CompositeContext</code> is no longer needed,
0N/A * the <code>Graphics2D</code> object disposes of it in order to reclaim
0N/A * resources allocated for the operation.
0N/A * <p>
0N/A * Instances of classes implementing <code>Composite</code> must be
0N/A * immutable because the <code>Graphics2D</code> does not clone
0N/A * these objects when they are set as an attribute with the
0N/A * <code>setComposite</code> method or when the <code>Graphics2D</code>
0N/A * object is cloned. This is to avoid undefined rendering behavior of
0N/A * <code>Graphics2D</code>, resulting from the modification of
0N/A * the <code>Composite</code> object after it has been set in the
0N/A * <code>Graphics2D</code> context.
0N/A * <p>
0N/A * Since this interface must expose the contents of pixels on the
0N/A * target device or image to potentially arbitrary code, the use of
0N/A * custom objects which implement this interface when rendering directly
0N/A * to a screen device is governed by the <code>readDisplayPixels</code>
0N/A * {@link AWTPermission}. The permission check will occur when such
0N/A * a custom object is passed to the <code>setComposite</code> method
0N/A * of a <code>Graphics2D</code> retrieved from a {@link Component}.
0N/A * @see AlphaComposite
0N/A * @see CompositeContext
0N/A * @see Graphics2D#setComposite
0N/A */
0N/Apublic interface Composite {
0N/A
0N/A /**
0N/A * Creates a context containing state that is used to perform
0N/A * the compositing operation. In a multi-threaded environment,
0N/A * several contexts can exist simultaneously for a single
0N/A * <code>Composite</code> object.
0N/A * @param srcColorModel the {@link ColorModel} of the source
0N/A * @param dstColorModel the <code>ColorModel</code> of the destination
0N/A * @param hints the hint that the context object uses to choose between
0N/A * rendering alternatives
0N/A * @return the <code>CompositeContext</code> object used to perform the
0N/A * compositing operation.
0N/A */
0N/A public CompositeContext createContext(ColorModel srcColorModel,
0N/A ColorModel dstColorModel,
0N/A RenderingHints hints);
0N/A
0N/A}