Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- JWildfire - an image and animation processor written in Java
- Copyright (C) 1995-2011 Andreas Maschke
- This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser
- General Public License as published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
- This software 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
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along with this software;
- if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
- package org.jwildfire.create.tina.variation;
- import org.jwildfire.base.Tools;
- public class DCCracklePFunc extends DCCrackleWFFunc {
- private static final long serialVersionUID = 1L;
- public static final String PARAM_PRESET = "preset";
- public static final String PARAM_Z = "z"; // private in class CrackleFunc for some reason
- private static final String[] additionalParamNames = { PARAM_PRESET };
- private int preset = 0;
- private double pcellsize = 1.0;
- private double ppower = 0.2;
- private double pdistort = 0.0;
- private double pscale = 1.0;
- private double pz = 0.0;
- // dc_crackleP_wf by Brad Stefanov and Rick Sidwell
- // This is a specialization of dc_crackle_wf by Andreas Maschke, which is a specialization of crackle, originally invented
- // by Neil Slater, see http://slobo777.deviantart.com/art/Apo-Plugins-Hexes-And-Crackle-99243824.
- // It is based on the Crackle Styles Chooser script by Ian Anderson and Anu Wilde (adapted for JWildfire by Mick Hogan).
- // An additional parameter "preset" will set the other parameters; see the script for names of the values
- @Override
- public String getName() {
- return "dc_cracklep";
- }
- @Override
- public String[] getParameterNames() {
- return joinArrays(additionalParamNames, super.getParameterNames());
- }
- @Override
- public Object[] getParameterValues() {
- return joinArrays(new Object[] { preset }, super.getParameterValues() );
- }
- @Override
- public void setParameter(String pName, double pValue) {
- if (PARAM_PRESET.equalsIgnoreCase(pName)) {
- preset = Tools.FTOI(pValue);
- switch (preset) {
- case 0:
- pcellsize = 1.0; ppower = 0.2; pdistort = 0.0; pscale = 1.00; pz=0.0;
- break;
- case 1:
- pcellsize = 0.5; ppower = 0.5; pdistort = 1.0; pscale = 0.95; pz=10.0;
- break;
- case 2:
- pcellsize = 0.5; ppower = 0.01; pdistort = 0.5; pscale = 1.0; pz=0.0;
- break;
- case 3:
- pcellsize = 0.05; ppower = 0.9; pdistort = 0.9; pscale = 0.5; pz=0.0;
- break;
- case 4:
- pcellsize = 0.5; ppower = 1.0; pdistort = 1.0; pscale = 0.93; pz=10.0;
- break;
- case 5:
- pcellsize = 1.0; ppower = 1.0; pdistort = 0.0; pscale = 0.9; pz=0.0;
- break;
- case 6:
- pcellsize = 0.8; ppower = 0.5; pdistort = 0.5; pscale = 0.8; pz=0.5;
- break;
- case 7:
- pcellsize = 0.2; ppower = 0.01; pdistort = 0.0; pscale = 0.4; pz=2.0;
- break;
- case 8:
- pcellsize = 1.0; ppower = 0.5; pdistort = 0.25; pscale = 0.5; pz=0.0;
- break;
- case 9:
- pcellsize = 0.6; ppower = 0.75; pdistort = 1.0; pscale = 0.25; pz=0.75;
- break;
- case 10:
- pcellsize = 0.5; ppower = 25.0; pdistort = 0.0; pscale = 9.0; pz=6.0;
- break;
- case 11:
- pcellsize = 0.2; ppower = 1.0; pdistort = 0.0; pscale = 0.4; pz=0.0;
- break;
- case 12:
- pcellsize = 1.5; ppower = 0.01; pdistort = 0.0; pscale = 0.4; pz=0.0;
- break;
- case 13:
- pcellsize = 8.0; ppower = 0.01; pdistort = 0.0; pscale = 0.4; pz=0.0;
- break;
- case 14:
- pcellsize = 0.2; ppower = 0.05; pdistort = 1.0; pscale = 5.0; pz=0.0;
- break;
- case 15:
- pcellsize = 0.07; ppower = 0.05; pdistort = 0.5; pscale = 9.0; pz=6.0;
- break;
- case 16:
- pcellsize = 0.2; ppower = 0.1; pdistort = 0.0; pscale = 1.5; pz=2.0;
- break;
- case 17:
- pcellsize = 0.297494; ppower = 0.662265; pdistort = 0.0708866; pscale = 0.228156; pz=0.0;
- break;
- case 18:
- pcellsize = 0.205939; ppower = 1.0; pdistort = 0.0; pscale = 0.6298; pz=0.35;
- break;
- case 19:
- pcellsize = 0.5; ppower = 0.001; pdistort = 1.0; pscale = 2.0; pz=0.0;
- break;
- case 20:
- pcellsize = 0.5; ppower = 0.0005; pdistort = 0.748; pscale = 1.465; pz=6.0;
- break;
- }
- super.setParameter(PARAM_CELLSIZE, pcellsize);
- super.setParameter(PARAM_POWER, ppower);
- super.setParameter(PARAM_DISTORT, pdistort);
- super.setParameter(PARAM_SCALE, pscale);
- super.setParameter(PARAM_Z, pz);
- }
- else
- super.setParameter(pName, pValue);
- }
- }
Add Comment
Please, Sign In to add comment