当前位置: 首页>>代码示例>>Java>>正文


Java Color.HSBtoRGB方法代码示例

本文整理汇总了Java中java.awt.Color.HSBtoRGB方法的典型用法代码示例。如果您正苦于以下问题:Java Color.HSBtoRGB方法的具体用法?Java Color.HSBtoRGB怎么用?Java Color.HSBtoRGB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Color的用法示例。


在下文中一共展示了Color.HSBtoRGB方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createHexaColor

import java.awt.Color; //导入方法依赖的package包/类
private String createHexaColor(float dimVal) {

		// white in HSB-color scheme
		float hue = 0;
		float sat = 0;
		float bright = 1;

		// subtract probability (dimVal) from brightness to receive a particular
		// grey tone (the more probable an effect, the blacker the color
		bright -= dimVal;

		// convert current HSB values to RGB (required for following
		// html-transformation
		int rgb = Color.HSBtoRGB(hue, sat, bright);
		// r, g and b correspond to the computed grey-value in RGB-scheme

		// transform RGB to html
		String hex = Integer.toHexString(rgb & 0xffffff);
		if (hex.length() < 6) {
			hex = "0" + hex;
		}
		// html colors always start with a #-symbol
		hex = "#" + hex;

		return hex;
	}
 
开发者ID:CognitiveModeling,项目名称:BrainControl,代码行数:27,代码来源:BrainTableRenderer.java

示例2: AEChipRenderer

