Skip to content

Commit

Permalink
Pack color in TXTBasedAtomTypeConfigurator.
Browse files Browse the repository at this point in the history
Change-Id: Ia6c91152d42c3f8d2d176bbf122b5d8ee7921f7c
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
johnmay authored and egonw committed Aug 30, 2014
1 parent 1273835 commit fb8b0d2
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -18,7 +18,6 @@
*/
package org.openscience.cdk.config;

import java.awt.Color;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -126,8 +125,13 @@ public List<IAtomType> readAtomTypes(IChemObjectBuilder builder) throws IOExcept
atomType.setAtomicNumber(atomicNumber);
atomType.setExactMass(mass);
atomType.setCovalentRadius(covalent);
Color color = new Color(colorR, colorG, colorB);
atomType.setProperty("org.openscience.cdk.renderer.color", color);

// pack the RGB color space components into a single int. Note we
// avoid java.awt.Color (not available on some JREs)
atomType.setProperty("org.openscience.cdk.renderer.color",
((colorR << 16) & 0xff0000) |
((colorG << 8) & 0x00ff00) |
(colorB & 0x0000ff));
atomTypes.add(atomType);
} else {
throw new IOException("AtomTypeTable.ReadAtypes: " +
Expand Down

0 comments on commit fb8b0d2

Please sign in to comment.