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


Java Color.getHSBColor方法代码示例

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


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

示例1: Cluster

import java.awt.Color; //导入方法依赖的package包/类
/**
 * Constructs a default cluster.
 */
public Cluster() {
	setRadius(defaultClusterRadius);
	float hue = random.nextFloat();
	Color c = Color.getHSBColor(hue, 1f, 1f);
	setColor(c);
	setClusterNumber(++clusterCounter);
	setAspectRatio(RectangularClusterTracker.this.getAspectRatio());
	vxFilter.setTauMs(velocityTauMs);
	vyFilter.setTauMs(velocityTauMs);
	if (initializeVelocityToAverage) {
		velocityPPT.x = averageVelocityPPT.x;
		velocityPPT.y = averageVelocityPPT.y;
		velocityValid = true;
	}
	setAngle(initialAngle);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:20,代码来源:RectangularClusterTracker.java

示例2: reduceColorBrightness

import java.awt.Color; //导入方法依赖的package包/类
/**
 * Returns the original color, just slightly less bright.
 *
 * @param color
 * @return
 */
public static Color reduceColorBrightness(Color color) {
	// lower brightness to 85% and saturation to 85%
	int r, g, b;
	float[] hsb = new float[3];
	r = color.getRed();
	g = color.getGreen();
	b = color.getBlue();
	Color.RGBtoHSB(r, g, b, hsb);
	// brightness
	hsb[2] *= 0.80f;
	// saturation
	hsb[1] *= 0.85f;
	return Color.getHSBColor(hsb[0], hsb[1], hsb[2]);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:21,代码来源:ColorProvider.java

示例3: getRandomHexColor

import java.awt.Color; //导入方法依赖的package包/类
public static String getRandomHexColor() {
    float hue = random.nextFloat();
    // sat between 0.1 and 0.3
    float saturation = (random.nextInt(2000) + 1000) / 10000f;
    float luminance = 0.9f;
    Color color = Color.getHSBColor(hue, saturation, luminance);
    return '#' + Integer.toHexString(
            (color.getRGB() & 0xffffff) | 0x1000000).substring(1);
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:10,代码来源:SnakeAnnotation.java

示例4: spectrum

import java.awt.Color; //导入方法依赖的package包/类
/**
 * ImageJ's 'spectrum' LUT, as originally defined in class {@link ij.plugin.LutLoader}.
 * @return A new instance of type {@link ij.process.LUT}.
 */
public static LUT spectrum() {
	byte[] r = new byte[256];
	byte[] g = new byte[256];
	byte[] b = new byte[256];
	for (int i = 0; i < r.length; i++) {
		Color c = Color.getHSBColor(i/255f, 1.0f, 1.0f);
		r[i] = (byte) c.getRed();
		g[i] = (byte) c.getGreen();
		b[i] = (byte) c.getBlue();
	}
	return new LUT(r, g, b);
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:17,代码来源:LookupTables.java

示例5: initDeck

import java.awt.Color; //导入方法依赖的package包/类
private static void initDeck() {
   double x = DECK_X;
   double y = DECK_Y;
   deck = new ArrayList<PPCard>();
   for (int i = 0; i < 52; i++) {
      Color color = Color.getHSBColor((float) 0.87 * i / 52,
                                      (float) 1.0, (float) 1.0);
      if (i == 51) color = Color.WHITE;
      PPCard card = new PPCard(x, y);
      card.setColor(color);
      slide.add(card);
      deck.add(card);
      y += CARD_HEIGHT + DECK_SEP;
   }
}
 
开发者ID:eric-roberts,项目名称:JavaPPTX,代码行数:16,代码来源:PPShufflingSlide.java

示例6: RandomColorPanel

import java.awt.Color; //导入方法依赖的package包/类
public RandomColorPanel(Dimension dims, String name)
{			
	final float saturation = (random.nextInt(2000) + 3000) / 10000f;
	final float luminance = 0.9f;
	final float hue = random.nextFloat();
	final Color color = Color.getHSBColor(hue, saturation, luminance);
	
	this.name = name;
	this.setBackground(color);
	this.setPreferredSize(dims); 
}
 
开发者ID:jpxor,项目名称:slick,代码行数:12,代码来源:Test_SlickLayout.java

示例7: Cluster

import java.awt.Color; //导入方法依赖的package包/类
/**
 * Constructs a default cluster.
 *
 */
public Cluster (){
	float hue = random.nextFloat();
	Color c = Color.getHSBColor(hue,1f,1f);
	setColor(c);
	setClusterNumber(clusterCounter++);
	maxRadius = 0;
	clusterArea.setBounds(0, 0, 0, 0);
	dead = false;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:14,代码来源:BlurringTunnelTracker.java

示例8: update

import java.awt.Color; //导入方法依赖的package包/类
public void update() {
	handleInput();
	color = Color.getHSBColor(hue, 1f, 1f);
	hue += 0.01;
	if(hue > 1) hue = 0;
	angle += 0.1;
}
 
开发者ID:tonikolaba,项目名称:BatBat-Game,代码行数:8,代码来源:AcidState.java

示例9: Cluster

import java.awt.Color; //导入方法依赖的package包/类
/** Constructs a default cluster. */
public Cluster() {
	setRadius(defaultClusterRadius);
	float hue = random.nextFloat();
	Color c = Color.getHSBColor(hue, 1f, 1f);
	setColor(c);
	setClusterNumber(clusterCounter++);
	setAspectRatio(EinsteinClusterTracker.this.getAspectRatio());
	//            vxFilter.setTauMs(velocityTauMs);
	//            vyFilter.setTauMs(velocityTauMs);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:12,代码来源:EinsteinClusterTracker.java

示例10: setRGB

import java.awt.Color; //导入方法依赖的package包/类
@Override
public void setRGB(int idx){
    float value = freme.get(idx);
    int nIdx = 3*idx;
    value += (float)Math.PI/2;
    value = value/(float)Math.PI;
    Color color = Color.getHSBColor(value, 1.0f, 1.0f);
    rgbValues[nIdx++] = (float)color.getRed()/255.0f;
    rgbValues[nIdx++] = (float)color.getGreen()/255.0f;
    rgbValues[nIdx] = (float)color.getBlue()/255.0f;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:12,代码来源:OrientationFreme.java

示例11: deriveColor

import java.awt.Color; //导入方法依赖的package包/类
/** Derives color from specified with saturation multiplied by given ratio.
 */
static Color deriveColor (Color c, float saturationR) {
    Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), hsbVals);
    hsbVals[1] = Math.min(1.0f, hsbVals[1] * saturationR);
    return Color.getHSBColor(hsbVals[0], hsbVals[1], hsbVals[2]);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:EdgeWidget.java

示例12: makeTypeColors

import java.awt.Color; //导入方法依赖的package包/类
/**
 * Creates colors for each cell type (e.g. orientation) so that they are
 * spread over hue space in a manner to attempt to be maximally different in
 * hue.
 * <p>
 * Subclasses can override this method to customize the colors drawn but the
 * subclasses should check if the color have been created since
 * checkTypeColors is called on every rendering cycle. This method should
 * first check if typeColorRGBComponents already exists and has the correct
 * number of elements. If not, allocate and populate typeColorRGBComponents
 * so that type t corresponds to typeColorRGBComponents[t][0] for red,
 * typeColorRGBComponents[t][1] for green, and typeColorRGBComponents[t][3]
 * for blue. It should also populate the Color[] typeColors.
 *
 * @param numCellTypes
 *            the number of colors to generate
 * @return the float[][] of colors, each row of which is an RGB color
 *         triplet in float 0-1 range for a particular cell type
 * @see #typeColors
 * @see #typeColorRGBComponents
 */
public float[][] makeTypeColors(int numCellTypes) {
	float[][] colors = typeColorsMap.get(numCellTypes);
	if (colors == null) {
		colors = new float[numCellTypes][3];
		setTypeColors(new Color[numCellTypes]);
		for (int i = 0; i < numCellTypes; i++) {
			int hueIndex = (int) Math.floor(((float) i / numCellTypes) * HUES.length);
			float hue = HUES[hueIndex] / 255f;
			Color c = Color.getHSBColor(hue, 1, 1);
			colors[i][0] = (float) c.getRed() / 255;
			colors[i][1] = (float) c.getGreen() / 255;
			colors[i][2] = (float) c.getBlue() / 255;
		}
		typeColorsMap.put(numCellTypes, colors);
		return colors;
	}
	return typeColorsMap.get(numCellTypes);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:40,代码来源:AEChipRenderer.java

示例13: fill

import java.awt.Color; //导入方法依赖的package包/类
private static void fill(int n, Graphics2D g, int cellSize, int x, int y, long i) {
    Color color = Color.getHSBColor(((float) i) / n / n, 0.5f, 1.0f);
    g.setColor(color);
    g.fillRect(x - cellSize / 2, y - cellSize / 2, cellSize + 1, cellSize + 1);
}
 
开发者ID:davidmoten,项目名称:hilbert-curve,代码行数:6,代码来源:HilbertCurveRenderer.java

示例14: getHighlight

import java.awt.Color; //导入方法依赖的package包/类
public static Color getHighlight(Color color)
{
    float hsbVals[] = Color.RGBtoHSB(color.getRed(),color.getGreen(),color.getBlue(), null);
    return Color.getHSBColor( hsbVals[0], hsbVals[1], 0.5f * ( 1f + hsbVals[2] ));
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:6,代码来源:ColorUtils.java

示例15: getShadow

import java.awt.Color; //导入方法依赖的package包/类
public static Color getShadow(Color color)
{
    float hsbVals[] = Color.RGBtoHSB(color.getRed(),color.getGreen(),color.getBlue(), null);
    return Color.getHSBColor( hsbVals[0], hsbVals[1], 0.5f * hsbVals[2] );
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:6,代码来源:ColorUtils.java


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