import java.awt.Color; //导入方法依赖的package包/类
public AEChipRenderer(AEChip chip) {
	super(chip);
	if (chip == null) {
		throw new Error("tried to build ChipRenderer with null chip");
	}
	setChip(chip);
	spikeSound = new SpikeSound();
	timeColors = new float[NUM_TIME_COLORS][3];
	float s = 1f / NUM_TIME_COLORS;
	for (int i = 0; i < NUM_TIME_COLORS; i++) {
		int rgb = Color.HSBtoRGB((0.66f * (NUM_TIME_COLORS - i)) / NUM_TIME_COLORS, 1f, 1f);
		Color c = new Color(rgb);
		float[] comp = c.getRGBColorComponents(null);
		timeColors[i][0] = comp[0];
		timeColors[i][2] = comp[2];
		timeColors[i][1] = comp[1];
		// System.out.println(String.format("%.2f %.2f %.2f",comp[0],comp[1],comp[2]));
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:20,代码来源:AEChipRenderer.java

示例3: renderRecordOverlay

import java.awt.Color; //导入方法依赖的package包/类
protected void renderRecordOverlay(int width, int height, float partialTicks)
{
    if (recordPlayingUpFor > 0)
    {
        mc.mcProfiler.startSection("overlayMessage");
        float hue = (float)recordPlayingUpFor - partialTicks;
        int opacity = (int)(hue * 256.0F / 20.0F);
        if (opacity > 255) opacity = 255;

        if (opacity > 0)
        {
            GlStateManager.pushMatrix();
            GlStateManager.translate((float)(width / 2), (float)(height - 68), 0.0F);
            GlStateManager.enableBlend();
            GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
            int color = (recordIsPlaying ? Color.HSBtoRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE);
            fontrenderer.drawString(recordPlaying, -fontrenderer.getStringWidth(recordPlaying) / 2, -4, color | (opacity << 24));
            GlStateManager.disableBlend();
            GlStateManager.popMatrix();
        }

        mc.mcProfiler.endSection();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:GuiIngameForge.java

示例4: getHeaderBgColor

import java.awt.Color; //导入方法依赖的package包/类
/**Get the background color for the header.  This depends on the
 * value of nestingLevel.
 */
private String getHeaderBgColor () {
    float[] hsb = new float[3];
    hsb = Color.RGBtoHSB(140, 140, 204, hsb);
    hsb[0] += .25f * nestingLevel;
    int color = Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]);
    Color c = new Color (color);
    int[] rgb = new int[] {c.getRed(), c.getGreen(), c.getBlue() };
    StringBuffer sb = new StringBuffer("#");
    for (int i=0; i < rgb.length; i++) {
        sb.append (Integer.toHexString(rgb[i]));
    }
    return sb.toString();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:HTMLTable.java

示例5: getColorForValue

import java.awt.Color; //导入方法依赖的package包/类
public static Color getColorForValue(double value, int alpha, boolean logarithmic, double minValue, double maxValue,
		Color minColor, Color maxColor) {
	if (Double.isNaN(value)) {
		return Color.LIGHT_GRAY;
	}

	// map value to [0,1]
	if (minValue == maxValue) {
		value = 0.5;
	} else if (logarithmic) {
		value = (Math.log(value) - Math.log(minValue)) / (Math.log(maxValue) - Math.log(minValue));
	} else {
		value = (value - minValue) / (maxValue - minValue);
	}

	Color MIN_LEGEND_COLOR = minColor;
	Color MAX_LEGEND_COLOR = maxColor;
	float[] minCol = Color.RGBtoHSB(MIN_LEGEND_COLOR.getRed(), MIN_LEGEND_COLOR.getGreen(), MIN_LEGEND_COLOR.getBlue(),
			null);
	float[] maxCol = Color.RGBtoHSB(MAX_LEGEND_COLOR.getRed(), MAX_LEGEND_COLOR.getGreen(), MAX_LEGEND_COLOR.getBlue(),
			null);
	double hColorDiff = maxCol[0] - minCol[0];
	double sColorDiff = maxCol[1] - minCol[1];
	double bColorDiff = maxCol[2] - minCol[2];

	Color color = new Color(Color.HSBtoRGB((float) (minCol[0] + hColorDiff * value), (float) (minCol[1] + value
			* sColorDiff), (float) (minCol[2] + value * bColorDiff)));

	if (alpha < 255) {
		color = DataStructureUtils.setColorAlpha(color, alpha);
	}
	return color;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:34,代码来源:ContinuousColorProvider.java

示例6: getMemoryColor

import java.awt.Color; //导入方法依赖的package包/类
private Color getMemoryColor(double value) {
	if (Double.isNaN(value)) {
		return MEMORY_COLOR;
	}
	float[] minCol = Color.RGBtoHSB(MEMORY_COLOR.getRed(), MEMORY_COLOR.getGreen(), MEMORY_COLOR.getBlue(), null);
	float[] maxCol = Color.RGBtoHSB(SwingTools.LIGHTEST_RED.getRed(), SwingTools.LIGHTEST_RED.getGreen(),
			SwingTools.LIGHTEST_RED.getBlue(), null);
	double hColorDiff = maxCol[0] - minCol[0];
	double sColorDiff = maxCol[1] - minCol[1];
	double bColorDiff = maxCol[2] - minCol[2];
	return new Color(Color.HSBtoRGB((float) (minCol[0] + hColorDiff * value), (float) (minCol[1] + value * sColorDiff),
			(float) (minCol[2] + value * bColorDiff)));
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:14,代码来源:SystemMonitor.java

示例7: randomPleasing

import java.awt.Color; //导入方法依赖的package包/类
public ColorBuilder randomPleasing(float offset) {
    if (offset <= 0) offset = RANDOM.nextFloat() + 0.1f * 10;
    double goldenRatioConj = (1.0 + Math.sqrt(5.0)) / 2.0;
    float hue = RANDOM.nextFloat();
    hue += goldenRatioConj * (offset / (5 * Math.random()));
    hue = hue % 1;
    Color der = new Color(Color.HSBtoRGB(hue, 0.5f, 0.95f));
    this.red = der.getRed();
    this.green = der.getGreen();
    this.blue = der.getBlue();
    this.alpha = 255;
    return this;
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:14,代码来源:ColorBuilder.java

示例8: getRGB

import java.awt.Color; //导入方法依赖的package包/类
public static Color getRGB(int h, int s, int b)
{
	int rgb = Color.HSBtoRGB((float)h/180f, (float)s/255f, (float)b/255f);
    int red = (rgb >> 16) & 0xFF;
    int green = (rgb >> 8) & 0xFF;
    int blue = rgb & 0xFF;
    		
    
	return new Color(red,green,blue);
}
 
开发者ID:fossasia,项目名称:zooracle,代码行数:11,代码来源:ColorUtils.java

示例9: motionColor

import java.awt.Color; //导入方法依赖的package包/类
protected float[] motionColor(float x, float y, float saturation, float brightness) {
        float angle01 = (float) (Math.atan2(y, x) / (2 * Math.PI) + 0.5);
        // atan2 returns -pi to +pi, so dividing by 2*pi gives -.5 to +.5. Adding .5 gives range 0 to 1.
//                    angle01=.5f; // debug
        int rgbValue = Color.HSBtoRGB(angle01, saturation, brightness);
        Color color = new Color(rgbValue);
        float[] rgb = color.getRGBComponents(null);
        return rgb;
    }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:10,代码来源:AbstractMotionFlowIMU.java

示例10: Pixel

import java.awt.Color; //导入方法依赖的package包/类
public Pixel(int bufferSize, float timestampUnitValue, float lowFrequencyBoundaryValue, float highFrequencyBoundaryValue) {
	this.lastTimestamp = 0;
	this.lastPatternPeriod = (float) 0.0;
	this.averageFrequency = (float) 0.0;
	this.measuredFrequencies = new ringBuffer(bufferSize);
	this.otherPolarityOccurred = false;

	this.pixelTimestampUnit = timestampUnitValue;
	this.frequencyLowBoundary = lowFrequencyBoundaryValue;
	this.frequencyHighBoundary = highFrequencyBoundaryValue;

	this.octavesRange = new rangeOfOctaves(this.frequencyLowBoundary, this.frequencyHighBoundary);
	this.octave = new Octave((int) Math.ceil(Math.log(Math.sqrt(this.frequencyLowBoundary*this.frequencyHighBoundary)/27.5))); // beware, for the moment it might be out of the octaveRange boundaries...
	this.presumedTone = this.octave.tones[9]; // "A" tone

	this.Correctness = (float) 1.0; // Do not use the evaluateCorrectness method because of the division by zero that it would imply...

	this.pixelRGB = new float[3];
	this.pixelHSB = new float[3];

	this.pixelHSB[0] = this.presumedTone.hue;
	this.pixelHSB[1] = this.presumedTone.saturation;
	this.pixelHSB[2] = this.presumedTone.brightness; // HSB values understandable by the ad-hoc Java routine
	this.LongIntRGB  = Color.HSBtoRGB(this.pixelHSB[0], this.pixelHSB[1], this.pixelHSB[2]);
	this.ColorObjectRGB = new Color(LongIntRGB);
	this.displayActive = false;

	// Initializing the color of the pixel to its brightest case
	this.pixelRGB[0] = (float) (this.ColorObjectRGB.getRed()/255.0);
	this.pixelRGB[1] = (float) (this.ColorObjectRGB.getGreen()/255.0);
	this.pixelRGB[2] = (float) (this.ColorObjectRGB.getBlue()/255.0);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:33,代码来源:InstrumentStringFilter.java

示例11: set_saturationCorrection

import java.awt.Color; //导入方法依赖的package包/类
void set_saturationCorrection(float value){
	// Setting the Saturation value.
	this.SaturationCorrection = value;
	// Updating the parameters related to the color of the pixel.
	this.pixelHSB[1] = this.SaturationCorrection;
	this.LongIntRGB  = Color.HSBtoRGB(this.pixelHSB[0], this.pixelHSB[1], this.pixelHSB[2]);
	this.ColorObjectRGB = new Color(LongIntRGB);
	this.pixelRGB[0] = (float) (this.ColorObjectRGB.getRed()/255.0);
	this.pixelRGB[1] = (float) (this.ColorObjectRGB.getGreen()/255.0);
	this.pixelRGB[2] = (float) (this.ColorObjectRGB.getBlue()/255.0);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:12,代码来源:InstrumentStringFilter.java

示例12: makeRandomColor

import java.awt.Color; //导入方法依赖的package包/类
protected int makeRandomColor() {
	double saturation = 0.2;
	double brightness = 0.2;
	float h = (float) Math.random();
	float s = (float) (saturation * Math.random() + 1 - saturation);
	float b = (float) (brightness * Math.random() + 1 - brightness);
	return Color.HSBtoRGB(h, s, b);
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:9,代码来源:RegionLabeling.java

示例13: getCodeBackgroundColor

import java.awt.Color; //导入方法依赖的package包/类
private String getCodeBackgroundColor() {
	Color tooltipBackground = UIManager.getColor("ToolTip.background");
	float[] hsb = new float[3];
	hsb = Color.RGBtoHSB(tooltipBackground.getRed(), tooltipBackground.getGreen(), tooltipBackground.getBlue(), hsb);
	hsb[2] = hsb[2] * 0.95f;
	Color codeBackground = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]));
	String hexColor = Integer.toHexString(codeBackground.getRGB() & 0xffffff);
	return hexColor;
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:10,代码来源:GraphManager.java

示例14: brightnessContrast

import java.awt.Color; //导入方法依赖的package包/类
public static Color brightnessContrast(Color c) {
    float[] hsb = new float[3];
    Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), hsb);
    return new Color(Color.HSBtoRGB(hsb[0], hsb[1], ((hsb[2] > .5f) ? 0.0f : 1.0f)));
}
 
开发者ID:iapafoto,项目名称:DicomViewer,代码行数:6,代码来源:ColorTools.java

示例15: apply

import java.awt.Color; //导入方法依赖的package包/类
@Override
public int apply(int color) {
	float[] hsb = Color.RGBtoHSB((color >> 16) & 255, (color >> 8) & 255, color & 255, null);
	
	int idx = mode.getIdx();
	
	hsb[idx] = level*value + (1-level)*hsb[idx];
	
	return Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]);
}
 
开发者ID:CalebKussmaul,项目名称:GIFKR,代码行数:11,代码来源:HSBFilter.java


注:本文中的java.awt.Color.HSBtoRGB方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。