From: <fg...@us...> - 2009-12-30 19:22:47
|
Revision: 1562 http://openutils.svn.sourceforge.net/openutils/?rev=1562&view=rev Author: fgiust Date: 2009-12-30 19:22:33 +0000 (Wed, 30 Dec 2009) Log Message: ----------- never try to resize an image to a width or height = 0 Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java 2009-12-30 19:12:37 UTC (rev 1561) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java 2009-12-30 19:22:33 UTC (rev 1562) @@ -168,6 +168,27 @@ public static BufferedImage resizeImage(BufferedImage original, int x, int y, int canvasX, int canvasY, Color background) { + if (x <= 0) + { + x = 1; + // throw new IllegalArgumentException("x=" + x + " (must be >0)"); + } + if (y <= 0) + { + y = 1; + // throw new IllegalArgumentException("y=" + y + " (must be >0)"); + } + if (canvasX <= 0) + { + canvasX = 1; + // throw new IllegalArgumentException("canvasX=" + canvasX + " (must be >0)"); + } + if (canvasY <= 0) + { + canvasY = 1; + // throw new IllegalArgumentException("canvasY=" + canvasY + " (must be >0)"); + } + BufferedImage resizedImage; try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |