modules/graphics/src/main/java/com/sun/scenario/effect/BoxShadow.java

Print this page

        

*** 31,40 **** --- 31,41 ---- import com.sun.javafx.geom.RectBounds; import com.sun.javafx.geom.Rectangle; import com.sun.javafx.geom.transform.BaseTransform; import com.sun.scenario.effect.impl.Renderer; import com.sun.scenario.effect.impl.state.BoxShadowState; + import com.sun.scenario.effect.impl.state.LinearConvolveKernel; /** * A shadow effect using a box-shaped convolution kernel, with a configurable * size for each dimension of the kernel and a number of passes to control * the quality of the blur.
*** 119,129 **** setColor(Color4f.BLACK); setSpread(0f); } @Override ! Object getState() { return state; } /** * Returns the input for this {@code Effect}. --- 120,130 ---- setColor(Color4f.BLACK); setSpread(0f); } @Override ! LinearConvolveKernel getState() { return state; } /** * Returns the input for this {@code Effect}.
*** 149,159 **** /** * Returns the horizontal size of the effect kernel. * * @return the horizontal size of the effect kernel */ ! public int getHorizontalSize() { return state.getHsize(); } /** * Sets the horizontal size of the effect kernel. --- 150,160 ---- /** * Returns the horizontal size of the effect kernel. * * @return the horizontal size of the effect kernel */ ! public float getHorizontalSize() { return state.getHsize(); } /** * Sets the horizontal size of the effect kernel.
*** 166,186 **** * * @param hsize the horizontal size of the effect kernel * @throws IllegalArgumentException if {@code hsize} * is outside the allowable range */ ! public void setHorizontalSize(int hsize) { ! int old = state.getHsize(); state.setHsize(hsize); } /** * Returns the vertical size of the effect kernel. * * @return the vertical size of the effect kernel */ ! public int getVerticalSize() { return state.getVsize(); } /** * Sets the vertical size of the effect kernel. --- 167,186 ---- * * @param hsize the horizontal size of the effect kernel * @throws IllegalArgumentException if {@code hsize} * is outside the allowable range */ ! public final void setHorizontalSize(float hsize) { state.setHsize(hsize); } /** * Returns the vertical size of the effect kernel. * * @return the vertical size of the effect kernel */ ! public float getVerticalSize() { return state.getVsize(); } /** * Sets the vertical size of the effect kernel.
*** 193,204 **** * * @param vsize the vertical size of the effect kernel * @throws IllegalArgumentException if {@code vsize} * is outside the allowable range */ ! public void setVerticalSize(int vsize) { ! int old = state.getVsize(); state.setVsize(vsize); } /** * Returns the number of passes of the effect kernel to control the --- 193,203 ---- * * @param vsize the vertical size of the effect kernel * @throws IllegalArgumentException if {@code vsize} * is outside the allowable range */ ! public final void setVerticalSize(float vsize) { state.setVsize(vsize); } /** * Returns the number of passes of the effect kernel to control the
*** 224,235 **** * * @param passes * @throws IllegalArgumentException if {@code passes} is outside the * allowable range */ ! public void setPasses(int passes) { ! int old = state.getBlurPasses(); state.setBlurPasses(passes); } /** * Returns the shadow color. --- 223,233 ---- * * @param passes * @throws IllegalArgumentException if {@code passes} is outside the * allowable range */ ! public final void setPasses(int passes) { state.setBlurPasses(passes); } /** * Returns the shadow color.
*** 250,261 **** * </pre> * * @param color the shadow color * @throws IllegalArgumentException if {@code color} is null */ ! public void setColor(Color4f color) { ! Color4f old = state.getShadowColor(); state.setShadowColor(color); } /** * Gets the spread of the shadow effect. --- 248,258 ---- * </pre> * * @param color the shadow color * @throws IllegalArgumentException if {@code color} is null */ ! public final void setColor(Color4f color) { state.setShadowColor(color); } /** * Gets the spread of the shadow effect.
*** 286,297 **** * * @param spread the spread of the shadow effect * @throws IllegalArgumentException if {@code spread} is outside the * allowable range */ ! public void setSpread(float spread) { ! float old = state.getSpread(); state.setSpread(spread); } public float getGaussianRadius() { float d = (getHorizontalSize() + getVerticalSize()) / 2.0f; --- 283,293 ---- * * @param spread the spread of the shadow effect * @throws IllegalArgumentException if {@code spread} is outside the * allowable range */ ! public final void setSpread(float spread) { state.setSpread(spread); } public float getGaussianRadius() { float d = (getHorizontalSize() + getVerticalSize()) / 2.0f;
*** 383,425 **** r.intersectWith(outputClip); return r; } @Override - public ImageData filterImageDatas(FilterContext fctx, - BaseTransform transform, - Rectangle outputClip, - ImageData... inputs) - { - return state.filterImageDatas(this, fctx, transform, outputClip, inputs); - } - - @Override - public boolean operatesInUserSpace() { - return true; - } - - @Override - protected Rectangle getInputClip(int inputIndex, - BaseTransform transform, - Rectangle outputClip) - { - // A blur needs as much "fringe" data from its input as it creates - // around its output so we use the same expansion as is used in the - // result bounds. - if (outputClip != null) { - int hgrow = state.getKernelSize(0) / 2; - int vgrow = state.getKernelSize(1) / 2; - if ((hgrow | vgrow) != 0) { - outputClip = new Rectangle(outputClip); - outputClip.grow(hgrow, vgrow); - } - } - return outputClip; - } - - @Override public boolean reducesOpaquePixels() { return true; } @Override --- 379,388 ----