LabColor(Color color) { Assert.notNull(color, "Color must not be null"); float[] lab = fromXyz(color.getColorComponents(XYZ_COLOR_SPACE, null)); this.l = lab[0]; this.a = lab[1]; this.b = lab[2]; }
float rgb2[] = new float[3]; color1.getColorComponents(rgb1); color2.getColorComponents(rgb2);
CIELab() { super(ColorSpace.TYPE_Lab, 3); float[] ref = Color.white.getColorComponents(CIEXYZ, null); xn = ref[0]; yn = ref[1]; zn = ref[2]; }
@Override public float[] getColorComponents(float[] compArray) { final Color c = getColor(); return c == this ? super.getColorComponents(compArray) : c.getColorComponents(compArray); }
@Override public float[] getColorComponents(ColorSpace cspace, float[] compArray) { final Color c = getColor(); return c == this ? super.getColorComponents(cspace, compArray) : c.getColorComponents(cspace, compArray); }
public void setFillColor(Color fillColor) { this.fillColor = fillColor; float[] compArray = new float[3]; this.fillColor.getColorComponents(compArray); java.util.List<Float> colorValues = new ArrayList<Float>(compArray.length); for (float comp : compArray) { colorValues.add(comp); } entries.put(IC_KEY, colorValues); }
static final Color colorTowards (Color base, Color target, float steps, float step) { base.getColorComponents(comps); target.getColorComponents(targs); comps[3] = 1.0f; //No transparency, performance problems float factor = (step / steps); for (int i=0; i < 3; i++) { comps[i] = saturate(comps[i] - (factor * (comps[i] - targs[i]))); } // comps[3] = 1f - (step / steps); Color result = new Color (comps[0], comps[1], comps[2], comps[3]); return result; }
public void setFillColor(Color fillColor) { this.fillColor = fillColor; float[] compArray = new float[3]; this.fillColor.getColorComponents(compArray); java.util.List<Float> colorValues = new ArrayList<Float>(compArray.length); for (float comp : compArray) { colorValues.add(comp); } entries.put(IC_KEY, colorValues); }
public void setInteriorColor(Color interiorColor) { this.interiorColor = interiorColor; float[] compArray = new float[3]; this.interiorColor.getColorComponents(compArray); List<Float> colorValues = new ArrayList<Float>(compArray.length); for (float comp : compArray) { colorValues.add(comp); } entries.put(IC_KEY, colorValues); }
/** * java.awt.Color. Forward the call to the delegate. */ public float[] getColorComponents(float[] compArray) { return getColor().getColorComponents(compArray); }
/** * Sets the Color of this Colorpicker * @param c */ public void setColor(Color c) { for (int i = 0; i < 3; i++) { float w = c.getColorComponents(new float[3])[i]; int x = Math.round(w * 255f / 1f); _sliderarray[i].setValue(x); } _sliderarray[3].setValue(c.getAlpha()); this.revalidate(); }
private Color getDarker(Color color) { float pr = (float) .90; float[] comps = color.getColorComponents(null); for (int i = 0; i < comps.length; i++) { comps[i] = (comps[i]*pr); } return new Color(comps[0],comps[1],comps[2]); }
/** * Creates a new named color. * @param name the color name * @param color the color to use when the named color's specific color properties are not * available. */ public NamedColorSpace(String name, Color color) { this(name, color.getColorSpace().toCIEXYZ(color.getColorComponents(null)), null, null); }
/** * Creates a new named color. * @param name the color name * @param color the color to use when the named color's specific color properties are not * available. * @param profileName Optional profile name associated with this color space * @param profileURI Optional profile URI associated with this color space */ public NamedColorSpace(String name, Color color, String profileName, String profileURI) { this(name, color.getColorSpace().toCIEXYZ(color.getColorComponents(null)), profileName, profileURI); }
public void setOpacity(float alpha) { float[] c = getBackground().getColorComponents(new float[3]); setBackground(new Color(c[0], c[1], c[2], alpha)); videoComponent.setOpacity(alpha); } public float getOpacity() {
private void update(MouseEvent e) { if (selectedIndex != -1) { float[] hsb = getColorAt(e.getX(), e.getY()); hsb[1] = harmonicModel.get(selectedIndex).getColorComponents(null)[1]; //if (hsb != null) { harmonicModel.set(selectedIndex, new Color(harmonicModel.getColorSpace(), hsb, 1f)); //} repaint(); } } }
public static BaseColor prepareColor(Color color) { if (color.getColorSpace().getType() == ColorSpace.TYPE_CMYK) { float[] comp = color.getColorComponents(null); return new CMYKColor(comp[0], comp[1], comp[2], comp[3]); } else { return new BaseColor(color.getRGB()); } }
@Override public void pressingNodes(Node[] nodes) { diffusionMethod = brushPanel.getDiffusionMethod(); color = brushPanel.getColor().getColorComponents(color); intensity = brushPanel.getIntensity(); brush(nodes); }
/** * Copy constructor adding a fallback color. * @param color the color to be duplicated * @param fallback the fallback color (usually an sRGB color) */ public ColorWithFallback(Color color, Color fallback) { this(color.getColorSpace(), color.getColorComponents(null), getAlphaFloat(color), getAlternativeColors(color), fallback); }
@Override public void display(GLAutoDrawable glAutoDrawable) { GL2 gl = (GL2) glAutoDrawable.getGL(); OTFClientControl.getInstance().getMainOTFDrawer().setFrustrum(gl); float[] backgroundColor = OTFClientControl.getInstance().getOTFVisConfig().getBackgroundColor().getColorComponents(new float[4]); gl.glClearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]); gl.glClear( GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); float[] networkColor = OTFClientControl.getInstance().getOTFVisConfig().getNetworkColor().getColorComponents(new float[4]); gl.glColor4d(networkColor[0], networkColor[1], networkColor[2], networkColor[3]); checkNetList(glAutoDrawable); gl.glCallList(netDisplList); }