1 /*
   2  * Copyright (c) 2009, 2013, 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
  23  * questions.
  24  */
  25 
  26 package com.sun.scenario.effect;
  27 
  28 /**
  29  * An implementation supertype for both Gaussian and Box filter based
  30  * shadows to facilitate their conditional usage inside the various
  31  * composite shadow effects like DropShadow and InnerShadow.
  32  *
  33  * The radius, width and height parameters all refer to the corresponding
  34  * dimension that a "Gaussian" blur filter would use - other shadow
  35  * implementations will have to use whatever parameters produce a
  36  * similar effect.
  37  * The width and height parameters should relate to the radius parameter
  38  * by the equation {@code w,h = 2 * r + 1} and if the width and height are
  39  * set to something different then the radius parameter will be an average
  40  * of the corresponding individual dimensional radius values.
  41  */
  42 public abstract class AbstractShadow extends LinearConvolveCoreEffect {
  43     public AbstractShadow(Effect input) {
  44         super(input);
  45     }
  46 
  47     public enum ShadowMode {
  48         ONE_PASS_BOX,
  49         TWO_PASS_BOX,
  50         THREE_PASS_BOX,
  51         GAUSSIAN,
  52     }
  53 
  54     public abstract ShadowMode getMode();
  55     public abstract AbstractShadow implFor(ShadowMode m);
  56     public abstract float getGaussianRadius();
  57     public abstract void  setGaussianRadius(float r);
  58     public abstract float getGaussianWidth();
  59     public abstract void  setGaussianWidth(float w);
  60     public abstract float getGaussianHeight();
  61     public abstract void  setGaussianHeight(float h);
  62     public abstract float getSpread();
  63     public abstract void  setSpread(float spread);
  64     public abstract Color4f getColor();
  65     public abstract void setColor(Color4f c);
  66     public abstract Effect getInput();
  67     public abstract void setInput(Effect input);
  68 }