本文整理汇总了Java中sun.awt.IconInfo.getRawLength方法的典型用法代码示例。如果您正苦于以下问题:Java IconInfo.getRawLength方法的具体用法?Java IconInfo.getRawLength怎么用?Java IconInfo.getRawLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.awt.IconInfo
的用法示例。
在下文中一共展示了IconInfo.getRawLength方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: normalizeIconImages
import sun.awt.IconInfo; //导入方法依赖的package包/类
static java.util.List<IconInfo> normalizeIconImages(java.util.List<IconInfo> icons) {
java.util.List<IconInfo> result = new ArrayList<IconInfo>();
int totalLength = 0;
boolean haveLargeIcon = false;
for (IconInfo icon : icons) {
int width = icon.getWidth();
int height = icon.getHeight();
int length = icon.getRawLength();
if (width > PREFERRED_SIZE_FOR_ICON || height > PREFERRED_SIZE_FOR_ICON) {
if (haveLargeIcon) {
continue;
}
int scaledWidth = width;
int scaledHeight = height;
while (scaledWidth > PREFERRED_SIZE_FOR_ICON ||
scaledHeight > PREFERRED_SIZE_FOR_ICON) {
scaledWidth = scaledWidth / 2;
scaledHeight = scaledHeight / 2;
}
icon.setScaledSize(scaledWidth, scaledHeight);
length = icon.getRawLength();
}
if (totalLength + length <= MAXIMUM_BUFFER_LENGTH_NET_WM_ICON) {
totalLength += length;
result.add(icon);
if (width > PREFERRED_SIZE_FOR_ICON || height > PREFERRED_SIZE_FOR_ICON) {
haveLargeIcon = true;
}
}
}
if (iconLog.isLoggable(PlatformLogger.Level.FINEST)) {
iconLog.finest(">>> Length_ of buffer of icons data: " + totalLength +
", maximum length: " + MAXIMUM_BUFFER_LENGTH_NET_WM_ICON);
}
return result;
}
示例2: normalizeIconImages
import sun.awt.IconInfo; //导入方法依赖的package包/类
static java.util.List<IconInfo> normalizeIconImages(java.util.List<IconInfo> icons) {
java.util.List<IconInfo> result = new ArrayList<IconInfo>();
int totalLength = 0;
boolean haveLargeIcon = false;
for (IconInfo icon : icons) {
int width = icon.getWidth();
int height = icon.getHeight();
int length = icon.getRawLength();
if (width > PREFERRED_SIZE_FOR_ICON || height > PREFERRED_SIZE_FOR_ICON) {
if (haveLargeIcon) {
continue;
}
int scaledWidth = width;
int scaledHeight = height;
while (scaledWidth > PREFERRED_SIZE_FOR_ICON ||
scaledHeight > PREFERRED_SIZE_FOR_ICON) {
scaledWidth = scaledWidth / 2;
scaledHeight = scaledHeight / 2;
}
icon.setScaledSize(scaledWidth, scaledHeight);
length = icon.getRawLength();
}
if (totalLength + length <= MAXIMUM_BUFFER_LENGTH_NET_WM_ICON) {
totalLength += length;
result.add(icon);
if (width > PREFERRED_SIZE_FOR_ICON || height > PREFERRED_SIZE_FOR_ICON) {
haveLargeIcon = true;
}
}
}
if (iconLog.isLoggable(PlatformLogger.FINEST)) {
iconLog.finest(">>> Length_ of buffer of icons data: " + totalLength +
", maximum length: " + MAXIMUM_BUFFER_LENGTH_NET_WM_ICON);
}
return result;
}