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


Java Color.getBlue方法代码示例

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


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

示例1: createColoredRectangleIcon

import java.awt.Color; //导入方法依赖的package包/类
protected Icon createColoredRectangleIcon(Color color) {
	// create buffered image for colored icon
	BufferedImage bufferedImage = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
	Graphics2D g2 = bufferedImage.createGraphics();
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // Anti-alias!
			RenderingHints.VALUE_ANTIALIAS_ON);

	if (color != null) {
		// fill image with item color
		Color newColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
		g2.setColor(newColor);
	} else {
		g2.setColor(Color.gray);
	}
	g2.fillRect(0, 0, 10, 10);

	return new ImageIcon(bufferedImage);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:19,代码来源:ColorRGBComboBoxCellRenderer.java

示例2: instantiate

import java.awt.Color; //导入方法依赖的package包/类
@Override
protected Expression instantiate(Object oldInstance, Encoder enc) {
    Color color = (Color) oldInstance;
    return new Expression(oldInstance, oldInstance.getClass(),
            BeansUtils.NEW, new Object[] { color.getRed(),
                    color.getGreen(), color.getBlue(), color.getAlpha() });
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:8,代码来源:AwtColorPersistenceDelegate.java

示例3: deriveARGB

import java.awt.Color; //导入方法依赖的package包/类
/**
 * Derives the ARGB value for a color based on an offset between two
 * other colors.
 *
 * @param color1   The first color
 * @param color2   The second color
 * @param midPoint The offset between color 1 and color 2, a value of 0.0 is
 *                 color 1 and 1.0 is color 2;
 * @return the ARGB value for a new color based on this derivation
 */
static int deriveARGB(Color color1, Color color2, float midPoint) {
    int r = color1.getRed() +
            Math.round((color2.getRed() - color1.getRed()) * midPoint);
    int g = color1.getGreen() +
            Math.round((color2.getGreen() - color1.getGreen()) * midPoint);
    int b = color1.getBlue() +
            Math.round((color2.getBlue() - color1.getBlue()) * midPoint);
    int a = color1.getAlpha() +
            Math.round((color2.getAlpha() - color1.getAlpha()) * midPoint);
    return ((a & 0xFF) << 24) |
            ((r & 0xFF) << 16) |
            ((g & 0xFF) << 8) |
            (b & 0xFF);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:NimbusLookAndFeel.java

示例4: getColors

import java.awt.Color; //导入方法依赖的package包/类
private List <Color> getColors (Color background)
{
  List <Color> o = backgroundColors.get (background);
  
  if (o != null) {
    return o;
  }
  
  List <Color> colors = new ArrayList <Color> (steps + 1);
  colors.add (background);
  
  int rDelta = (background.getRed () - fadeColor.getRed ()) / steps;
  int gDelta = (background.getGreen () - fadeColor.getGreen ()) / steps;
  int bDelta = (background.getBlue () - fadeColor.getBlue ()) / steps;
  int aDelta = (background.getAlpha () - fadeColor.getAlpha ()) / steps;
  
  for (int i = 1; i < steps; i++) {
    int rValue = background.getRed () - (i * rDelta);
    int gValue = background.getGreen () - (i * gDelta);
    int bValue = background.getBlue () - (i * bDelta);
    int aValue = background.getAlpha () - (i * aDelta);
    
    colors.add (new Color (rValue, gValue, bValue, aValue));
  }
  
  colors.add (fadeColor);
  backgroundColors.put (background, colors);
  
  return colors;
}
 
开发者ID:Plasmoxy,项目名称:AquamarineLake,代码行数:31,代码来源:MaterialUIMovement.java

示例5: brighter

import java.awt.Color; //导入方法依赖的package包/类
private static Color brighter(Color c) {
    int r = c.getRed();
    int g = c.getGreen();
    int b = c.getBlue();

    int i = (int)(1.0/(1.0-FACTOR));
    if ( r > 0 && r < i ) r = i;
    if ( g > 0 && g < i ) g = i;
    if ( b > 0 && b < i ) b = i;

    return new Color(Math.min((int)(r/FACTOR), 255),
                     Math.min((int)(g/FACTOR), 255),
                     Math.min((int)(b/FACTOR), 255));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:BarRenderer.java

示例6: hexString

import java.awt.Color; //导入方法依赖的package包/类
/**
 * 
 */
public static String hexString(Color color)
{
	int r = color.getRed();
	int g = color.getGreen();
	int b = color.getBlue();

	return String.format("#%02X%02X%02X", r, g, b);
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:12,代码来源:mxHtmlColor.java

示例7: toString

import java.awt.Color; //导入方法依赖的package包/类
/**
 * Returns a string representation of this <code>Color</code>. This method
 * is intended to be used only for debugging purposes. The content and
 * format of the returned string might vary between implementations. The
 * returned string might be empty but cannot be <code>null</code>.
 *
 * @return a String representation of this <code>Color</code>.
 */
@Override
public String toString() {
    Color src = UIManager.getColor(uiDefaultParentName);
    String s = "DerivedColor(color=" + getRed() + "," + getGreen() + "," + getBlue() +
            " parent=" + uiDefaultParentName +
            " offsets=" + getHueOffset() + "," + getSaturationOffset() + ","
            + getBrightnessOffset() + "," + getAlphaOffset();
    return src == null ? s : s + " pColor=" + src.getRed() + "," + src.getGreen() + "," + src.getBlue();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:DerivedColor.java

示例8: getDetailsString

import java.awt.Color; //导入方法依赖的package包/类
public String getDetailsString(String className, Instance instance, Heap heap) {
    if (FONT_MASK.equals(className)) {                                      // Font+
        String name = Utils.getFontName(instance, heap);
        if (name == null) name = "Default";                                 // NOI18N
        int size = DetailsUtils.getIntFieldValue(instance, "size", 10);     // NOI18N // TODO: should use default font size
        name += ", " + size + "pt";                                         // NOI18N
        int style = DetailsUtils.getIntFieldValue(instance, "style", 0);    // NOI18N
        if ((style & 1) != 0) name += ", bold";                             // NOI18N
        if ((style & 2) != 0) name += ", italic";                           // NOI18N
        return name;
    } else if (COLOR_MASK.equals(className)) {                              // Color+
        Color color = new ColorBuilder(instance, heap).createInstance();
        return color.getRed() + ", " + color.getGreen() +                   // NOI18N
               ", " + color.getBlue() + ", " + color.getAlpha();            // NOI18N
    } else if (POINT_MASK.equals(className)) {                              // Point+
        Point point = new PointBuilder(instance, heap).createInstance();
        return point.x + ", " + point.y;                                    // NOI18N
    } else if (DIMENSION_MASK.equals(className)) {                          // Dimension+
        Dimension dimension = new DimensionBuilder(instance, heap).createInstance();
        return dimension.width + ", " + dimension.height;                   // NOI18N
    } else if (RECTANGLE_MASK.equals(className)) {                          // Rectangle+
        Rectangle rectangle = new RectangleBuilder(instance, heap).createInstance();
        return rectangle.x + ", " + rectangle.y +                           // NOI18N
               ", " + rectangle.width + ", " + rectangle.height;            // NOI18N
    } else if (INSETS_MASK.equals(className)) {                             // Insets+
        Insets insets = new InsetsBuilder(instance, heap).createInstance();
        return insets.top + ", " + insets.left +                            // NOI18N
               ", " + insets.bottom + ", " + insets.right;                  // NOI18N
    } else if (TEXTATTRIBUTE_MASK.equals(className) ||                      // AttributedCharacterIterator$Attribute+
               CURSOR_MASK.equals(className)) {                             // Cursor+
        return DetailsUtils.getInstanceFieldString(
                instance, "name", heap);                                    // NOI18N
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:AwtDetailsProvider.java

示例9: setRGBA

import java.awt.Color; //导入方法依赖的package包/类
/**
 * @param color
 */
public void setRGBA(Color color) {
    this.rgba = new float[]{
        color.getRed() / 255f,
        color.getGreen() / 255f,
        color.getBlue() / 255f,
        color.getAlpha() / 255f
    };
}
 
开发者ID:tacocat,项目名称:lambda,代码行数:12,代码来源:Vertex.java

示例10: SuperColor

import java.awt.Color; //导入方法依赖的package包/类
SuperColor (Color color) {
    super (color.getRed (), color.getGreen (), color.getBlue ());
    this.color = color;
    
    //jkozak: When user sets color by RGB values, maybe we shouldn't
    //        change the color to AWT-Palette constant.
    /*
    int i = getIndex (ColorEditor.awtColors, color);
    if (i < 0) return;
    id = getAWTColorNames()[i];
     */
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ColorEditor.java

示例11: setColor

import java.awt.Color; //导入方法依赖的package包/类
public void setColor(Color color) {
    this.color = new Color(
            color.getRed(),
            color.getGreen(),
            color.getBlue(),
            (int) (this.opacity * 255));
}
 
开发者ID:mcdcorp,项目名称:opentest,代码行数:8,代码来源:Highlighter.java

示例12: OverlayPixelsImageEffect

import java.awt.Color; //导入方法依赖的package包/类
public OverlayPixelsImageEffect(final int ttl, final Color color) {
  super(ttl, "OverlayPixels" + color.getRed() + "" + color.getGreen() + "" + color.getBlue());
  this.color = color;
}
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:5,代码来源:OverlayPixelsImageEffect.java

示例13: onRun

import java.awt.Color; //导入方法依赖的package包/类
@Override
public void onRun() {
    if (image == null) {
        cancel();
        return;
    }
    Location location = getLocation();
    location.add(0, 2, 0);
    if (!lockedYaw) {
        yaw = location.getYaw();
        lockedYaw = true;
    }

    for (int y = 0; y < image.getHeight(); y++) {
        for (int x = 0; x < image.getWidth(); x++) {
            int rgb = image.getRGB(x, y);
            Color clr = (new Color(rgb));
            boolean prio = false;
            for (Color c : priority) {
                if (c.getRed() == clr.getRed() && c.getGreen() == clr.getGreen() && c.getBlue() == clr.getBlue()) {
                    prio = true;
                    break;
                }
            }
            if (!prio & Math.random() > density)
                continue;
            Vector v = new Vector((float) image.getWidth() / 2 - x, (float) image.getHeight() / 2 - y, 0).multiply(size);
            VectorUtils.rotateAroundAxisY(v, -yaw * MathUtils.degreesToRadians);
            if (enableRotation) {
                double rotX = 0;
                double rotY = 0;
                double rotZ = 0;
                switch (plane) {
                    case X:
                        rotX = angularVelocityX * currRotationStep;
                        break;
                    case Y:
                        rotY = angularVelocityY * currRotationStep;
                        break;
                    case Z:
                        rotZ = angularVelocityZ * currRotationStep;
                        break;
                    case XY:
                        rotX = angularVelocityX * currRotationStep;
                        rotY = angularVelocityY * currRotationStep;
                        break;
                    case XZ:
                        rotX = angularVelocityX * currRotationStep;
                        rotZ = angularVelocityZ * currRotationStep;
                        break;
                    case XYZ:
                        rotX = angularVelocityX * currRotationStep;
                        rotY = angularVelocityY * currRotationStep;
                        rotZ = angularVelocityZ * currRotationStep;
                        break;
                    case YZ:
                        rotY = angularVelocityY * currRotationStep;
                        rotZ = angularVelocityZ * currStep;
                        break;
                }
                VectorUtils.rotateVector(v, rotX, rotY, rotZ);
            }
            int r = clr.getRed();
            int g = clr.getGreen();
            int b = clr.getBlue();
            location.add(v);
            if (!(r == 123 && g == 123 && b == 123)) {
                display(particle, location, org.bukkit.Color.fromRGB(r, g, b));
            }
            location.subtract(v);
        }
    }
    currRotationStep++;
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:75,代码来源:ColoredImageEffect.java

示例14: getCellEditorValue

import java.awt.Color; //导入方法依赖的package包/类
@Override
public Object getCellEditorValue() {
	Color color = ((ColorIcon) button.getIcon()).getColor();
	return color.getRed() + "," + color.getGreen() + "," + color.getBlue();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:6,代码来源:ColorValueCellEditor.java

示例15: fade

import java.awt.Color; //导入方法依赖的package包/类
public static Color fade(Color a,Color b,double dist) { // dist=0 => a, dist=1 => b 
	return new Color(
			(int)(a.getRed() + (b.getRed() - a.getRed()) * dist),
			(int)(a.getGreen() + (b.getGreen() - a.getGreen()) * dist),
			(int)(a.getBlue() + (b.getBlue() - a.getBlue()) * dist));
}
 
开发者ID:vanyle,项目名称:Explorium,代码行数:7,代码来源:TextureGenerator.java


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