本文整理汇总了Java中java.awt.Color.getColorComponents方法的典型用法代码示例。如果您正苦于以下问题:Java Color.getColorComponents方法的具体用法?Java Color.getColorComponents怎么用?Java Color.getColorComponents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Color
的用法示例。
在下文中一共展示了Color.getColorComponents方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawPoly
import java.awt.Color; //导入方法依赖的package包/类
/**
*
* @param gl
* @param cs
* @param width
* @param height
* @param x
* @param y
*/
public static void drawPoly(OpenGLContext context,Coordinate[] cs,float width,float height,int x,int y,float rwidth,Color color){
GL2 gl = context.getGL().getGL2();
float[] c = color.getColorComponents(null);
gl.glColor3f(c[0], c[1], c[2]);
gl.glLineWidth(rwidth);
gl.glBegin(GL.GL_LINE_STRIP);
// System.out.println("----------------------------------");
for (int p = 0; p < cs.length; p++) {
double vx=(cs[p].x - x) / width;
double vy=1 - (cs[p].y - y) / height;
// System.out.println(vx+" "+vy+",");
gl.glVertex2d(vx,vy);
}
// System.out.println("----------------------------------");
//close polygon
Coordinate point = cs[0];
gl.glVertex2d((point.x - x) / width, 1 - (point.y - y) / height);
gl.glEnd();
gl.glFlush();
}
示例2: drawHistogram
import java.awt.Color; //导入方法依赖的package包/类
public static void drawHistogram(GL2 gl, float[] activations, int width, int height, float lineWidth, Color color) {
if (activations == null) {
return;
}
float[] ca = color.getColorComponents(null);
gl.glPushAttrib(GL2ES3.GL_COLOR | GL.GL_LINE_WIDTH);
gl.glLineWidth(lineWidth);
gl.glColor4fv(ca, 0);
float dx = (float) (width) / (activations.length);
float sy = (float) HISTOGRAM_HEIGHT_FRACTION * (height);
gl.glBegin(GL.GL_LINE_STRIP);
for (int i = 0; i < activations.length; i++) {
float y = 1 + (sy * activations[i]); // TODO debug hack
float x1 = 1 + (dx * i), x2 = x1 + dx;
gl.glVertex2f(x1, 1);
gl.glVertex2f(x1, y);
gl.glVertex2f(x2, y);
gl.glVertex2f(x2, 1);
}
gl.glEnd();
gl.glPopAttrib();
}
示例3: annotateHistogram
import java.awt.Color; //导入方法依赖的package包/类
public void annotateHistogram(GL2 gl, int width, int height, float lineWidth, Color color) {
gl.glPushAttrib(GL2ES3.GL_COLOR | GL.GL_LINE_WIDTH);
gl.glLineWidth(lineWidth);
float[] ca = color.getColorComponents(null);
gl.glColor4fv(ca, 0);
OutputOrInnerProductFullyConnectedLayer.this.annotateHistogram(gl, width, height);
gl.glPopAttrib();
}