Browse Source

first

master
独行之狼 4 years ago
parent
commit
efe4572c16
  1. 8
      build.xml
  2. BIN
      fr-plugin-MarketUpdate-1.0/fr-plugin-MarketUpdate-1.0.jar
  3. 18
      fr-plugin-MarketUpdate-1.0/plugin.xml
  4. BIN
      fr-plugin-imageProcess-1.0/fr-plugin-imageProcess-1.0.jar
  5. 18
      fr-plugin-imageProcess-1.0/plugin.xml
  6. BIN
      install/fr-plugin-MarketUpdate-1.0.zip
  7. BIN
      install/fr-plugin-imageProcess-1.0.zip
  8. BIN
      lib/Filters.jar
  9. BIN
      lib/fastjson-1.2.68.jar
  10. BIN
      lib/fine-core-10.0-RELEASE-SNAPSHOT.jar
  11. BIN
      lib/fine-core-10.0.2020.04.26.jar
  12. BIN
      lib/gson-2.3.1.jar
  13. BIN
      lib/gson-2.8.5.jar
  14. BIN
      lib/jsoup-1.13.1.jar
  15. BIN
      lib/thumbnailator-0.4.8.jar
  16. 0
      plugin-function-market-update.iml
  17. 12
      plugin.xml
  18. 5
      pom.xml
  19. 45
      src/main/java/com/fr/plugin/image/process/FRImageAdjustRGB.java
  20. 57
      src/main/java/com/fr/plugin/image/process/FRImageChrome.java
  21. 44
      src/main/java/com/fr/plugin/image/process/FRImageColorGain.java
  22. 39
      src/main/java/com/fr/plugin/image/process/FRImageColorInvert.java
  23. 46
      src/main/java/com/fr/plugin/image/process/FRImageColorLevel.java
  24. 48
      src/main/java/com/fr/plugin/image/process/FRImageContrast.java
  25. 53
      src/main/java/com/fr/plugin/image/process/FRImageCrystallize.java
  26. 45
      src/main/java/com/fr/plugin/image/process/FRImageDiffusionDither.java
  27. 45
      src/main/java/com/fr/plugin/image/process/FRImageDissolve.java
  28. 48
      src/main/java/com/fr/plugin/image/process/FRImageEmboss.java
  29. 42
      src/main/java/com/fr/plugin/image/process/FRImageExposure.java
  30. 71
      src/main/java/com/fr/plugin/image/process/FRImageFlare.java
  31. 49
      src/main/java/com/fr/plugin/image/process/FRImageFromText.java
  32. 41
      src/main/java/com/fr/plugin/image/process/FRImageGamma.java
  33. 42
      src/main/java/com/fr/plugin/image/process/FRImageGaussianBlur.java
  34. 45
      src/main/java/com/fr/plugin/image/process/FRImageGlow.java
  35. 39
      src/main/java/com/fr/plugin/image/process/FRImageGrayScale.java
  36. 51
      src/main/java/com/fr/plugin/image/process/FRImageMixChannel.java
  37. 42
      src/main/java/com/fr/plugin/image/process/FRImageMosaic.java
  38. 44
      src/main/java/com/fr/plugin/image/process/FRImageOil.java
  39. 43
      src/main/java/com/fr/plugin/image/process/FRImagePosterize.java
  40. 43
      src/main/java/com/fr/plugin/image/process/FRImageReScale.java
  41. 49
      src/main/java/com/fr/plugin/image/process/FRImageScaleRotate.java
  42. 48
      src/main/java/com/fr/plugin/image/process/FRImageSize.java
  43. 39
      src/main/java/com/fr/plugin/image/process/FRImageSolar.java
  44. 46
      src/main/java/com/fr/plugin/image/process/FRImageSparkle.java
  45. 46
      src/main/java/com/fr/plugin/image/process/FRImageStamp.java
  46. 42
      src/main/java/com/fr/plugin/image/process/FRImageTransparency.java
  47. 51
      src/main/java/com/fr/plugin/image/process/FRImageWaterMark.java
  48. 48
      src/main/java/com/fr/plugin/image/process/FRImageWeave.java
  49. 77
      src/main/java/com/fr/plugin/image/process/FunctionConstants.java
  50. 59
      src/main/java/com/fr/plugin/image/process/ImageProcessFunction.java
  51. 10
      src/main/java/com/fr/plugin/image/process/MyLocaleFinder.java
  52. 33
      src/main/java/com/fr/plugin/image/process/Utils/FlarePoint2D.java
  53. 19
      src/main/java/com/fr/plugin/image/process/Utils/PositionNew.java
  54. 57
      src/main/java/com/fr/plugin/market/update/FRExchangeRate.java
  55. 21
      src/main/java/com/fr/plugin/market/update/FRFinanceFunction.java
  56. 30
      src/main/java/com/fr/plugin/market/update/FunConstants.java
  57. 49
      src/main/java/com/fr/plugin/market/update/TestFun.java
  58. 53
      src/main/market update.iml

8
build.xml

@ -13,7 +13,7 @@
<!-- 插件版本-->
<property name="plugin-version" value="${current-version}"/>
<!-- 插件名字-->
<property name="plugin-name" value="imageProcess"/>
<property name="plugin-name" value="MarketUpdate"/>
<property name="plugin-jar" value="fr-plugin-${plugin-name}-${plugin-version}.jar"/>
<target name="prepare">
@ -74,9 +74,9 @@
</fileset>
<!--下面加入第三方包-->
<zipfileset excludes="META-INF/*.SF" src="${libs}/Filters.jar"></zipfileset>
<zipfileset excludes="META-INF/*.SF" src="${libs}/thumbnailator-0.4.8.jar"></zipfileset>
<zipfileset excludes="META-INF/*.SF" src="${libs}/jsoup-1.13.1.jar"></zipfileset>
<zipfileset excludes="META-INF/*.SF" src="${libs}/fastjson-1.2.68.jar"></zipfileset>
<zipfileset excludes="META-INF/*.SF" src="${libs}/gson-2.8.5.jar"></zipfileset>
</jar>
</target>

BIN
fr-plugin-MarketUpdate-1.0/fr-plugin-MarketUpdate-1.0.jar

Binary file not shown.

18
fr-plugin-MarketUpdate-1.0/plugin.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin>
<id>com.fr.plugin.market.update</id>
<name><![CDATA[金融行情数据]]></name>
<active>yes</active>
<version>1.0</version>
<env-version>10.0</env-version>
<jartime>2018-07-31</jartime>
<vendor>all100</vendor>
<description><![CDATA[一组查询金融行情数据函数]]></description>
<change-notes><![CDATA[
[2021-3-6]初始化插件。<br/>
]]></change-notes>
<extra-core>
<!--<LocaleFinder class="MyLocaleFinder"/>-->
<FunctionGroup class="com.fr.plugin.market.update.FRFinanceFunction"/>
</extra-core>
<function-recorder class="com.fr.plugin.market.update.FRFinanceFunction"/>
</plugin>

BIN
fr-plugin-imageProcess-1.0/fr-plugin-imageProcess-1.0.jar

Binary file not shown.

18
fr-plugin-imageProcess-1.0/plugin.xml

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin>
<id>com.fr.plugin.function.image.process</id>
<name><![CDATA[图像处理函数]]></name>
<active>yes</active>
<version>1.0</version>
<env-version>10.0</env-version>
<jartime>2018-07-31</jartime>
<vendor>all100</vendor>
<description><![CDATA[一组图像处理函数]]></description>
<change-notes><![CDATA[
[2021-3-6]初始化插件。<br/>
]]></change-notes>
<extra-core>
<LocaleFinder class="com.fr.plugin.image.process.MyLocaleFinder"/>
<FunctionGroup class="com.fr.plugin.image.process.ImageProcessFunction" />
</extra-core>
<function-recorder class="com.fr.plugin.image.process.FRImageContrast"/>
</plugin>

