|
@@ -29,6 +29,7 @@ import java.awt.Graphics2D;
|
|
|
import java.awt.Image;
|
|
import java.awt.Image;
|
|
|
import java.awt.Point;
|
|
import java.awt.Point;
|
|
|
import java.awt.Rectangle;
|
|
import java.awt.Rectangle;
|
|
|
|
|
+import java.awt.Toolkit;
|
|
|
import java.awt.font.FontRenderContext;
|
|
import java.awt.font.FontRenderContext;
|
|
|
import java.awt.geom.AffineTransform;
|
|
import java.awt.geom.AffineTransform;
|
|
|
import java.awt.geom.Rectangle2D;
|
|
import java.awt.geom.Rectangle2D;
|
|
@@ -183,7 +184,7 @@ public class ImgUtil {
|
|
|
* @param destImageFile 缩放后的图像地址
|
|
* @param destImageFile 缩放后的图像地址
|
|
|
* @param width 缩放后的宽度
|
|
* @param width 缩放后的宽度
|
|
|
* @param height 缩放后的高度
|
|
* @param height 缩放后的高度
|
|
|
- * @param fixedColor 补充的颜色,不补充为<code>null</code>
|
|
|
|
|
|
|
+ * @param fixedColor 补充的颜色,不补充为{@code null}
|
|
|
* @throws IORuntimeException IO异常
|
|
* @throws IORuntimeException IO异常
|
|
|
*/
|
|
*/
|
|
|
public static void scale(File srcImageFile, File destImageFile, int width, int height, Color fixedColor) throws IORuntimeException {
|
|
public static void scale(File srcImageFile, File destImageFile, int width, int height, Color fixedColor) throws IORuntimeException {
|
|
@@ -201,7 +202,7 @@ public class ImgUtil {
|
|
|
* @param destStream 缩放后的图像目标流
|
|
* @param destStream 缩放后的图像目标流
|
|
|
* @param width 缩放后的宽度
|
|
* @param width 缩放后的宽度
|
|
|
* @param height 缩放后的高度
|
|
* @param height 缩放后的高度
|
|
|
- * @param fixedColor 比例不对时补充的颜色,不补充为<code>null</code>
|
|
|
|
|
|
|
+ * @param fixedColor 比例不对时补充的颜色,不补充为{@code null}
|
|
|
* @throws IORuntimeException IO异常
|
|
* @throws IORuntimeException IO异常
|
|
|
*/
|
|
*/
|
|
|
public static void scale(InputStream srcStream, OutputStream destStream, int width, int height, Color fixedColor) throws IORuntimeException {
|
|
public static void scale(InputStream srcStream, OutputStream destStream, int width, int height, Color fixedColor) throws IORuntimeException {
|
|
@@ -216,7 +217,7 @@ public class ImgUtil {
|
|
|
* @param destStream 缩放后的图像目标流
|
|
* @param destStream 缩放后的图像目标流
|
|
|
* @param width 缩放后的宽度
|
|
* @param width 缩放后的宽度
|
|
|
* @param height 缩放后的高度
|
|
* @param height 缩放后的高度
|
|
|
- * @param fixedColor 比例不对时补充的颜色,不补充为<code>null</code>
|
|
|
|
|
|
|
+ * @param fixedColor 比例不对时补充的颜色,不补充为{@code null}
|
|
|
* @throws IORuntimeException IO异常
|
|
* @throws IORuntimeException IO异常
|
|
|
*/
|
|
*/
|
|
|
public static void scale(ImageInputStream srcStream, ImageOutputStream destStream, int width, int height, Color fixedColor) throws IORuntimeException {
|
|
public static void scale(ImageInputStream srcStream, ImageOutputStream destStream, int width, int height, Color fixedColor) throws IORuntimeException {
|
|
@@ -231,7 +232,7 @@ public class ImgUtil {
|
|
|
* @param destImageStream 缩放后的图像目标流
|
|
* @param destImageStream 缩放后的图像目标流
|
|
|
* @param width 缩放后的宽度
|
|
* @param width 缩放后的宽度
|
|
|
* @param height 缩放后的高度
|
|
* @param height 缩放后的高度
|
|
|
- * @param fixedColor 比例不对时补充的颜色,不补充为<code>null</code>
|
|
|
|
|
|
|
+ * @param fixedColor 比例不对时补充的颜色,不补充为{@code null}
|
|
|
* @throws IORuntimeException IO异常
|
|
* @throws IORuntimeException IO异常
|
|
|
*/
|
|
*/
|
|
|
public static void scale(Image srcImage, ImageOutputStream destImageStream, int width, int height, Color fixedColor) throws IORuntimeException {
|
|
public static void scale(Image srcImage, ImageOutputStream destImageStream, int width, int height, Color fixedColor) throws IORuntimeException {
|
|
@@ -245,7 +246,7 @@ public class ImgUtil {
|
|
|
* @param srcImage 源图像
|
|
* @param srcImage 源图像
|
|
|
* @param width 缩放后的宽度
|
|
* @param width 缩放后的宽度
|
|
|
* @param height 缩放后的高度
|
|
* @param height 缩放后的高度
|
|
|
- * @param fixedColor 比例不对时补充的颜色,不补充为<code>null</code>
|
|
|
|
|
|
|
+ * @param fixedColor 比例不对时补充的颜色,不补充为{@code null}
|
|
|
* @return {@link Image}
|
|
* @return {@link Image}
|
|
|
*/
|
|
*/
|
|
|
public static Image scale(Image srcImage, int width, int height, Color fixedColor) {
|
|
public static Image scale(Image srcImage, int width, int height, Color fixedColor) {
|
|
@@ -1642,6 +1643,17 @@ public class ImgUtil {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 从URL中获取或读取图片对象
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param url URL
|
|
|
|
|
+ * @return {@link Image}
|
|
|
|
|
+ * @since 5.5.8
|
|
|
|
|
+ */
|
|
|
|
|
+ public static Image getImage(URL url){
|
|
|
|
|
+ return Toolkit.getDefaultToolkit().getImage(url);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 从{@link Resource}中读取图片
|
|
* 从{@link Resource}中读取图片
|
|
|
*
|
|
*
|
|
|
* @param resource 图片资源
|
|
* @param resource 图片资源
|