本文整理汇总了Java中java.awt.Color.getRGBColorComponents方法的典型用法代码示例。如果您正苦于以下问题:Java Color.getRGBColorComponents方法的具体用法?Java Color.getRGBColorComponents怎么用?Java Color.getRGBColorComponents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Color
的用法示例。
在下文中一共展示了Color.getRGBColorComponents方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: colorPixel
import java.awt.Color; //导入方法依赖的package包/类
/** @param x x location of pixel
*@param y y location
*@param fr the frame data
*@param channel the RGB channel number 0-2
*@param brightness the brightness 0-1
*/
final void colorPixel(final int x, final int y, final float[][][] fr, Color color){
if((y<0) || (y>(fr.length-1)) || (x<0) || (x>(fr[0].length-1))) {
return;
}
float[] rgb=color.getRGBColorComponents(null);
float[] f=fr[y][x];
for(int i=0;i<3;i++){
f[i]=rgb[i];
}
// fr[y][x][channel]=brightness;
//// if(brightness<1){
// for(int i=0;i<3;i++){
// if(i!=channel) fr[y][x][i]=0;
// }
//// }
}
示例2: emitPSColor
import java.awt.Color; //导入方法依赖的package包/类
void emitPSColor(Color color) {
if (color != null && color.equals(mColor) == false) {
float[] rgb = color.getRGBColorComponents(null);
/* If the color is a gray value then use
* setgray.
*/
if (rgb[0] == rgb[1] && rgb[1] == rgb[2]) {
mPSStream.println(rgb[0] + SETGRAY_STR);
/* It's not gray so use setrgbcolor.
*/
} else {
mPSStream.println(rgb[0] + " "
+ rgb[1] + " "
+ rgb[2] + " "
+ SETRGBCOLOR_STR);
}
mColor = color;
}
}
示例3: colorPixel
import java.awt.Color; //导入方法依赖的package包/类
/** @param x x location of pixel
*@param y y location
*@param fr the frame data
*@param channel the RGB channel number 0-2
*@param brightness the brightness 0-1
*/
private void colorPixel (final int x,final int y,final float[][][] fr,int channel,Color color){
if ( (y < 0) || (y > (fr.length - 1)) || (x < 0) || (x > (fr[0].length - 1)) ){
return;
}
float[] rgb = color.getRGBColorComponents(null);
float[] f = fr[y][x];
System.arraycopy(rgb, 0, f, 0, 3);
}
示例4: compareWithTolerance
import java.awt.Color; //导入方法依赖的package包/类
private static boolean compareWithTolerance(Color a, Color b, float delta) {
float[] a_rgb = new float[3];
a_rgb = a.getRGBColorComponents(a_rgb);
float[] b_rgb = new float[3];
b_rgb = b.getRGBColorComponents(b_rgb);
for (int i = 0; i < 3; i++) {
if (Math.abs(a_rgb[i] - b_rgb[i]) > delta) {
return false;
}
}
return true;
}
示例5: setColor
import java.awt.Color; //导入方法依赖的package包/类
public static void setColor(org.gephi.graph.api.Edge edge, Color color) {
float[] rgb = color.getRGBColorComponents(null);
edge.getEdgeData().setR(rgb[0]);
edge.getEdgeData().setG(rgb[1]);
edge.getEdgeData().setB(rgb[2]);
}
示例6: selectSolidBrush
import java.awt.Color; //导入方法依赖的package包/类
protected void selectSolidBrush(Color color) {
/* We only need to select a brush if the color has changed.
*/
if (color.equals(mLastColor) == false) {
mLastColor = color;
float[] rgb = color.getRGBColorComponents(null);
selectSolidBrush(getPrintDC(),
(int) (rgb[0] * MAX_WCOLOR),
(int) (rgb[1] * MAX_WCOLOR),
(int) (rgb[2] * MAX_WCOLOR));
}
}
示例7: fillRect
import java.awt.Color; //导入方法依赖的package包/类
protected void fillRect(float x, float y, float width, float height,
Color color) {
float[] rgb = color.getRGBColorComponents(null);
fillRect(getPrintDC(), x, y, width, height,
(int) (rgb[0] * MAX_WCOLOR),
(int) (rgb[1] * MAX_WCOLOR),
(int) (rgb[2] * MAX_WCOLOR));
}
示例8: selectPen
import java.awt.Color; //导入方法依赖的package包/类
protected void selectPen(float width, Color color) {
float[] rgb = color.getRGBColorComponents(null);
selectPen(getPrintDC(), width,
(int) (rgb[0] * MAX_WCOLOR),
(int) (rgb[1] * MAX_WCOLOR),
(int) (rgb[2] * MAX_WCOLOR));
}
示例9: selectStylePen
import java.awt.Color; //导入方法依赖的package包/类
protected boolean selectStylePen(int cap, int join, float width,
Color color) {
long endCap;
long lineJoin;
float[] rgb = color.getRGBColorComponents(null);
switch(cap) {
case BasicStroke.CAP_BUTT: endCap = PS_ENDCAP_FLAT; break;
case BasicStroke.CAP_ROUND: endCap = PS_ENDCAP_ROUND; break;
default:
case BasicStroke.CAP_SQUARE: endCap = PS_ENDCAP_SQUARE; break;
}
switch(join) {
case BasicStroke.JOIN_BEVEL:lineJoin = PS_JOIN_BEVEL; break;
default:
case BasicStroke.JOIN_MITER:lineJoin = PS_JOIN_MITER; break;
case BasicStroke.JOIN_ROUND:lineJoin = PS_JOIN_ROUND; break;
}
return (selectStylePen(getPrintDC(), endCap, lineJoin, width,
(int) (rgb[0] * MAX_WCOLOR),
(int) (rgb[1] * MAX_WCOLOR),
(int) (rgb[2] * MAX_WCOLOR)));
}
示例10: setBorderColor
import java.awt.Color; //导入方法依赖的package包/类
public static void setBorderColor(Node node, Color borderColor) {
float[] comp = borderColor.getRGBColorComponents(null);
node.getAttributes().setValue(ATTR_BORDER_R, comp[0]);
node.getAttributes().setValue(ATTR_BORDER_G, comp[1]);
node.getAttributes().setValue(ATTR_BORDER_B, comp[2]);
}
示例11: setFillColor
import java.awt.Color; //导入方法依赖的package包/类
public static void setFillColor(Node node, Color fillColor) {
float[] comp = fillColor.getRGBColorComponents(null);
node.getNodeData().setR(comp[0]);
node.getNodeData().setG(comp[1]);
node.getNodeData().setB(comp[2]);
}
示例12: setTextColor
import java.awt.Color; //导入方法依赖的package包/类
/**
* Set the GDI color for text drawing.
*/
protected void setTextColor(Color color) {
/* We only need to select a brush if the color has changed.
*/
if (color.equals(mLastTextColor) == false) {
mLastTextColor = color;
float[] rgb = color.getRGBColorComponents(null);
setTextColor(getPrintDC(),
(int) (rgb[0] * MAX_WCOLOR),
(int) (rgb[1] * MAX_WCOLOR),
(int) (rgb[2] * MAX_WCOLOR));
}
}