Skip to content

Commit

Permalink
release branch 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
binbin.hou committed Jul 5, 2021
1 parent e9008e1 commit 8343f37
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 11 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,16 @@

| 序号 | 变更类型 | 说明 | 时间 | 备注 |
|:---|:---|:---|:---|:--|
| 1 | A | 基本的依赖引入 | 2020-5-24 09:21:55 | |
| 1 | A | 基本的依赖引入 | 2020-5-24 09:21:55 | |

# release_1.1.0

| 序号 | 变更类型 | 说明 | 时间 | 备注 |
|:---|:---|:---|:---|:--|
| 1 | O | 实现优化 | 2020-5-24 09:21:55 | |

# release_1.2.0

| 序号 | 变更类型 | 说明 | 时间 | 备注 |
|:---|:---|:---|:---|:--|
| 1 | F | 工具方法引入背景特性 | 2021-07-05 19:21:55 | |
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

- 极简 api,一行代码搞定一切

- 支持自定义云图背景

> [变更日志](https://github.com/houbb/word-cloud/blob/master/CHANGELOG.md)
# 快速开始
Expand All @@ -21,7 +23,7 @@
<dependency>
<groupId>com.github.houbb</groupId>
<artifactId>word-cloud</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</dependency>
```

Expand All @@ -36,8 +38,23 @@ WordCloudHelper.wordCloud("该作讲述的是一个名为德特茅斯的衰落

![out.png](out.png)

## 支持背景

我们以鲸鱼的背景,可以让文字以图像的形式展现:

```java
String imagePath = "backgrounds\\whale_small.png";
WordCloudHelper.wordCloud(text, "out_bg.png", imagePath);
```

效果如下:

![out_bg.png](out_bg.png)

# Road-Map

- [ ] 默认的形状,图片。
- [ x ] 默认的形状,图片。

- [ x ] 引入图片背景

- [ ] 引入图片背景
- [ ] image 居中
Binary file modified out.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added out_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>com.github.houbb</groupId>
<artifactId>word-cloud</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.0</version>

<properties>
<!--============================== All Plugins START ==============================-->
Expand Down
4 changes: 2 additions & 2 deletions release.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ ECHO "============================= RELEASE START..."

:: 版本号信息(需要手动指定)
:::: 旧版本名称
SET version=1.1.0
SET version=1.2.0
:::: 新版本名称
SET newVersion=1.2.0
SET newVersion=1.3.0
:::: 组织名称
SET groupName=com.github.houbb
:::: 项目名称
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.github.houbb.word.cloud.exception;

/**
* @author binbin.hou
* @since 1.2.0
*/
public class WordCloudException extends RuntimeException {

public WordCloudException() {
}

public WordCloudException(String message) {
super(message);
}

public WordCloudException(String message, Throwable cause) {
super(message, cause);
}

public WordCloudException(Throwable cause) {
super(cause);
}

public WordCloudException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.github.houbb.word.cloud.util;

import com.github.houbb.word.cloud.bs.WordCloudBs;
import com.github.houbb.word.cloud.exception.WordCloudException;
import com.kennycason.kumo.bg.PixelBoundryBackground;

import java.io.FileInputStream;
import java.io.IOException;

/**
* @author binbin.hou
Expand All @@ -10,17 +15,34 @@ public final class WordCloudHelper {

private WordCloudHelper(){}

/**
* 云图
* @param text 文本
* @param outPath 输出路径
* @since 1.0.0
*/
public static void wordCloud(final String text,
final String outPath,
final String backgroundImagePath) {
try {
WordCloudBs.newInstance()
.text(text)
.outPath(outPath)
.background(new PixelBoundryBackground(backgroundImagePath))
.wordCloud();
} catch (IOException e) {
throw new WordCloudException(e);
}
}

/**
* 云图
* @param text 文本
* @param outPath 输出路径
* @since 1.0.0
*/
public static void wordCloud(final String text, final String outPath) {
WordCloudBs.newInstance()
.text(text)
.outPath(outPath)
.wordCloud();
wordCloud(text, outPath, null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.github.houbb.word.cloud.util;

import org.junit.Ignore;
import org.junit.Test;

/**
* @author binbin.hou
* @since 1.2.0
*/
@Ignore
public class WordCloudHelperBgTest {

@Test
public void helloTest() {
String text = "该作讲述的是一个名为德特茅斯的衰落小镇下掩埋着一个古老的废弃王国,名叫圣巢。这个王国被瘟疫所侵蚀而废弃,废弃的原因则是因为名为辐光的光之古神,她可以通过思想来传播瘟疫,被瘟疫侵蚀的虫子都会被本能所支配,失去心智。" +
"这个王国的主人——苍白之王,自然不会坐视不管,他在圣巢范围之下的深渊,利用另一种远古力量“虚空”可以压制光明的特性,制造了容器一族。其中一位被选中的容器用来封印瘟疫,并被命名为空洞骑士。为了封印的稳固,白王寻找了三个守梦人来进一步巩固封印,三位守梦人的名称分别为守望者 - 卢瑞恩,导师 - 莫诺蒙,野兽 - 赫拉。但之后苍白之王不知去向,不完美的容器的力量的也变得逐渐虚弱,最终被辐光控制。主角就要穿过圣巢的各地,在安息之地中,我们受到曾经辐光的信徒和眷族——飞蛾族唯一留下的族人的帮助,获得了和辐光力量同源的梦之武器——梦之钉。梦之钉可以读取生物内心的想法,并可以打破守梦人的保护,进入到其梦境之中杀死守梦人。杀死了三位守梦人并解开封印后,可选的结局有到达十字路里的黑卵神殿打败空洞骑士或去到在“寻神者”更新中新加入的地点“神居”并挑战圣巢万神殿。";
String imagePath = "D:\\github\\word-cloud\\src\\test\\resources\\backgrounds\\whale_small.png";

WordCloudHelper.wordCloud(text, "out_bg.png", imagePath);
}

}

0 comments on commit 8343f37

Please sign in to comment.