diff --git a/src/net/java/sip/communicator/impl/gui/main/presence/AccountStatusPanel.java b/src/net/java/sip/communicator/impl/gui/main/presence/AccountStatusPanel.java
index 22af0c60a..d858d7536 100644
--- a/src/net/java/sip/communicator/impl/gui/main/presence/AccountStatusPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/presence/AccountStatusPanel.java
@@ -138,14 +138,21 @@ public void updateStatus( ProtocolProviderService protocolProvider)
}
/**
- * Returns TRUE if there are selected status selector boxes, otherwise
- * returns FALSE.
+ * Returns true if there are selected status selector boxes,
+ * otherwise returns false.
+ * @return true if there are selected status selector boxes,
+ * otherwise returns false
*/
public boolean hasSelectedMenus()
{
return statusComboBox.hasSelectedMenus();
}
+ /**
+ * Updates account information when a protocol provider is registered.
+ * @param evt the RegistrationStateChangeEvent that notified us
+ * of the change
+ */
public void registrationStateChanged(RegistrationStateChangeEvent evt)
{
ProtocolProviderService protocolProvider = evt.getProvider();
@@ -154,7 +161,6 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
if (evt.getNewState().equals(RegistrationState.REGISTERED))
{
-
/*
* Check the support for OperationSetServerStoredAccountInfo prior
* to starting the Thread because only a couple of the protocols
@@ -165,7 +171,6 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
= protocolProvider.getOperationSet(
OperationSetServerStoredAccountInfo.class);
-
if (accountInfoOpSet != null)
/*
* FIXME Starting a separate Thread for each
diff --git a/src/net/java/sip/communicator/util/ImageUtils.java b/src/net/java/sip/communicator/util/ImageUtils.java
index f278194ef..b8b5f9909 100644
--- a/src/net/java/sip/communicator/util/ImageUtils.java
+++ b/src/net/java/sip/communicator/util/ImageUtils.java
@@ -7,6 +7,7 @@
package net.java.sip.communicator.util;
import java.awt.*;
+import java.awt.geom.*;
import java.awt.image.*;
import java.io.*;
import java.net.*;
@@ -14,8 +15,6 @@
import javax.imageio.*;
import javax.swing.*;
-import net.java.sip.communicator.util.swing.*;
-
/**
* Utility methods for image manipulation.
*
@@ -56,6 +55,13 @@ public static Image scaleImageWithinBounds( Image image,
return scaledImage;
}
+ /**
+ * Returns the scaled icon.
+ * @param image the image to scale
+ * @param width the desired width after the scale
+ * @param height the desired height after the scale
+ * @return the scaled icon
+ */
public static ImageIcon scaleIconWithinBounds(Image image, int width,
int height)
{
@@ -66,13 +72,15 @@ public static ImageIcon scaleIconWithinBounds(Image image, int width,
* Creates a rounded avatar image.
*
* @param image image of the initial avatar image.
- *
- * @return The rounded corner image.
+ * @param width the desired result width
+ * @param height the desired result height
+ * @return the rounded corner image
*/
public static Image getScaledRoundedImage(Image image, int width, int height)
{
ImageIcon scaledImage =
ImageUtils.scaleIconWithinBounds(image, width, height);
+
int scaledImageWidth = scaledImage.getIconWidth();
int scaledImageHeight = scaledImage.getIconHeight();
@@ -80,29 +88,36 @@ public static Image getScaledRoundedImage(Image image, int width, int height)
scaledImageWidth <= 0)
return null;
- BufferedImage destImage =
- new BufferedImage(scaledImageWidth, scaledImageHeight,
- BufferedImage.TYPE_INT_ARGB);
+ RoundRectangle2D roundRect
+ = new RoundRectangle2D.Double(
+ 0, 0, scaledImageWidth, scaledImageHeight, 10, 10);
- Graphics2D g = destImage.createGraphics();
+ int type = BufferedImage.TYPE_INT_ARGB_PRE;
+ BufferedImage dstImage
+ = new BufferedImage(scaledImageWidth, scaledImageHeight, type);
+ Graphics2D g = dstImage.createGraphics();
try
{
- AntialiasingManager.activateAntialiasing(g);
-
- g.setColor(Color.WHITE);
- g.fillRoundRect(0, 0, scaledImageWidth, scaledImageHeight, 10, 10);
- g.setComposite(AlphaComposite.SrcIn);
-
+ g.setRenderingHint( RenderingHints.KEY_INTERPOLATION,
+ RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g.setClip(roundRect);
g.drawImage(scaledImage.getImage(), 0, 0, null);
}
finally
{
g.dispose();
}
- return destImage;
+ return dstImage;
}
+ /**
+ * Returns the scaled image in byte array.
+ * @param image the image to scale
+ * @param width the desired width after the scale
+ * @param height the desired height after the scale
+ * @return the scaled image in byte array
+ */
public static byte[] getScaledInstanceInBytes(
Image image, int width, int height)
{