BIN
install/fr-plugin-MarketUpdate-1.0.zip

Binary file not shown.

BIN
install/fr-plugin-imageProcess-1.0.zip

Binary file not shown.

BIN
lib/Filters.jar

Binary file not shown.

BIN
lib/fastjson-1.2.68.jar

Binary file not shown.

BIN
lib/fine-core-10.0-RELEASE-SNAPSHOT.jar

Binary file not shown.

BIN
lib/fine-core-10.0.2020.04.26.jar

Binary file not shown.

BIN
lib/gson-2.3.1.jar

Binary file not shown.

BIN
lib/gson-2.8.5.jar

Binary file not shown.

BIN
lib/jsoup-1.13.1.jar

Binary file not shown.

BIN
lib/thumbnailator-0.4.8.jar

Binary file not shown.

0
plugin-function-image-process.iml → plugin-function-market-update.iml

12
plugin.xml

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin>
<id>com.fr.plugin.function.image.process</id>
<name><![CDATA[图像处理函数]]></name>
<id>com.fr.plugin.market.update</id>
<name><![CDATA[金融行情数据]]></name>
<active>yes</active>
<version>1.0</version>
<env-version>10.0</env-version>
<jartime>2018-07-31</jartime>
<vendor>all100</vendor>
<description><![CDATA[一组图像处理函数]]></description>
<description><![CDATA[一组查询金融行情数据函数]]></description>
<change-notes><![CDATA[
[2021-3-6]初始化插件。<br/>
]]></change-notes>
<extra-core>
<LocaleFinder class="com.fr.plugin.image.process.MyLocaleFinder"/>
<FunctionGroup class="com.fr.plugin.image.process.ImageProcessFunction" />
<!--<LocaleFinder class="MyLocaleFinder"/>-->
<FunctionGroup class="com.fr.plugin.market.update.FRFinanceFunction"/>
</extra-core>
<function-recorder class="com.fr.plugin.image.process.FRImageContrast"/>
<function-recorder class="com.fr.plugin.market.update.FRFinanceFunction"/>
</plugin>

5
pom.xml

@ -12,6 +12,11 @@
<packaging>jar</packaging>
<artifactId>plugin-function</artifactId>
<dependencies>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
</dependency>
<dependency>
<groupId>com.fr.plugin</groupId>
<artifactId>gson</artifactId>

45
src/main/java/com/fr/plugin/image/process/FRImageAdjustRGB.java

@ -1,45 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.exception.FormulaException;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.RGBAdjustFilter;
import java.awt.image.BufferedImage;
//调整图像RGB
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageAdjustRGB extends AbstractFunction {
@Override
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageAdjustRGB", source = Original.PLUGIN)
public Object run(Object[] args) throws FormulaException {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes=FunctionConstants.CheckArgs(args,4);
if(!checkRes.equals(FunctionConstants.CHECK_PASS)){
return Primitive.ERROR_VALUE+checkRes;
}
float red = Float.parseFloat(args[1].toString())-1;
float green = Float.parseFloat(args[2].toString())-1;
float blue = Float.parseFloat(args[3].toString())-1;
BufferedImage src = FunctionConstants.readImage(args[0]);
return setFilter(src,red,green,blue);
}
//调整图像RGB
private BufferedImage setFilter(BufferedImage src, float red, float green,float blue) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
RGBAdjustFilter rgbAdjustFilter = new RGBAdjustFilter();
rgbAdjustFilter.setRFactor(red);
rgbAdjustFilter.setGFactor(green);
rgbAdjustFilter.setBFactor(blue);
rgbAdjustFilter.filter(src, result);
return result;
}
}

57
src/main/java/com/fr/plugin/image/process/FRImageChrome.java

@ -1,57 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.ChromeFilter;
import java.awt.image.BufferedImage;
//图像产生各种金属效果和更广泛的非常沉闷的效果
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageChrome extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageChrome", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 6);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
int colorSource=1;
BufferedImage src = FunctionConstants.readImage(args[0]);
float bumpSoftness = Float.parseFloat(args[1].toString());
float bumpHeight = Float.parseFloat(args[2].toString());
float amount = Float.parseFloat(args[3].toString());
float exposure = Float.parseFloat(args[4].toString());
final String diffuseColorText=args[5].toString();
int color=FunctionConstants.ColorHexToDec(diffuseColorText);
if(color==-16888888){
return Primitive.ERROR_VALUE + "Color Value";
}
BufferedImage result = setFilter(src, bumpSoftness, bumpHeight,colorSource,amount,exposure,color);
return result;
}
//图像产生各种金属效果和更广泛的非常沉闷的效果
private BufferedImage setFilter(BufferedImage src, float bumpSoftness, float bumpHeight,int colorSource,float amount,float exposure,int color) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
ChromeFilter chromeFilter = new ChromeFilter();
chromeFilter.setBumpSoftness(bumpSoftness);
chromeFilter.setBumpHeight(bumpHeight);
chromeFilter.setColorSource(colorSource);
chromeFilter.setAmount(amount);
chromeFilter.setExposure(exposure);
chromeFilter.setDiffuseColor(color);
chromeFilter.filter(src, result);
return result;
}
}

44
src/main/java/com/fr/plugin/image/process/FRImageColorGain.java

@ -1,44 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.GainFilter;
import java.awt.image.BufferedImage;
//图像增益效果
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageColorGain extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageColorGain", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 3);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
float gain = Float.parseFloat(args[1].toString());
float bias = Float.parseFloat(args[2].toString());
BufferedImage result = setFilter(src, gain, bias);
return result;
}
//图像增益效果
private BufferedImage setFilter(BufferedImage src, float gain, float bias) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
GainFilter gainFilter = new GainFilter();
gainFilter.setGain(gain);
gainFilter.setBias(bias);
gainFilter.filter(src, result);
return result;
}
}

39
src/main/java/com/fr/plugin/image/process/FRImageColorInvert.java

@ -1,39 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.InvertFilter;
import java.awt.image.BufferedImage;
//设置图像颜色反转
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageColorInvert extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageColorInvert", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 1);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
BufferedImage result = setFilter(src);
return result;
}
//设置图像颜色反转
private BufferedImage setFilter(BufferedImage src) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
InvertFilter invertFilter = new InvertFilter();
invertFilter.filter(src, result);
return result;
}
}

46
src/main/java/com/fr/plugin/image/process/FRImageColorLevel.java

@ -1,46 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.LevelsFilter;
import java.awt.image.BufferedImage;
//设置图像颜色Level
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageColorLevel extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageColorLevel", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 5);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
float highLevel = Float.parseFloat(args[1].toString());
float highOutputLevel = Float.parseFloat(args[1].toString());
float lowLevel = Float.parseFloat(args[1].toString());
float lowOutputLevel = Float.parseFloat(args[1].toString());
return setFilter(src,highLevel,highOutputLevel,lowLevel,lowOutputLevel);
}
//设置图像颜色Level
private BufferedImage setFilter(BufferedImage src,float highLevel ,float highOutputLevel, float lowLevel,float lowOutputLevel) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
LevelsFilter levelsFilter = new LevelsFilter();
levelsFilter.setHighLevel(highLevel);
levelsFilter.setHighOutputLevel(highOutputLevel);
levelsFilter.setLowLevel(lowLevel);
levelsFilter.setLowOutputLevel(lowOutputLevel);
levelsFilter.filter(src, result);
return result;
}
}

48
src/main/java/com/fr/plugin/image/process/FRImageContrast.java

