group JSWGlue; glue(effectName,peerName,genericsDecl,interfaceDecl, usercode,samplers,cleanup,srcRects,constants, pixInitY,pixInitX,posDecls,posInitY,posIncrY,posInitX,posIncrX, body) ::= << /* * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * This file was generated by JSLC -- DO NOT EDIT MANUALLY! */ package com.sun.scenario.effect.impl.sw.java; import java.nio.FloatBuffer; import java.nio.IntBuffer; import com.sun.scenario.effect.Effect; import com.sun.scenario.effect.FilterContext; import com.sun.scenario.effect.FloatMap; import com.sun.scenario.effect.ImageData; import com.sun.scenario.effect.$effectName$; import com.sun.scenario.effect.impl.BufferUtil; import com.sun.scenario.effect.impl.HeapImage; import com.sun.scenario.effect.impl.Renderer; import com.sun.scenario.effect.impl.state.*; import com.sun.javafx.geom.Rectangle; import com.sun.javafx.geom.transform.BaseTransform; public class JSW$peerName$Peer extends JSWEffectPeer$genericsDecl$ $interfaceDecl$ { public JSW$peerName$Peer(FilterContext fctx, Renderer r, String uniqueName) { super(fctx, r, uniqueName); } @Override protected final $effectName$ getEffect() { return ($effectName$)super.getEffect(); } $usercode$ @Override public ImageData filter(Effect effect, RenderState rstate, BaseTransform transform, Rectangle outputClip, ImageData... inputs) { setEffect(effect); Rectangle dstBounds = getResultBounds(transform, outputClip, inputs); setDestBounds(dstBounds); // TODO: for now, all input images must be TYPE_INT_ARGB_PRE $samplers$ $srcRects$ final int dstx = 0; final int dsty = 0; final int dstw = dstBounds.width; final int dsth = dstBounds.height; HeapImage dst = (HeapImage)getRenderer().getCompatibleImage(dstw, dsth); setDestNativeBounds(dst.getPhysicalWidth(), dst.getPhysicalHeight()); int dstscan = dst.getScanlineStride(); int[] dstPixels = dst.getPixelArray(); int dyi; float color_x, color_y, color_z, color_w; $constants$ $posDecls$ $posInitY$ for (int dy = dsty; dy < dsty+dsth; dy++) { $pixInitY$ dyi = dy*dstscan; $posInitX$ for (int dx = dstx; dx < dstx+dstw; dx++) { $pixInitX$ $body$ if (color_w < 0f) color_w = 0f; else if (color_w > 1f) color_w = 1f; if (color_x < 0f) color_x = 0f; else if (color_x > color_w) color_x = color_w; if (color_y < 0f) color_y = 0f; else if (color_y > color_w) color_y = color_w; if (color_z < 0f) color_z = 0f; else if (color_z > color_w) color_z = color_w; dstPixels[dyi+dx] = ((int)(color_x * 0xff) << 16) | ((int)(color_y * 0xff) << 8) | ((int)(color_z * 0xff) << 0) | ((int)(color_w * 0xff) << 24); $posIncrX$ } $posIncrY$ } $cleanup$ return new ImageData(getFilterContext(), dst, dstBounds); } } >>