@Override protected void bindScriptValues() { int width = getInPixelsAllocation().getType().getX(); int height = getInPixelsAllocation().getType().getY(); /// M: [BUG.ADD] @{ // null pointer check. @{ if (mScript == null) return; /// @} mScript.set_inputWidth(width); mScript.set_inputHeight(height); }
@Override public void resetScripts() { if (mScript != null) { mScript.destroy(); mScript = null; } }
@Override protected void runFilter() { int[] x1 = mParameters.getXPos1(); int[] y1 = mParameters.getYPos1(); int[] x2 = mParameters.getXPos2(); int[] y2 = mParameters.getYPos2(); int width = getInPixelsAllocation().getType().getX(); int height = getInPixelsAllocation().getType().getY(); Matrix m = getOriginalToScreenMatrix(width, height); float[] coord = new float[2]; for (int i = 0; i < x1.length; i++) { coord[0] = x1[i]; coord[1] = y1[i]; m.mapPoints(coord); x1[i] = (int) coord[0]; y1[i] = (int) coord[1]; coord[0] = x2[i]; coord[1] = y2[i]; m.mapPoints(coord); x2[i] = (int) coord[0]; y2[i] = (int) coord[1]; } mScript.set_mask(mParameters.getMask()); mScript.set_xPos1(x1); mScript.set_yPos1(y1); mScript.set_xPos2(x2); mScript.set_yPos2(y2); mScript.set_brightness(mParameters.getBrightness()); mScript.set_contrast(mParameters.getContrast()); mScript.set_saturation(mParameters.getSaturation()); mScript.invoke_setupGradParams(); runSelectiveAdjust(getInPixelsAllocation(), getOutPixelsAllocation()); }
private void runSelectiveAdjust(Allocation in, Allocation out) { int width = in.getType().getX(); int height = in.getType().getY(); LaunchOptions options = new LaunchOptions(); int ty; options.setX(0, width); for (ty = 0; ty < height; ty += STRIP_SIZE) { int endy = ty + STRIP_SIZE; if (endy > height) { endy = height; } options.setY(ty, endy); mScript.forEach_selectiveAdjust(in, out, options); if (checkStop()) { return; } } }