@ -1,48 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.ContrastFilter;
import java.awt.image.BufferedImage;
//调整亮度对比度
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageContrast extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageContrast", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 3);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
float contrast = Float.parseFloat(args[1].toString());
float brightness = Float.parseFloat(args[2].toString());
BufferedImage result = setFilter(src, contrast, brightness);
return result;
}
//调整亮度对比度
private BufferedImage setFilter(BufferedImage src, float contrast, float brightness) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
ContrastFilter contrastFilter = new ContrastFilter();
contrastFilter.setContrast(contrast);
contrastFilter.setBrightness(brightness);
contrastFilter.filter(src, result);
return result;
}
}

53
src/main/java/com/fr/plugin/image/process/FRImageCrystallize.java

@ -1,53 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.CrystallizeFilter;
import java.awt.image.BufferedImage;
//设置图像结晶化效果
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageCrystallize extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageCrystallize", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 6);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
float scale = Float.parseFloat(args[1].toString());
float randomness = Float.parseFloat(args[2].toString());
float edgeThickness = Float.parseFloat(args[3].toString());
int gridType=Integer.parseInt(args[4].toString());
String colorText=args[5].toString();
int color=FunctionConstants.ColorHexToDec(colorText);
if(color==-16888888){
return Primitive.ERROR_VALUE + "Color Value!";
}
BufferedImage result = setFilter(src, scale,randomness,edgeThickness,gridType,color);
return result;
}
//设置图像结晶化效果
private BufferedImage setFilter(BufferedImage src, float scale,float randomness,float edgeThickness,int gridType,int color) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
CrystallizeFilter crystallizeFilter = new CrystallizeFilter();
crystallizeFilter.setScale(scale);
crystallizeFilter.setRandomness(randomness);
crystallizeFilter.setEdgeThickness(edgeThickness);
crystallizeFilter.setGridType(gridType);
crystallizeFilter.setEdgeColor(color);
crystallizeFilter.filter(src, result);
return result;
}
}

45
src/main/java/com/fr/plugin/image/process/FRImageDiffusionDither.java

@ -1,45 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.exception.FormulaException;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.DiffusionFilter;
import java.awt.image.BufferedImage;
//调整发散抖动
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageDiffusionDither extends AbstractFunction {
@Override
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageDiffusionDither", source = Original.PLUGIN)
public Object run(Object[] args) throws FormulaException {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes=FunctionConstants.CheckArgs(args,4);
if(!checkRes.equals(FunctionConstants.CHECK_PASS)){
return Primitive.ERROR_VALUE+checkRes;
}
int levels = Integer.parseInt(args[1].toString());
boolean serpentine = Boolean.parseBoolean(args[2].toString());
boolean colorDither = Boolean.parseBoolean(args[3].toString());
BufferedImage src = FunctionConstants.readImage(args[0]);
return setFilter(src,levels,serpentine,colorDither);
}
//调整发散抖动
private BufferedImage setFilter(BufferedImage src, int levels, boolean serpentine,boolean colorDither) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
DiffusionFilter diffusionFilter = new DiffusionFilter();
diffusionFilter.setLevels(levels);
diffusionFilter.setColorDither(colorDither);
diffusionFilter.setSerpentine(serpentine);
diffusionFilter.filter(src,result);
return result;
}
}

45
src/main/java/com/fr/plugin/image/process/FRImageDissolve.java

@ -1,45 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.DissolveFilter;
import java.awt.image.BufferedImage;
//设置图像溶解效果
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageDissolve extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageDissolve", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 3);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
float density = Float.parseFloat(args[1].toString());
float softness = Float.parseFloat(args[2].toString());
BufferedImage result = setFilter(src, density, softness);
return result;
}
//设置图像溶解效果
private BufferedImage setFilter(BufferedImage src, float density, float softness) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
DissolveFilter dissolveFilter = new DissolveFilter();
dissolveFilter.setDensity(density);
dissolveFilter.setSoftness(softness);
dissolveFilter.filter(src, result);
return result;
}
}

48
src/main/java/com/fr/plugin/image/process/FRImageEmboss.java

@ -1,48 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.EmbossFilter;
import java.awt.image.BufferedImage;
//设置浮雕图像
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageEmboss extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageEmboss", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 5);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
float azimuth = Float.parseFloat(args[1].toString());
float bumpHeight = Float.parseFloat(args[2].toString());
float elevation=Float.parseFloat(args[3].toString());
boolean emboss=Boolean.parseBoolean(args[4].toString());
BufferedImage result = setFilter(src, azimuth,bumpHeight,elevation,emboss);
return result;
}
//设置浮雕图像
private BufferedImage setFilter(BufferedImage src, float azimuth,float bumpHeight,float elevation,boolean emboss) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
EmbossFilter embossFilter = new EmbossFilter();
embossFilter.setAzimuth(azimuth);
embossFilter.setBumpHeight(bumpHeight);
embossFilter.setElevation(elevation);
embossFilter.setEmboss(emboss);
embossFilter.filter(src, result);
return result;
}
}

42
src/main/java/com/fr/plugin/image/process/FRImageExposure.java

@ -1,42 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.exception.FormulaException;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.ExposureFilter;
import java.awt.image.BufferedImage;
//调整胶片曝光
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageExposure extends AbstractFunction {
@Override
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageExposure", source = Original.PLUGIN)
public Object run(Object[] args) throws FormulaException {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes=FunctionConstants.CheckArgs(args,2);
if(!checkRes.equals(FunctionConstants.CHECK_PASS)){
return Primitive.ERROR_VALUE+checkRes;
}
float levels = Float.parseFloat(args[1].toString());
BufferedImage src = FunctionConstants.readImage(args[0]);
return setFilter(src,levels);
}
//调整胶片曝光
private BufferedImage setFilter(BufferedImage src, float levels) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
ExposureFilter exposureFilter = new ExposureFilter();
exposureFilter.setExposure(levels);
exposureFilter.filter(src,result);
return result;
}
}

71
src/main/java/com/fr/plugin/image/process/FRImageFlare.java

@ -1,71 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.plugin.image.process.Utils.FlarePoint2D;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.FlareFilter;
import java.awt.geom.Point2D;
import java.awt.image.BufferedImage;
//图像产生各种闪光效果
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageFlare extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageFlare", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 9);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
double pointX = Double.parseDouble(args[1].toString());
double pointY = Double.parseDouble(args[2].toString());
float radius = Float.parseFloat(args[3].toString());
float baseAmount = Float.parseFloat(args[4].toString());
float ringAmount = Float.parseFloat(args[5].toString());
float ringWidth = Float.parseFloat(args[6].toString());
float rayAmount = Float.parseFloat(args[7].toString());
final String colorText=args[8].toString();
int color=FunctionConstants.ColorHexToDec(colorText);
if(color==-16888888){
return Primitive.ERROR_VALUE + "Color Value";
}
BufferedImage result = setFilter(src, pointX, pointY,radius,baseAmount,ringAmount,ringWidth,rayAmount,color);
return result;
}
//图像产生各种闪光效果
private BufferedImage setFilter(BufferedImage src, double pointX, double pointY,float radius,float baseAmount,float ringAmount,float ringWidth, float rayAmount,int color) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
Point2D point2D =new FlarePoint2D();
point2D.setLocation(pointX,pointY);
FlareFilter flareFilter = new FlareFilter();
flareFilter.setCentre(point2D);
flareFilter.setBaseAmount(baseAmount);
flareFilter.setRadius(radius);
flareFilter.setRayAmount(rayAmount);
flareFilter.setRingAmount(ringAmount);
flareFilter.setRingWidth(ringWidth);
flareFilter.setColor(color);
flareFilter.filter(src, result);
return result;
}
}

49
src/main/java/com/fr/plugin/image/process/FRImageFromText.java

