本文整理汇总了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);
}
示例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() });
}
示例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);
}
示例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;
}
示例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));
}
示例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);
}
示例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();
}
示例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;
}
示例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
};
}
示例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];
*/
}
示例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));
}
示例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;
}
示例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++;
}
示例14: getCellEditorValue
import java.awt.Color; //导入方法依赖的package包/类
@Override
public Object getCellEditorValue() {
Color color = ((ColorIcon) button.getIcon()).getColor();
return color.getRed() + "," + color.getGreen() + "," + color.getBlue();
}
示例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));
}