當前位置: 首頁>>代碼示例>>Java>>正文


Java Color.getRGBColorComponents方法代碼示例

本文整理匯總了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;
	//        }
	////        }
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:23,代碼來源:KalmanFilter.java

示例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;

    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:24,代碼來源:PSPrinterJob.java

示例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);
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:15,代碼來源:BlurringTunnelTracker.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:14,代碼來源:ReadAsGrayTest.java

示例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]);
}
 
開發者ID:dev-cuttlefish,項目名稱:cuttlefish,代碼行數:8,代碼來源:Edge.java

示例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));
        }
    }
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:15,代碼來源:WPrinterJob.java

示例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));
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:10,代碼來源:WPrinterJob.java

示例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));
    }
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:10,代碼來源:WPrinterJob.java

示例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)));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:28,代碼來源:WPrinterJob.java

示例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]);
}
 
開發者ID:dev-cuttlefish,項目名稱:cuttlefish,代碼行數:8,代碼來源:Vertex.java

示例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]);
}
 
開發者ID:dev-cuttlefish,項目名稱:cuttlefish,代碼行數:8,代碼來源:Vertex.java

示例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));
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:18,代碼來源:WPrinterJob.java


注:本文中的java.awt.Color.getRGBColorComponents方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。