This commit is contained in:
Looly
2022-09-22 03:33:30 +08:00
parent d959f3a24f
commit ba5f1f5264
40 changed files with 143 additions and 235 deletions

View File

@@ -1,4 +1,4 @@
package cn.hutool.core.img;
package cn.hutool.swing.img;
import java.awt.Image;
@@ -10,15 +10,25 @@ import java.awt.Image;
*/
public enum ScaleType {
/** 默认 */
/**
* 默认
*/
DEFAULT(Image.SCALE_DEFAULT),
/** 快速 */
/**
* 快速
*/
FAST(Image.SCALE_FAST),
/** 平滑 */
/**
* 平滑
*/
SMOOTH(Image.SCALE_SMOOTH),
/** 使用 ReplicateScaleFilter 类中包含的图像缩放算法 */
/**
* 使用 ReplicateScaleFilter 类中包含的图像缩放算法
*/
REPLICATE(Image.SCALE_REPLICATE),
/** Area Averaging算法 */
/**
* Area Averaging算法
*/
AREA_AVERAGING(Image.SCALE_AREA_AVERAGING);
/**
@@ -37,6 +47,11 @@ public enum ScaleType {
private final int value;
/**
* 获取值
*
* @return 值
*/
public int getValue() {
return this.value;
}

View File

@@ -296,6 +296,7 @@ public class AnimatedGifEncoder {
public boolean start(final String file) {
boolean ok;
try {
//noinspection IOStreamConstructor
out = new BufferedOutputStream(new FileOutputStream(file));
ok = start(out);
closeStream = true;
@@ -305,6 +306,9 @@ public class AnimatedGifEncoder {
return started = ok;
}
/**
* @return 是否开始
*/
public boolean isStarted() {
return started;
}
@@ -339,7 +343,7 @@ public class AnimatedGifEncoder {
pixels = null;
colorDepth = 8;
palSize = 7;
// get closest match to transparent color if specified
// get the closest match to transparent color if specified
if (transparent != null) {
transIndex = transparentExactMatch ? findExact(transparent) : findClosest(transparent);
}
@@ -377,7 +381,7 @@ public class AnimatedGifEncoder {
/**
* Returns true if the exact matching color is existing, and used in the color palette, otherwise, return false.
* This method has to be called before finishing the image,
* because after finished the palette is destroyed and it will always return false.
* because after finished the palette is destroyed, and it will always return false.
*
* @param c 颜色
* @return 颜色是否存在