@ -1,49 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.exception.FormulaException;
import com.fr.stable.fun.Authorize;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
//将文本转换为图像
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageFromText extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageFromText", source = Original.PLUGIN)
@Override
public Object run(Object[] args) throws FormulaException {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String text = args[0].toString();
int fontSize = Integer.parseInt(args[1].toString());
int width = Integer.parseInt(args[2].toString());
int height = Integer.parseInt(args[3].toString());
return ImageFromText(text, fontSize, width, height);
}
private BufferedImage ImageFromText(String text, int fontSize, int width, int height) {
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
Graphics2D g2 = img.createGraphics();
Font font = new Font("黑体", Font.BOLD, fontSize);
FontMetrics fm = g2.getFontMetrics(font);
int textWidth = fm.stringWidth(text);
int widthX = (width - textWidth) / 2;
int heightY = (height - fontSize) / 2;
AffineTransform affineTransform = new AffineTransform();
Font rotatedFont = font.deriveFont(affineTransform);
g2.setFont(rotatedFont);
g2.setColor(new Color(0, 0, 0));
g2.drawString(text, widthX, heightY);
g2.dispose();
return img;
}
}

41
src/main/java/com/fr/plugin/image/process/FRImageGamma.java

@ -1,41 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.GammaFilter;
import java.awt.image.BufferedImage;
//设置图像伽玛线效果
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageGamma extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageGamma", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 2);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
float gamma = Float.parseFloat(args[1].toString());
BufferedImage result = setFilter(src, gamma);
return result;
}
//设置图像伽玛线效果
private BufferedImage setFilter(BufferedImage src, float gamma) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
GammaFilter gammaFilter = new GammaFilter();
gammaFilter.setGamma(gamma);
gammaFilter.filter(src, result);
return result;
}
}

42
src/main/java/com/fr/plugin/image/process/FRImageGaussianBlur.java

@ -1,42 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.GaussianFilter;
import java.awt.image.BufferedImage;
//图像上执行高斯模糊
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageGaussianBlur extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageTritone", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 2);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
float radius=Float.parseFloat(args[1].toString());
BufferedImage result = setFilter(src,radius);
return result;
}
//图像上执行高斯模糊
private BufferedImage setFilter(BufferedImage src,float radius) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
GaussianFilter gaussianFilter = new GaussianFilter();
gaussianFilter.setRadius(radius);
gaussianFilter.filter(src, result);
return result;
}
}

45
src/main/java/com/fr/plugin/image/process/FRImageGlow.java

@ -1,45 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.GlowFilter;
import java.awt.image.BufferedImage;
//图像产生发光效果
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageGlow extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageGlow", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 3);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
float radius = Float.parseFloat(args[1].toString());
float amount = Float.parseFloat(args[2].toString());
BufferedImage result = setFilter(src, radius, amount);
return result;
}
//图像产生发光效果
private BufferedImage setFilter(BufferedImage src, float radius, float amount) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
GlowFilter glowFilter = new GlowFilter();
glowFilter.setRadius(radius);
glowFilter.setAmount(amount);
glowFilter.filter(src, result);
return result;
}
}

39
src/main/java/com/fr/plugin/image/process/FRImageGrayScale.java

@ -1,39 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.GrayscaleFilter;
import java.awt.image.BufferedImage;
//设置灰度图像
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageGrayScale extends AbstractFunction {
@Focus(id =FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageGrayScale", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 1);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
BufferedImage result = setFilter(src);
return result;
}
//设置灰度图像
private BufferedImage setFilter(BufferedImage src) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
GrayscaleFilter grayscaleFilter = new GrayscaleFilter();
grayscaleFilter.filter(src, result);
return result;
}
}

51
src/main/java/com/fr/plugin/image/process/FRImageMixChannel.java

@ -1,51 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.ChannelMixFilter;
import java.awt.image.BufferedImage;
//混合图像RGB通道
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageMixChannel extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageMixChannel", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 7);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
int blueGreen = Integer.parseInt(args[1].toString());
int intoR = Integer.parseInt(args[1].toString());
int redBlue = Integer.parseInt(args[1].toString());
int intoG = Integer.parseInt(args[1].toString());
int greenRed = Integer.parseInt(args[1].toString());
int intoB = Integer.parseInt(args[1].toString());
return setFilter(src,blueGreen,intoR,redBlue,intoG,greenRed,intoB);
}
//混合图像RGB通道
private BufferedImage setFilter(BufferedImage src,int blueGreen,int intoR, int redBlue,int intoG,int greenRed,int intoB) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
ChannelMixFilter channelMixFilter = new ChannelMixFilter();
channelMixFilter.setBlueGreen(blueGreen);
channelMixFilter.setIntoR(intoR);
channelMixFilter.setRedBlue(redBlue);
channelMixFilter.setIntoG(intoG);
channelMixFilter.setGreenRed(greenRed);
channelMixFilter.setIntoB(intoB);
channelMixFilter.filter(src, result);
return result;
}
}

42
src/main/java/com/fr/plugin/image/process/FRImageMosaic.java

@ -1,42 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.BlockFilter;
import java.awt.image.BufferedImage;
//设置图像马赛克
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageMosaic extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageMosaic", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 2);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
int blockSize = Integer.parseInt(args[1].toString());
BufferedImage result = setFilter(src, blockSize);
return result;
}
//设置图像马赛克
private BufferedImage setFilter(BufferedImage src, int blockSize) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
BlockFilter blockFilter = new BlockFilter();
blockFilter.setBlockSize(blockSize);
blockFilter.filter(src, result);
return result;
}
}

44
src/main/java/com/fr/plugin/image/process/FRImageOil.java

@ -1,44 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.OilFilter;
import java.awt.image.BufferedImage;
//设置图像油画效果
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageOil extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageOil", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 3);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
int level = Integer.parseInt(args[1].toString());
int range=Integer.parseInt(args[2].toString());
BufferedImage result = setFilter(src, level,range);
return result;
}
//设置图像油画效果
private BufferedImage setFilter(BufferedImage src, int level,int range) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
OilFilter oilFilter = new OilFilter();
oilFilter.setLevels(level);
oilFilter.setRange(range);
oilFilter.filter(src, result);
return result;
}
}

43
src/main/java/com/fr/plugin/image/process/FRImagePosterize.java

@ -1,43 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.PosterizeFilter;
import java.awt.image.BufferedImage;
//设置图像招贴画
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImagePosterize extends AbstractFunction {
@Focus(id =FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImagePosterize", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 2);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
int numLevels = Integer.parseInt(args[1].toString());
BufferedImage result = setFilter(src, numLevels);
return result;
}
//设置图像招贴画
private BufferedImage setFilter(BufferedImage src, int numLevels) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
PosterizeFilter posterizeFilter = new PosterizeFilter();
posterizeFilter.setNumLevels(numLevels);
posterizeFilter.filter(src, result);
return result;
}
}

43
src/main/java/com/fr/plugin/image/process/FRImageReScale.java

@ -1,43 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.RescaleFilter;
import java.awt.image.BufferedImage;
//图像重新调节
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageReScale extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageReScale", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 2);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
float reScale = Float.parseFloat(args[1].toString());
BufferedImage result = setFilter(src, reScale);
return result;
}
//图像重新调节
private BufferedImage setFilter(BufferedImage src, float reScale) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
RescaleFilter rescaleFilter = new RescaleFilter();
rescaleFilter.setScale(reScale);
rescaleFilter.filter(src, result);
return result;
}
}

49
src/main/java/com/fr/plugin/image/process/FRImageScaleRotate.java

