< prev index next >

src/java.desktop/share/classes/java/awt/image/ImageFilter.java

Print this page


   1 /*
   2  * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  26 package java.awt.image;
  27 
  28 import java.util.Hashtable;
  29 
  30 /**
  31  * This class implements a filter for the set of interface methods that
  32  * are used to deliver data from an ImageProducer to an ImageConsumer.
  33  * It is meant to be used in conjunction with a FilteredImageSource
  34  * object to produce filtered versions of existing images.  It is a
  35  * base class that provides the calls needed to implement a "Null filter"
  36  * which has no effect on the data being passed through.  Filters should
  37  * subclass this class and override the methods which deal with the
  38  * data that needs to be filtered and modify it as necessary.
  39  *
  40  * @see FilteredImageSource
  41  * @see ImageConsumer
  42  *
  43  * @author      Jim Graham
  44  */
  45 public class ImageFilter implements ImageConsumer, Cloneable {






  46     /**
  47      * The consumer of the particular image data stream for which this
  48      * instance of the ImageFilter is filtering data.  It is not
  49      * initialized during the constructor, but rather during the
  50      * getFilterInstance() method call when the FilteredImageSource
  51      * is creating a unique instance of this object for a particular
  52      * image data stream.
  53      * @see #getFilterInstance
  54      * @see ImageConsumer
  55      */
  56     protected ImageConsumer consumer;
  57 
  58     /**
  59      * Returns a unique instance of an ImageFilter object which will
  60      * actually perform the filtering for the specified ImageConsumer.
  61      * The default implementation just clones this object.
  62      * <p>
  63      * Note: This method is intended to be called by the ImageProducer
  64      * of the Image whose pixels are being filtered.  Developers using
  65      * this class to filter pixels from an image should avoid calling


   1 /*
   2  * Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  26 package java.awt.image;
  27 
  28 import java.util.Hashtable;
  29 
  30 /**
  31  * This class implements a filter for the set of interface methods that
  32  * are used to deliver data from an ImageProducer to an ImageConsumer.
  33  * It is meant to be used in conjunction with a FilteredImageSource
  34  * object to produce filtered versions of existing images.  It is a
  35  * base class that provides the calls needed to implement a "Null filter"
  36  * which has no effect on the data being passed through.  Filters should
  37  * subclass this class and override the methods which deal with the
  38  * data that needs to be filtered and modify it as necessary.
  39  *
  40  * @see FilteredImageSource
  41  * @see ImageConsumer
  42  *
  43  * @author      Jim Graham
  44  */
  45 public class ImageFilter implements ImageConsumer, Cloneable {
  46 
  47     /**
  48      * Creates an {@code ImageFilter}
  49      */
  50     public ImageFilter() {}
  51 
  52     /**
  53      * The consumer of the particular image data stream for which this
  54      * instance of the ImageFilter is filtering data.  It is not
  55      * initialized during the constructor, but rather during the
  56      * getFilterInstance() method call when the FilteredImageSource
  57      * is creating a unique instance of this object for a particular
  58      * image data stream.
  59      * @see #getFilterInstance
  60      * @see ImageConsumer
  61      */
  62     protected ImageConsumer consumer;
  63 
  64     /**
  65      * Returns a unique instance of an ImageFilter object which will
  66      * actually perform the filtering for the specified ImageConsumer.
  67      * The default implementation just clones this object.
  68      * <p>
  69      * Note: This method is intended to be called by the ImageProducer
  70      * of the Image whose pixels are being filtered.  Developers using
  71      * this class to filter pixels from an image should avoid calling


< prev index next >