本文整理了Java中org.eclipse.swt.graphics.RGB.getHSB
方法的一些代码示例,展示了RGB.getHSB
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RGB.getHSB
方法的具体详情如下:
包路径:org.eclipse.swt.graphics.RGB
类名称:RGB
方法名:getHSB
[英]Returns the hue, saturation, and brightness of the color.
[中]返回颜色的色调、饱和度和亮度。
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Returns the hue, saturation, and brightness of the color.
*
* @return color space values in float format:<ul>
* <li>hue (from 0 to 360)</li>
* <li>saturation (from 0 to 1)</li>
* <li>brightness (from 0 to 1)</li>
* <li>alpha (from 0 to 255)</li>
* </ul>
* @see #RGBA(float, float, float, float)
*/
public float[] getHSBA() {
float[] hsb = rgb.getHSB();
return new float[] {hsb[0], hsb[1], hsb[2], alpha};
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Returns the hue, saturation, and brightness of the color.
*
* @return color space values in float format:<ul>
* <li>hue (from 0 to 360)</li>
* <li>saturation (from 0 to 1)</li>
* <li>brightness (from 0 to 1)</li>
* <li>alpha (from 0 to 255)</li>
* </ul>
* @see #RGBA(float, float, float, float)
*/
public float[] getHSBA() {
float[] hsb = rgb.getHSB();
return new float[] {hsb[0], hsb[1], hsb[2], alpha};
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Returns the hue, saturation, and brightness of the color.
*
* @return color space values in float format:<ul>
* <li>hue (from 0 to 360)</li>
* <li>saturation (from 0 to 1)</li>
* <li>brightness (from 0 to 1)</li>
* <li>alpha (from 0 to 255)</li>
* </ul>
* @see #RGBA(float, float, float, float)
*/
public float[] getHSBA() {
float[] hsb = rgb.getHSB();
return new float[] {hsb[0], hsb[1], hsb[2], alpha};
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
/**
* Returns the hue, saturation, and brightness of the color.
*
* @return color space values in float format:<ul>
* <li>hue (from 0 to 360)</li>
* <li>saturation (from 0 to 1)</li>
* <li>brightness (from 0 to 1)</li>
* <li>alpha (from 0 to 255)</li>
* </ul>
* @see #RGBA(float, float, float, float)
*/
public float[] getHSBA() {
float[] hsb = rgb.getHSB();
return new float[] {hsb[0], hsb[1], hsb[2], alpha};
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
/**
* Returns the hue, saturation, and brightness of the color.
*
* @return color space values in float format:<ul>
* <li>hue (from 0 to 360)</li>
* <li>saturation (from 0 to 1)</li>
* <li>brightness (from 0 to 1)</li>
* <li>alpha (from 0 to 255)</li>
* </ul>
* @see #RGBA(float, float, float, float)
*/
public float[] getHSBA() {
float[] hsb = rgb.getHSB();
return new float[] {
hsb[ 0 ],
hsb[ 1 ],
hsb[ 2 ],
alpha
};
}
代码示例来源:origin: stackoverflow.com
RGB rgb = new RGB(r, g, b);
float[] hsbColor = rgb.getHSB();
rgb = new RGB(hsbColor[0], hsbColor[1], hsbColor[2]);
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
@Override
public RGB createColor() {
RGB rgb = ColorUtil.getColorValue(color);
float scale = Float.parseFloat(scaleFactor);
float[] hsb = rgb.getHSB();
float b = hsb[2] * scale;
if (b < 0)
b = 0;
if (b > 1)
b = 1;
return new RGB(hsb[0], hsb[1], b);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
@Override
public RGB createColor() {
RGB cfg, cbg, cbgAlt;
if (fg != null) {
cfg = ColorUtil.getColorValue(fg);
} else {
cfg = new RGB(0, 0, 0);
}
if (bg != null) {
cbg = ColorUtil.getColorValue(bg);
} else {
cbg = new RGB(255, 255, 255);
}
if (altBg != null) {
cbgAlt = ColorUtil.getColorValue(altBg);
} else {
cbgAlt = new RGB(255, 255, 255);
}
float bfg = cfg.getHSB()[2];
float bbg = cbg.getHSB()[2];
float bbgAlt = cbgAlt.getHSB()[2];
if (Math.abs(bbg - bfg) < 0.5f && Math.abs(bbgAlt - bfg) > Math.abs(bbg - bfg)) {
return cbgAlt;
}
return cbg;
}
代码示例来源:origin: BiglySoftware/BiglyBT
float[] hsb = rgb.getHSB();
hsb[0] += Colors.diffHue;
if (hsb[0] > 360) {
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
/**
* Sets the viewer's background color to the given control's background color.
* The background color is <em>only</em> set if it's visibly distinct from the
* default Java source text color.
*
* @param control the control with the default background color
* @since 3.7
*/
public void adaptBackgroundColor(Control control) {
// workaround for dark editor background color, see https://bugs.eclipse.org/330680
Color defaultColor= control.getBackground();
float[] defaultBgHSB= defaultColor.getRGB().getHSB();
Color javaDefaultColor= JavaUI.getColorManager().getColor(IJavaColorConstants.JAVA_DEFAULT);
RGB javaDefaultRGB= javaDefaultColor != null ? javaDefaultColor.getRGB() : new RGB(255, 255, 255);
float[] javaDefaultHSB= javaDefaultRGB.getHSB();
if (Math.abs(defaultBgHSB[2] - javaDefaultHSB[2]) >= 0.5f) {
getTextWidget().setBackground(defaultColor);
if (fBackgroundColor != null) {
fBackgroundColor.dispose();
fBackgroundColor= null;
}
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
/**
* Sets the viewer's background color to the given control's background color.
* The background color is <em>only</em> set if it's visibly distinct from the
* default Java source text color.
*
* @param control the control with the default background color
* @since 3.7
*/
public void adaptBackgroundColor(Control control) {
// workaround for dark editor background color, see https://bugs.eclipse.org/330680
Color defaultColor= control.getBackground();
float[] defaultBgHSB= defaultColor.getRGB().getHSB();
Color javaDefaultColor= JavaUI.getColorManager().getColor(IJavaColorConstants.JAVA_DEFAULT);
RGB javaDefaultRGB= javaDefaultColor != null ? javaDefaultColor.getRGB() : new RGB(255, 255, 255);
float[] javaDefaultHSB= javaDefaultRGB.getHSB();
if (Math.abs(defaultBgHSB[2] - javaDefaultHSB[2]) >= 0.5f) {
getTextWidget().setBackground(defaultColor);
if (fBackgroundColor != null) {
fBackgroundColor.dispose();
fBackgroundColor= null;
}
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
/**
* Returns <code>null</code> if {@link SWT#COLOR_INFO_BACKGROUND} is visibly distinct from the
* default Java source text color. Otherwise, returns the editor background color.
*
* @param display the display
* @return an RGB or <code>null</code>
* @since 3.6.1
*/
public static RGB getVisibleBackgroundColor(Display display) {
float[] infoBgHSB= display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB().getHSB();
Color javaDefaultColor= JavaUI.getColorManager().getColor(IJavaColorConstants.JAVA_DEFAULT);
RGB javaDefaultRGB= javaDefaultColor != null ? javaDefaultColor.getRGB() : new RGB(255, 255, 255);
float[] javaDefaultHSB= javaDefaultRGB.getHSB();
if (Math.abs(infoBgHSB[2] - javaDefaultHSB[2]) < 0.5f) {
// workaround for dark tooltip background color, see https://bugs.eclipse.org/309334
IPreferenceStore preferenceStore= JavaPlugin.getDefault().getCombinedPreferenceStore();
boolean useDefault= preferenceStore.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT);
if (useDefault)
return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
return PreferenceConverter.getColor(preferenceStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
}
return null;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
/**
* Returns <code>null</code> if {@link SWT#COLOR_INFO_BACKGROUND} is visibly distinct from the
* default Java source text color. Otherwise, returns the editor background color.
*
* @param display the display
* @return an RGB or <code>null</code>
* @since 3.6.1
*/
public static RGB getVisibleBackgroundColor(Display display) {
float[] infoBgHSB= display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB().getHSB();
Color javaDefaultColor= JavaUI.getColorManager().getColor(IJavaColorConstants.JAVA_DEFAULT);
RGB javaDefaultRGB= javaDefaultColor != null ? javaDefaultColor.getRGB() : new RGB(255, 255, 255);
float[] javaDefaultHSB= javaDefaultRGB.getHSB();
if (Math.abs(infoBgHSB[2] - javaDefaultHSB[2]) < 0.5f) {
// workaround for dark tooltip background color, see https://bugs.eclipse.org/309334
IPreferenceStore preferenceStore= JavaPlugin.getDefault().getCombinedPreferenceStore();
boolean useDefault= preferenceStore.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT);
if (useDefault)
return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
return PreferenceConverter.getColor(preferenceStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
}
return null;
}
代码示例来源:origin: BiglySoftware/BiglyBT
float[] hsb = tabFolder.getBackground().getRGB().getHSB();
hsb[2] *= (Constants.isOSX) ? 0.9 : 0.97;
tabFolder.setBackground(ColorCache.getColor(display, hsb));
hsb = tabFolder.getForeground().getRGB().getHSB();
hsb[2] *= (Constants.isOSX) ? 1.1 : 0.03;
tabFolder.setForeground(ColorCache.getColor(display, hsb));
内容来源于网络,如有侵权,请联系作者删除!