@ -1,49 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.exception.FormulaException;
import com.fr.stable.fun.Authorize;
import net.coobird.thumbnailator.Thumbnails;
import java.awt.image.BufferedImage;
import java.io.IOException;
//设置图像旋转缩放
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageScaleRotate extends AbstractFunction {
@Override
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageScaleRotate", source = Original.PLUGIN)
public Object run(Object[] args) throws FormulaException {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 3);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
float scale = Float.parseFloat((args[1].toString()));
float rotate = Float.parseFloat((args[2].toString()));
BufferedImage result = null;
try {
result = setFilter(src, scale, rotate);
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
//设置图像旋转缩放
private BufferedImage setFilter(BufferedImage src, float scale, float rotate) throws IOException {
BufferedImage result = Thumbnails.of(src).scale(scale).rotate(rotate).asBufferedImage();
return result;
}
}

48
src/main/java/com/fr/plugin/image/process/FRImageSize.java

@ -1,48 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.exception.FormulaException;
import com.fr.stable.fun.Authorize;
import net.coobird.thumbnailator.Thumbnails;
import java.awt.image.BufferedImage;
import java.io.IOException;
//调整图像大小
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageSize extends AbstractFunction {
@Override
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageSize", source = Original.PLUGIN)
public Object run(Object[] args) throws FormulaException {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes=FunctionConstants.CheckArgs(args,4);
if(!checkRes.equals(FunctionConstants.CHECK_PASS)){
return Primitive.ERROR_VALUE+checkRes;
}
int width = Integer.parseInt((args[1].toString()));
int height = Integer.parseInt((args[2].toString()));
boolean rateScale = Boolean.parseBoolean(args[3].toString());
BufferedImage src = FunctionConstants.readImage(args[0]);
BufferedImage result=null;
try {
result= setFilter(src,width,height,rateScale);
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
//调整图像大小
private BufferedImage setFilter(BufferedImage src, int width, int height,boolean rateScale) throws IOException {
BufferedImage result= Thumbnails.of(src).size(width,height).keepAspectRatio(rateScale).asBufferedImage();
return result;
}
}

39
src/main/java/com/fr/plugin/image/process/FRImageSolar.java

@ -1,39 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.SolarizeFilter;
import java.awt.image.BufferedImage;
//图像过度曝光
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageSolar extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageSolar", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 1);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
BufferedImage result = setFilter(src);
return result;
}
//图像过度曝光
private BufferedImage setFilter(BufferedImage src) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
SolarizeFilter solarizeFilter = new SolarizeFilter();
solarizeFilter.filter(src, result);
return result;
}
}

46
src/main/java/com/fr/plugin/image/process/FRImageSparkle.java

@ -1,46 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.SparkleFilter;
import java.awt.image.BufferedImage;
//生成图像闪耀效果
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageSparkle extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageSparkle", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 4);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
int radius =Integer.parseInt(args[1].toString());
int randomness =Integer.parseInt(args[2].toString());
int rays =Integer.parseInt(args[3].toString());
BufferedImage result = setFilter(src, radius,randomness,rays);
return result;
}
//生成图像闪耀效果
private BufferedImage setFilter(BufferedImage src,int radius,int randomness,int rays) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
SparkleFilter sparkleFilter = new SparkleFilter();
sparkleFilter.setRadius(radius);
sparkleFilter.setRandomness(randomness);
sparkleFilter.setRays(rays);
sparkleFilter.filter(src, result);
return result;
}
}

46
src/main/java/com/fr/plugin/image/process/FRImageStamp.java

@ -1,46 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.StampFilter;
import java.awt.image.BufferedImage;
//生成图像黑白图章效果
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageStamp extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageStamp", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 4);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
float radius = Float.parseFloat(args[1].toString());
float softness = Float.parseFloat(args[2].toString());
float threshold = Float.parseFloat(args[3].toString());
BufferedImage result = setFilter(src, radius,softness,threshold);
return result;
}
//生成图像黑白图章效果
private BufferedImage setFilter(BufferedImage src,float radius,float softness,float threshold) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
StampFilter stampFilter = new StampFilter();
stampFilter.setRadius(radius);
stampFilter.setThreshold(threshold);
stampFilter.setSoftness(softness);
stampFilter.filter(src, result);
return result;
}
}

42
src/main/java/com/fr/plugin/image/process/FRImageTransparency.java

@ -1,42 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.OpacityFilter;
import java.awt.image.BufferedImage;
//设置图像不透明级别
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageTransparency extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageTransparency", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 2);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
int opacity = Integer.parseInt(args[1].toString());
BufferedImage result = setFilter(src, opacity);
return result;
}
//设置图像不透明级别
private BufferedImage setFilter(BufferedImage src, int opacity) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
OpacityFilter opacityFilter = new OpacityFilter();
opacityFilter.setOpacity(opacity);
opacityFilter.filter(src, result);
return result;
}
}

51
src/main/java/com/fr/plugin/image/process/FRImageWaterMark.java

