Changeset 492
- Timestamp:
- 05/30/10 16:10:07 (2 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
resource-types/image-resizer/src/java/com/litwan/yanel/impl/resources/imageresizer/ImageResizerResource.java
r491 r492 18 18 19 19 import java.awt.AlphaComposite; 20 import java.awt.Color; 20 21 import java.awt.Graphics2D; 21 22 import java.awt.Image; … … 70 71 71 72 private static final String CONFIG_PROPERTY_CROP_H = "crop-h"; 73 74 private static final String CONFIG_PROPERTY_BACKGROUND_COLOR = "background-color"; 72 75 73 76 private static final String CONFIG_PROPERTY_TARGET_PERCENTAGE = "target-percentage"; … … 197 200 int cropH = origHeight; 198 201 int cropW = origWidth; 199 202 Color color = new Color(0xFFFFFF); 200 203 201 204 … … 254 257 throw new Exception("Image resizer is not properly configured."); 255 258 } 256 259 //croping 257 260 String propertyCropX = getResourceConfigProperty(CONFIG_PROPERTY_CROP_X); 258 261 String propertyCropY = getResourceConfigProperty(CONFIG_PROPERTY_CROP_Y); … … 295 298 cropH = origHeight - cropY; 296 299 } 300 //backgroundColor 301 String propertyBackgroundColor = getResourceConfigProperty(CONFIG_PROPERTY_BACKGROUND_COLOR); 302 if (propertyBackgroundColor != null) { 303 color = Color.decode(propertyBackgroundColor); 304 } 297 305 if (Boolean.parseBoolean(getResourceConfigProperty(CONFIG_PROPERTY_PROHIBIT_UP_SCALE)) && (targetWidth > origWidth || targetHeight > origHeight)) { 298 306 return originalImage; … … 305 313 g.setComposite(AlphaComposite.Src); 306 314 } 307 g.drawImage(clipedImage, 0, 0, targetWidth, targetHeight, null);315 g.drawImage(clipedImage, 0, 0, targetWidth, targetHeight, color, null); 308 316 g.dispose(); 309 317 return scaledBI;
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)