jdk/src/share/classes/java/awt/image/ImageProducer.java
author prr
Tue, 06 Aug 2013 17:12:37 -0700
changeset 19169 1807a84c3d63
parent 5506 202f599c92aa
child 23010 6dadb192ad81
permissions -rw-r--r--
8022447: Fix doclint warnings in java.awt.image Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1995, 2000, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.awt.image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * The interface for objects which can produce the image data for Images.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * Each image contains an ImageProducer which is used to reconstruct
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * the image whenever it is needed, for example, when a new size of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * Image is scaled, or when the width or height of the Image is being
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * requested.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * @see ImageConsumer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * @author      Jim Graham
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
public interface ImageProducer {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
     * Registers an <code>ImageConsumer</code> with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
     * <code>ImageProducer</code> for access to the image data
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
     * during a later reconstruction of the <code>Image</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
     * The <code>ImageProducer</code> may, at its discretion,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
     * start delivering the image data to the consumer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
     * using the <code>ImageConsumer</code> interface immediately,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     * or when the next available image reconstruction is triggered
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     * by a call to the <code>startProduction</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     * @param ic the specified <code>ImageConsumer</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * @see #startProduction
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    public void addConsumer(ImageConsumer ic);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * Determines if a specified <code>ImageConsumer</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * object is currently registered with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * <code>ImageProducer</code> as one of its consumers.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * @param ic the specified <code>ImageConsumer</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * @return <code>true</code> if the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     *         <code>ImageConsumer</code> is registered with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     *         this <code>ImageProducer</code>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     *         <code>false</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    public boolean isConsumer(ImageConsumer ic);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * Removes the specified <code>ImageConsumer</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * from the list of consumers currently registered to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * receive image data.  It is not considered an error
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * to remove a consumer that is not currently registered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * The <code>ImageProducer</code> should stop sending data
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * to this consumer as soon as is feasible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * @param ic the specified <code>ImageConsumer</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    public void removeConsumer(ImageConsumer ic);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * Registers the specified <code>ImageConsumer</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * as a consumer and starts an immediate reconstruction of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * the image data which will then be delivered to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * consumer and any other consumer which might have already
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * been registered with the producer.  This method differs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * from the addConsumer method in that a reproduction of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * the image data should be triggered as soon as possible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * @param ic the specified <code>ImageConsumer</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * @see #addConsumer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    public void startProduction(ImageConsumer ic);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * Requests, on behalf of the <code>ImageConsumer</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * that the <code>ImageProducer</code> attempt to resend
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * the image data one more time in TOPDOWNLEFTRIGHT order
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * so that higher quality conversion algorithms which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * depend on receiving pixels in order can be used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * produce a better output version of the image.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * <code>ImageProducer</code> is free to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * ignore this call if it cannot resend the data in that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * order.  If the data can be resent, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * <code>ImageProducer</code> should respond by executing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * the following minimum set of <code>ImageConsumer</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * method calls:
19169
1807a84c3d63 8022447: Fix doclint warnings in java.awt.image
prr
parents: 5506
diff changeset
   103
     * <pre>{@code
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *  ic.setHints(TOPDOWNLEFTRIGHT | < otherhints >);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     *  ic.setPixels(...);      // As many times as needed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *  ic.imageComplete();
19169
1807a84c3d63 8022447: Fix doclint warnings in java.awt.image
prr
parents: 5506
diff changeset
   107
     * }</pre>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @param ic the specified <code>ImageConsumer</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * @see ImageConsumer#setHints
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    public void requestTopDownLeftRightResend(ImageConsumer ic);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
}