Revision: 18252
          http://sourceforge.net/p/jmol/code/18252
Author:   hansonr
Date:     2013-05-26 22:24:32 +0000 (Sun, 26 May 2013)
Log Message:
-----------


Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java

Modified: trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java      
2013-05-26 12:54:17 UTC (rev 18251)
+++ trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java      
2013-05-26 22:24:32 UTC (rev 18252)
@@ -169,6 +169,7 @@
   private boolean cartoonRockets;
   private int surfaceMode;
   private int surfaceColor;
+  private int bgRgb;
   private int labelFontId;
 
   private boolean isMovie;
@@ -778,6 +779,7 @@
     //solventAsSpheres = getBooleanSetting(PyMOL.sphere_solvent); - this is 
for SA-Surfaces
     surfaceMode = (int) floatSetting(PyMOL.surface_mode);
     surfaceColor = (int) floatSetting(PyMOL.surface_color);
+    bgRgb = colorSetting(listAt(settings, PyMOL.bg_rgb));
     labelPosition = new P3();
     try {
       JmolList<Object> setting = localSettings.get(Integer
@@ -1294,10 +1296,10 @@
     if (reps[PyMOL.REP_LABELS].get(iAtom)) {
       int icolor = (int) getUniqueFloat(atom.uniqueID, PyMOL.label_color,
           labelColor);
-      if (icolor == PyMOL.COLOR_BACK || icolor == PyMOL.COLOR_FRONT)
-        icolor = PyMOL.COLOR_BLACK;
-      else if (icolor < 0)
+      if (icolor == PyMOL.COLOR_BACK || icolor == PyMOL.COLOR_FRONT) {
+      } else if (icolor < 0) {
         icolor = atomColor;
+      }
       float[] labelPos = new float[7];
       JmolList<Object> labelOffset = listAt(labelPositions, apt);
       if (labelOffset == null) {
@@ -1987,8 +1989,7 @@
         + booleanSetting(PyMOL.cartoon_fancy_helices));
     sb.append(";set cartoonFancy "
         + !booleanSetting(PyMOL.cartoon_fancy_helices));
-    JmolList<Object> bg = listAt(settings, PyMOL.bg_rgb);
-    String s = "000000" + Integer.toHexString(colorSetting(bg));
+    String s = "000000" + Integer.toHexString(bgRgb);
     s = "[x" + s.substring(s.length() - 6) + "]";
     sb.append(";background " + s);
     sb.append(";moveto 0 PyMOL " + Escape.eAF(pymolView));
@@ -2096,11 +2097,16 @@
   }
  
   // generally useful static methods
-  
 
-  private static short getColix(int colorIndex, float translucency) {
-    return C.getColixTranslucent3(C.getColixO(Integer.valueOf(PyMOL
-        .getRGB(colorIndex))), translucency > 0, translucency);
+  private short getColix(int colorIndex, float translucency) {
+    short colix = (
+        colorIndex == PyMOL.COLOR_BACK ? 
+            (ColorUtil.getBgContrast(bgRgb) == C.WHITE ? C.BLACK : C.WHITE)
+        : colorIndex == PyMOL.COLOR_FRONT ? 
+            ColorUtil.getBgContrast(bgRgb) 
+        : C.getColixO(Integer.valueOf(PyMOL.getRGB(colorIndex))));
+
+    return C.getColixTranslucent3(colix, translucency > 0, translucency);
   }
 
   private static int colorSettingClamped(JmolList<Object> c) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to