@ -1,51 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.plugin.image.process.Utils.PositionNew;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.exception.FormulaException;
import com.fr.stable.fun.Authorize;
import net.coobird.thumbnailator.Thumbnails;
import java.awt.image.BufferedImage;
import java.io.IOException;
//给图像增加水印
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageWaterMark extends AbstractFunction {
@Override
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageWaterMark", source = Original.PLUGIN)
public Object run(Object[] args) throws FormulaException {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes=FunctionConstants.CheckArgs(args,5);
if(!checkRes.equals(FunctionConstants.CHECK_PASS)){
return Primitive.ERROR_VALUE+checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
int left = Integer.parseInt((args[1].toString()));
int right = Integer.parseInt((args[2].toString()));
BufferedImage waterMark = FunctionConstants.readImage(args[3]);
float opacity = Float.parseFloat(args[4].toString());
BufferedImage result=null;
try {
result= setFilter(src,left,right,waterMark,opacity);
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
//给图像增加水印
private BufferedImage setFilter(BufferedImage src, int left, int right,BufferedImage waterMark,float opacity) throws IOException {
PositionNew positionNew=new PositionNew(left,right);
BufferedImage result= Thumbnails.of(src).watermark(positionNew,waterMark,opacity).scale(1).asBufferedImage();
return result;
}
}

48
src/main/java/com/fr/plugin/image/process/FRImageWeave.java

@ -1,48 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.context.PluginContexts;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.fun.Authorize;
import com.jhlabs.image.WeaveFilter;
import java.awt.image.BufferedImage;
//图像编织化
@EnableMetrics
@Authorize(callSignKey = FunctionConstants.PLUGIN_ID)
public class FRImageWeave extends AbstractFunction {
@Focus(id = FunctionConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRImageWeave", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunctionConstants.author()){
return FunctionConstants.AUTHOR_ERROR;
}
String checkRes = FunctionConstants.CheckArgs(args, 5);
if (!checkRes.equals(FunctionConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
BufferedImage src = FunctionConstants.readImage(args[0]);
float XWidth = Float.parseFloat(args[1].toString());
float YWidth = Float.parseFloat(args[2].toString());
float XGap = Float.parseFloat(args[3].toString());
float YGap = Float.parseFloat(args[4].toString());
BufferedImage result = setFilter(src, XWidth, YWidth,XGap,YGap);
return result;
}
//图像编织化
private BufferedImage setFilter(BufferedImage src, float XWidth, float YWidth,float XGap,float YGap) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
WeaveFilter weaveFilter = new WeaveFilter();
weaveFilter.setXWidth(XWidth);
weaveFilter.setYWidth(YWidth);
weaveFilter.setXGap(XGap);
weaveFilter.setXGap(YGap);
weaveFilter.filter(src, result);
return result;
}
}

77
src/main/java/com/fr/plugin/image/process/FunctionConstants.java

@ -1,77 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.plugin.context.PluginContexts;
import com.fr.stable.ArrayUtils;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import static com.fr.design.i18n.Toolkit.i18nText;
//定义常用方法变量
public class FunctionConstants {
static final String PLUGIN_ID = "com.fr.plugin.function.image.process";
static final String AUTHOR_ERROR=i18nText("Plugin.Function.ImagProcess_AUTHOR_ERROR");
static final String CHECK_PASS=i18nText("Plugin.Function.ImagProcess_CHECK_PASS");
static final boolean author() {
return PluginContexts.currentContext().isAvailable();
}
static BufferedImage readImage(Object file) {
BufferedImage res;
if(file instanceof BufferedImage){
return (BufferedImage)file;
}
String filename=file.toString();
File fn = new File(filename);
try {
ImageIO.setUseCache(false);
res = ImageIO.read(fn);
} catch (IOException e) {
throw new Error(filename + i18nText("Plugin.Function.ImagProcess_ReadImageError"));
}
return res;
}
static String CheckArgs(Object[] args,int num){
String res=FunctionConstants.CHECK_PASS;
int len = ArrayUtils.getLength(args);
if (len != num) {
return i18nText("Plugin.Function.ImagProcess_ArgsCountError");
}
if(!(args[0] instanceof BufferedImage)){
String filename=args[0].toString();
File fn = new File(filename);
if (!(fn.exists())) {
return filename + i18nText("Plugin.Function.ImagProcess_FileNotFind");
}
}
return res;
}
static int ColorHexToDec(String ColorText){
if(ColorText.length()!=6){
return -16888888;
}
final int red = Integer.parseInt(ColorText.substring(0, 2), 16);
final int blue = Integer.parseInt(ColorText.substring(2, 4), 16);
final int green = Integer.parseInt(ColorText.substring(4, 6), 16);
if(red>255||red<0){
return -16888888;
}
if(blue>255||blue<0){
return -16888888;
}
if(green>255||green<0){
return -16888888;
}
Color color=new Color(red,blue,green);
int c=color.getRGB();
return c;
}
}

59
src/main/java/com/fr/plugin/image/process/ImageProcessFunction.java

@ -1,59 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.intelli.record.Focus;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.stable.fun.impl.AbstractFunctionDefContainer;
import com.fr.stable.script.FunctionDef;
/**
* @author all100
* @version 10.0
* Created by all100 on 2021-02-20
**/
@EnableMetrics
public class ImageProcessFunction extends AbstractFunctionDefContainer {
@Override
@Focus(id=FunctionConstants.PLUGIN_ID, text="图像处理函数")
public FunctionDef[] getFunctionDefs() {
return new FunctionDef[]{
new FunctionDef( "FRImageFromText","功能:文本生成图像,可以让其它函数再次处理。 \n参数说明:\n参数1:文本内容。\n参数2:文本字号,整数。\n参数3:图像宽度,整数。\n参数4:图像高度,整数。",FRImageFromText.class.getName()),
new FunctionDef( "FRImageContrast","功能:设置图像亮度、对比度。 \n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:图像对比度,取值范围:0-2。\n参数3:图像亮度,取值范围:0-2。",FRImageContrast.class.getName()),
new FunctionDef( "FRImageAdjustRGB","功能:设置图像RGB通道。 \n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:图像Red通道,取值范围:0-2。\n参数3:图像Green通道 ,取值范围:0-2,\n参数4:图像Blue通道 ,取值范围:0-2。",FRImageAdjustRGB.class.getName()),
new FunctionDef( "FRImageDiffusionDither","功能:设置图像发散抖动。 \n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:图像抖动层级,取值范围:2、4、5、6、8、16。\n参数3:图像是否花纹抖动 ,取值范围:true或false,\n参数4:图像是否颜色抖动 ,取值范围:true或false。",FRImageDiffusionDither.class.getName()),
new FunctionDef( "FRImageExposure","功能:设置图像胶片曝光。 \n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:调整胶片曝光层级,取值范围:0-5。",FRImageExposure.class.getName()),
new FunctionDef( "FRImageSize","功能:设置图像大小。 \n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:调整宽度。\n参数3:调整高度。\n参数4:是否遵循原图比例调整大小 。",FRImageSize.class.getName()),
new FunctionDef( "FRImageWaterMark","功能:给图像增加水印。 \n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:水印左边距。\n参数3:水印顶边距。\n参数4:水印内容。\n参数5:水印不透明级别,取值范围:0-1。",FRImageWaterMark.class.getName()),
new FunctionDef( "FRImageScaleRotate","功能:设置图像旋转缩放。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:缩放比例,取值范围:0-1。\n参数3:旋转度数,取值范围:0-360。",FRImageScaleRotate.class.getName()),
new FunctionDef( "FRImageColorGain","功能:图像增益效果。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:增益值,取值范围:0-1。\n参数3:偏置值,取值范围:0-1。",FRImageColorGain.class.getName()),
new FunctionDef( "FRImageGamma","功能:设置图像伽玛。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:伽玛值,取值范围:0-3。",FRImageGamma.class.getName()),
new FunctionDef( "FRImageGrayScale","功能:设置图像灰度化。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。",FRImageGrayScale.class.getName()),
new FunctionDef( "FRImageColorInvert","功能:设置图像颜色反转。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。",FRImageColorInvert.class.getName()),
new FunctionDef( "FRImageColorLevel","功能:设置图像颜色Level。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:highLevel,取值范围:0-1。\n参数3:highOutputLevel,取值范围:0-1。\n参数4:lowLevel,取值范围:0-1。\n参数5:lowOutputLevel,取值范围:0-1。",FRImageColorLevel.class.getName()),
new FunctionDef( "FRImageMixChannel","功能:混合图像RGB通道。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:blueGreen,取值范围:0-255。\n参数3:intoRed,取值范围:0-255。\n参数4:redBlue,取值范围:0-255。\n参数5:intoGreen,取值范围:0-255。\n参数6:greenRed,取值范围:0-255。\n参数7:intoBlue,取值范围:0-255。",FRImageMixChannel.class.getName()),
new FunctionDef( "FRImagePosterize","功能:设置图像招贴画。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:招贴画层级,取值范围:1-30。",FRImagePosterize.class.getName()),
new FunctionDef( "FRImageReScale","功能:图像重新调节。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:图像重新调节因子,取值范围:0-5。",FRImageReScale.class.getName()),
new FunctionDef( "FRImageSolar","功能:设置图像过度曝光。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。",FRImageSolar.class.getName()),
new FunctionDef( "FRImageTransparency","功能:设置图像不透明级别。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:图像不透明级别,取值范围(整数):0-255。",FRImageTransparency.class.getName()),
new FunctionDef( "FRImageGaussianBlur","功能:设置图像高斯模糊。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:图像高斯模糊半径,取值范围(浮点):0-100。",FRImageGaussianBlur.class.getName()),
new FunctionDef( "FRImageEmboss","功能:设置浮雕图像。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:azimuth,取值范围(浮点):0-6.28。\n参数3:bumpHeight,取值范围(浮点):0-1。\n参数4:elevation,取值范围(浮点):0-1.57。\n参数5:emboss,取值范围(布尔):true或false。",FRImageEmboss.class.getName()),
new FunctionDef( "FRImageMosaic","功能:设置图像马赛克。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:设置图像马赛克大小,取值范围(整数):0-100。",FRImageMosaic.class.getName()),
new FunctionDef( "FRImageWeave","功能:设置图像编织化。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:XWidth,编织带横向宽度,取值范围(浮点):1-256。\n参数3:YWidth,编织带纵向宽度,取值范围(浮点):1-256。\n参数4:XGap,编织空横向宽度,取值范围(浮点):1-256。\n参数5:YGap,编织空纵向宽度,取值范围(浮点):1-256。",FRImageWeave.class.getName()),
new FunctionDef( "FRImageGlow","功能:设置图像产生发光效果。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:发光半径,取值范围(浮点):0-100。\n参数3:amount,发光数值,取值范围(浮点):0-100。",FRImageGlow.class.getName()),
new FunctionDef( "FRImageDissolve","功能:设置图像溶解效果。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:图像溶解密度,取值范围(浮点):0-100。\n参数3:图像溶解柔软度,取值范围(浮点):0-100。",FRImageDissolve.class.getName()),
new FunctionDef( "FRImageChrome","功能:图像产生各种金属效果和更广泛的非常沉闷的效果。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:柔软度bumpSoftness,取值范围:0-50(浮点)。\n参数3:bumpHeight高度,取值范围(浮点):0-5。\n参数4:amount,取值范围(浮点):0-100。\n参数5:exposure,取值范围(浮点):0-5。\n参数6:diffuseColor,取值范围(16进制6位颜色范围,文本用引号括起来):000000-FFFFFF。",FRImageChrome.class.getName()),
new FunctionDef( "FRImageFlare","功能:图像产生各种闪光效果。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:光源横坐标,取值范围(浮点):0-1。\n参数3:光源纵坐标,取值范围(浮点):0-1。\n参数4:光源半径,取值范围(浮点):0-400。\n参数5:光源数量,取值范围(浮点):0-100。\n参数6:光源环数量,取值范围(浮点):0-100。\n参数7:光源环宽度,取值范围(浮点):0-10。\n参数8:光源数量,取值范围(浮点):0-100。\n参数9:光源颜色,取值范围(16进制6位颜色范围,文本用引号括起来):000000-FFFFFF。",FRImageFlare.class.getName()),
new FunctionDef( "FRImageOil","功能:设置图像油画效果。 \n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:设置层级,取值范围(整数):1-256。\n参数3:设置油画半径,取值范围(整数):1-5。",FRImageOil.class.getName()),
new FunctionDef( "FRImageCrystallize","功能:设置图像结晶化效果。 \n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:设置结晶化颗粒大小,取值范围(浮点):1-10。\n参数3:设置结晶化随机性,取值范围(浮点):0-1。\n参数4:设置边界,取值范围(浮点):0-1。\n参数5:设置结晶化类型,取值范围(整数):1-4。\n参数9:结晶化边界颜色,取值范围(16进制6位颜色范围,文本用引号括起来):000000-FFFFFF。",FRImageCrystallize.class.getName()),
new FunctionDef( "FRImageStamp","功能:生成图像黑白图章效果。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:效果半径,取值范围(浮点):0-100。\n参数3:图像溶解柔软度,取值范围(浮点):0-1。\n参数4:图像阈,取值范围(浮点):0-1。",FRImageStamp.class.getName()),
new FunctionDef( "FRImageSparkle","功能:生成图像闪耀效果。\n参数说明:\n参数1:图像文件路径,如:c:\\1.png,或包含图像、图像文件路径的单元格。\n参数2:闪耀效果半径,取值范围(整数):0-300。\n参数3:图像闪耀随机性,取值范围(整数):0-50。\n参数4:光线数量,取值范围(整数):0-300。",FRImageSparkle.class.getName()),
};
}
@Override
public String getGroupName() {
return "图像处理函数";
}
}

10
src/main/java/com/fr/plugin/image/process/MyLocaleFinder.java

@ -1,10 +0,0 @@
package com.fr.plugin.image.process;
import com.fr.stable.fun.impl.AbstractLocaleFinder;
public class MyLocaleFinder extends AbstractLocaleFinder {
@Override
public String find() {
return "com/fr/plugin/image/process";
}
}

33
src/main/java/com/fr/plugin/image/process/Utils/FlarePoint2D.java

@ -1,33 +0,0 @@
package com.fr.plugin.image.process.Utils;
import java.awt.geom.Point2D;
//生成闪光点
public class FlarePoint2D extends Point2D {
double x;
double y;
public FlarePoint2D() {
}
public FlarePoint2D(double x, double y) {
this.x = x;
this.y = y;
}
@Override
public double getX() {
return this.x;
}
@Override
public double getY() {
return this.y;
}
@Override
public void setLocation(double x, double y) {
this.x=x;
this.y=y;
}
}

19
src/main/java/com/fr/plugin/image/process/Utils/PositionNew.java

@ -1,19 +0,0 @@
package com.fr.plugin.image.process.Utils;
import net.coobird.thumbnailator.geometry.Position;
import java.awt.*;
//生成坐标点
public final class PositionNew implements Position {
private int x;
private int y;
public PositionNew(int x, int y) {
this.x=x;
this.y=y;
}
@Override
public Point calculate(int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7) {
return new Point(this.x,this.y);
}
}

57
src/main/java/com/fr/plugin/market/update/FRExchangeRate.java

@ -0,0 +1,57 @@
package com.fr.plugin.market.update;
import com.alibaba.fastjson.JSONObject;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.plugin.market.update.FunConstants;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.AbstractFunction;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Primitive;
import com.fr.stable.StringUtils;
import com.fr.stable.fun.Authorize;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@EnableMetrics
@Authorize(callSignKey = FunConstants.PLUGIN_ID)
public class FRExchangeRate extends AbstractFunction {
@Focus(id = FunConstants.PLUGIN_ID, text = "Plugin-Test_Function_FRExchangeRate", source = Original.PLUGIN)
public Object run(Object[] args) {
if(!FunConstants.author()){
return FunConstants.AUTHOR_ERROR;
}
String checkRes = FunConstants.CheckArgs(args, 2);
if (!checkRes.equals(FunConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + checkRes;
}
String currencyMain = args[0].toString();
String currencyOther = args[1].toString();
float result;
try {
result= getRate(currencyMain,currencyOther);
} catch (IOException e) {
return Primitive.ERROR_VALUE;
}
if(result==0.0f){
return Primitive.ERROR_VALUE;
}
return result;
}
private final float getRate(String currencyMain ,String currencyOther) throws IOException {
if(!ArrayUtils.contains(FunConstants.CurrencyCodeList,currencyMain)||!ArrayUtils.contains(FunConstants.CurrencyCodeList,currencyOther)){
return 0.0f;
}
final String URI = "https://api.exchangerate-api.com/v4/latest/"+currencyMain;
Document doc = Jsoup.connect(URI).ignoreContentType(true).get();
final String body = doc.getElementsByTag("body").first().text();
JSONObject j=JSONObject.parseObject(body);
final String rates = JSONObject.parseObject(j.get("rates").toString()).get(currencyOther).toString();
return Float.parseFloat(rates);
}
}

21
src/main/java/com/fr/plugin/market/update/FRFinanceFunction.java

@ -0,0 +1,21 @@
package com.fr.plugin.market.update;
import com.fr.intelli.record.Focus;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.stable.fun.impl.AbstractFunctionDefContainer;
import com.fr.stable.script.FunctionDef;
@EnableMetrics
public class FRFinanceFunction extends AbstractFunctionDefContainer {
@Override
@Focus(id=FunConstants.PLUGIN_ID, text="金融行情数据")
public FunctionDef[] getFunctionDefs() {
return new FunctionDef[]{
new FunctionDef("FRExchangeRate", "功能:。", FRExchangeRate.class.getName())
};
}
@Override
public String getGroupName() {
return "金融行情数据";
}
}

30
src/main/java/com/fr/plugin/market/update/FunConstants.java

@ -0,0 +1,30 @@
package com.fr.plugin.market.update;
import com.fr.plugin.context.PluginContexts;
import com.fr.stable.ArrayUtils;
//import static com.fr.design.i18n.Toolkit.i18nText;
import java.awt.image.BufferedImage;
import java.io.File;
public class FunConstants {
static final String PLUGIN_ID="com.fr.plugin.function.market.update";
static final String AUTHOR_ERROR="Plugin.Function.Market_upate_AUTHOR_ERROR";
static final String CHECK_PASS="Plugin.Function.ImagProcess_CHECK_PASS";
static final String[] CurrencyCodeList=new String[]{
"HKD","MOP","TWD","EUR","USD","GBP","AUD","KRW","JPY","CNH","CAD","RUB","THB","PHP","ALL","ARS","AWG","AED","ANG","AZN","AOA","BSD","BHD","BBD","BYR","BZD","BMD","BTN","BOB","BWP","BRL","BGN","BIF","BDT","BND","CVE","COP","CRC","CUP","CZK","CHF","CYP","CLP","DZD","DKK","DOP","DJF","EGP","ETB","ECS","ERN","FKP","FJD","GMD","GYD","GHS","GNF","GTQ","GIP","HTG","HNL","HRK","HUF","ISK","INR","IDR","IRR","IQD","ILS","JMD","JOD","KPW","KZT","KHR","KYD","KMF","KES","KWD","LAK","LVL","LBP","LSL","LRD","LYD","LTL","LKR","MKD","MWK","MYR","MVR","MRO","MUR","MXN","MDL","MNT","MAD","MMK","MGA","NAD","NPR","NIO","NGN","NOK","NZD","OMR","PKR","PAB","PGK","PYG","PLN","PEN","QAR","RON","RWF","SEK","SVC","STD","SAR","SCR","SLL","SIT","SBD","SOS","SHP","SDG","SZL","SGD","SYP","TRY","TZS","TOP","TTD","TND","TJS","UAH","UYU","UGX","VUV","VEF","VND","WST","XOF","XAF","XCD","XPF","YER","ZWD","ZAR","ZMW"
};
static final String[] CurrencyNameList=new String[]{
"港元","澳门元","台币","欧元","美元","英镑","澳元","韩元","日元","离岸人民币","加拿大元","俄罗斯卢布","泰国铢","菲律宾比索","阿尔巴尼亚列克","阿根廷比索","阿鲁巴岛弗罗林","阿联酋迪拉姆","列斯荷兰盾","阿塞拜疆新马纳特","安哥拉宽扎","巴哈马元","巴林第纳尔","巴巴多斯元","白俄罗斯卢","伯利兹元","百慕大元","不丹卢比","玻利维亚诺","博茨瓦纳普拉","巴西里亚伊","保加利亚列瓦","布隆迪法郎","孟加拉塔卡","文莱元","佛得角埃斯库多","哥伦比亚比索","哥斯达黎加科朗","古巴比索","捷克克朗","瑞士法郎","塞浦路斯镑","智利比索","阿尔及利亚第纳尔","丹麦克朗","多米尼加比索","吉布提法郎","埃及镑","埃塞俄比亚比尔","厄瓜多尔苏克雷","厄立特里亚","福克兰群岛镑","斐济元","冈比亚达拉西","圭亚那元","加纳塞地","几内亚法郎","危地马拉格查尔","直布罗陀镑","海地古德","洪都拉斯伦皮拉","克罗地亚库纳","匈牙利福林","冰岛克朗","印度卢比","印度尼西亚卢比盾","伊朗里亚尔","伊拉克第纳尔","以色列镑","牙买加元","约旦第纳尔","朝鲜圆","哈萨克斯坦腾格","柬埔寨利尔斯","开曼岛元","科摩罗法郎","肯尼亚先令","科威特第纳尔","老挝基普","拉脱维亚拉图","黎巴嫩镑","莱索托洛提","利比里亚元","利比亚第纳尔","立陶宛里塔斯","斯里兰卡卢比","马其顿第纳尔","马拉维克瓦查","马来西亚林吉特","马尔代夫卢非亚","毛里塔尼亚乌吉亚","毛里求斯卢比","墨西哥比索","摩尔多瓦列伊","蒙古图格里克","摩洛哥道拉姆","缅甸元","马达加斯加阿里亚里","纳米比亚元","尼泊尔卢比","尼加拉瓜科多巴","尼日利亚奈拉","挪威克朗","新西兰元","阿曼里亚尔","巴基斯坦卢比","巴拿马巴尔博亚","巴布亚新几内亚基那","巴拉圭瓜拉尼","波兰兹罗提","秘鲁索尔","卡塔尔利尔","罗马尼亚新列伊","卢旺达法郎","瑞典克朗","萨尔瓦多科朗","圣多美多布拉","沙特阿拉伯里亚尔","塞舌尔法郎","塞拉利昂利昂","斯洛文尼亚托拉捷夫","所罗门群岛元","索马里先令","圣赫勒拿群岛磅","苏丹第纳尔","斯威士兰里兰吉尼","新加坡元","叙利亚镑","土耳其新里拉","坦桑尼亚先令","汤加潘加","特立尼达和多巴哥元","突尼斯第纳尔","塔吉克斯坦索莫尼","乌克兰赫夫米","乌拉圭新比索","乌干达先令","瓦努阿图瓦图","委内瑞拉博利瓦","越南盾","萨摩亚塔拉","多哥非洲共同体法郎","刚果中非共同体法郎","格林纳达东加勒比元","太平洋法郎","也门里亚尔","津巴布韦元","南非兰特","赞比亚克瓦查"
};
static final boolean author() {
return PluginContexts.currentContext().isAvailable();
}
static String CheckArgs(Object[] args,int num){
String res=FunConstants.CHECK_PASS;
int len = ArrayUtils.getLength(args);
if (len != num) {
return "Plugin.Function.ImagProcess_ArgsCountError";
}
return res;
}
}

49
src/main/java/com/fr/plugin/market/update/TestFun.java

@ -0,0 +1,49 @@
package com.fr.plugin.market.update;
import com.alibaba.fastjson.JSONObject;
import com.fr.plugin.market.update.FunConstants;
import com.fr.stable.ArrayUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
public class TestFun {
public static void main(String args[]) throws Exception {
// URL u=new URL("http://hl.anseo.cn");
// InputStream in=u.openStream();
// ByteArrayOutputStream out=new ByteArrayOutputStream();
// try {
// byte buf[]=new byte[1024];
// int read = 0;
// while ((read = in.read(buf)) > 0) {
// out.write(buf, 0, read);
// }
// } finally {
// if (in != null) {
// in.close();
// }
// }
// byte b[]=out.toByteArray( );
// final String s = new String(b, "utf-8");
//// JSONObject j=JSONObject.parseObject(s);
// System.out.println(s);
final String CHINA_BANK_URI = "https://api.exchangerate-api.com/v4/latest/USD";
if(!ArrayUtils.contains(FunConstants.CurrencyCodeList,"UD")){
System.out.printf("00");
}
Document doc = Jsoup.connect(CHINA_BANK_URI).ignoreContentType(true).get();
final String body = doc.getElementsByTag("body").first().text();
JSONObject j=JSONObject.parseObject(body);
System.out.printf(JSONObject.parseObject(j.get("rates").toString()).get("CNY").toString());
}
}

53
src/main/market update.iml

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../lib/fine-core-10.0-RELEASE-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/../../lib/fine-core-10.0-RELEASE-SNAPSHOT.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../lib/gson-2.8.5.jar!/" />
<root url="jar://$MODULE_DIR$/../../lib/fastjson-1.2.68.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$MODULE_DIR$/java" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="library" name="Maven: com.fr.third:fine-third:10.0-PERSIST-SNAPSHOT" level="project" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../../demo-db-access/lib/fine-third-10.0-PERSIST-20200507.045822-102.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../lib/jsoup-1.13.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
Loading…
Cancel
Save