本文整理匯總了Java中org.eclipse.swt.graphics.Color.isDisposed方法的典型用法代碼示例。如果您正苦於以下問題:Java Color.isDisposed方法的具體用法?Java Color.isDisposed怎麽用?Java Color.isDisposed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.graphics.Color
的用法示例。
在下文中一共展示了Color.isDisposed方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getColorFromRegistry
import org.eclipse.swt.graphics.Color; //導入方法依賴的package包/類
/**
* Returns Color from color registry
*
* @return
*/
public Color getColorFromRegistry(int red, int green, int blue) {
RGB colorValue = new RGB(red, green, blue);
Color color = COLOR_REGISTRY.get(colorValue.toString());
if (color == null || (color !=null && color.isDisposed())) {
COLOR_REGISTRY.put(colorValue.toString(), colorValue);
}
return COLOR_REGISTRY.get(colorValue.toString());
}
示例2: getSchemedColor
import org.eclipse.swt.graphics.Color; //導入方法依賴的package包/類
public static Color getSchemedColor(Device device, int red, int green, int blue) {
ensureMapColorsInitialized(device);
Long key = new Long(((long) red << 16) + (green << 8) + blue + 0x1000000l);
Color color = mapColors.get(key);
if (color == null || color.isDisposed()) {
try {
if (red < 0) {
red = 0;
} else if (red > 255) {
red = 255;
}
if (green < 0) {
green = 0;
} else if (green > 255) {
green = 255;
}
if (blue < 0) {
blue = 0;
} else if (blue > 255) {
blue = 255;
}
RGB rgb = new RGB(red, green, blue);
float[] hsb = rgb.getHSB();
hsb[0] += Colors.diffHue;
if (hsb[0] > 360) {
hsb[0] -= 360;
} else if (hsb[0] < 0) {
hsb[0] += 360;
}
hsb[1] *= Colors.diffSatPct;
//hsb[2] *= Colors.diffLumPct;
color = getColor(device, hsb);
mapColors.put(key, color);
} catch (IllegalArgumentException e) {
Debug.out("One Invalid: " + red + ";" + green + ";" + blue, e);
}
}
return color;
}