From: Miguel <mig...@us...> - 2004-06-08 11:06:37
|
Update of /cvsroot/jmol/Jmol/src/org/jmol/g3d In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29276/src/org/jmol/g3d Modified Files: Graphics3D.java Text3D.java Log Message: implemented background for frank and text3D rendering with background Index: Graphics3D.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/jmol/g3d/Graphics3D.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- Graphics3D.java 31 May 2004 15:57:02 -0000 1.18 +++ Graphics3D.java 8 Jun 2004 11:06:25 -0000 1.19 @@ -317,17 +317,17 @@ public void drawString(String str, short colix, int xBaseline, int yBaseline, int z) { - drawString(str, font3dCurrent, colix, xBaseline, yBaseline, z); + drawString(str, font3dCurrent, colix, (short)0, xBaseline, yBaseline, z); } - public void drawString(String str, Font3D font3d, short colix, + public void drawString(String str, Font3D font3d, short colix, short bgcolix, int xBaseline, int yBaseline, int z) { font3dCurrent = font3d; argbCurrent = getArgb(colix); if (z < slab) return; Text3D.plot(xBaseline, yBaseline - font3dCurrent.fontMetrics.getAscent(), - z, argbCurrent, str, font3dCurrent, this); + z, argbCurrent, getArgb(bgcolix), str, font3dCurrent, this); } public void setFontOfSize(int fontsize) { Index: Text3D.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/jmol/g3d/Text3D.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Text3D.java 11 Apr 2004 20:51:53 -0000 1.1 +++ Text3D.java 8 Jun 2004 11:06:25 -0000 1.2 @@ -185,7 +185,7 @@ return text3d; } - static void plot(int x, int y, int z, int argb, + static void plot(int x, int y, int z, int argb, int argbBackground, String text, Font3D font3d, Graphics3D g3d) { Text3D text3d = getText3D(text, font3d, g3d.platform); int[] bitmap = text3d.bitmap; @@ -196,12 +196,15 @@ return; if (x < 0 || x + textWidth > g3d.width || y < 0 || y + textHeight > g3d.height) - plotClipped(x, y, z, argb, g3d, textWidth, textHeight, bitmap); + plotClipped(x, y, z, argb, argbBackground, + g3d, textWidth, textHeight, bitmap); else - plotUnclipped(x, y, z, argb, g3d, textWidth, textHeight, bitmap); + plotUnclipped(x, y, z, argb, argbBackground, + g3d, textWidth, textHeight, bitmap); } - static void plotUnclipped(int x, int y, int z, int argb, Graphics3D g3d, + static void plotUnclipped(int x, int y, int z, int argb, int argbBackground, + Graphics3D g3d, int textWidth, int textHeight, int[] bitmap) { int offset = 0; int shiftregister = 0; @@ -214,16 +217,16 @@ while (j < textWidth) { if ((offset & 31) == 0) shiftregister = bitmap[offset >> 5]; - if (shiftregister == 0) { + if (shiftregister == 0 && argbBackground == 0) { int skip = 32 - (offset & 31); j += skip; offset += skip; pbufOffset += skip; } else { - if (shiftregister < 0) { + if (shiftregister < 0 || argbBackground != 0) { if (z < zbuf[pbufOffset]) { zbuf[pbufOffset] = (short)z; - pbuf[pbufOffset] = argb; + pbuf[pbufOffset] = shiftregister < 0 ? argb : argbBackground; } } shiftregister <<= 1; @@ -240,7 +243,8 @@ } } - static void plotClipped(int x, int y, int z, int argb, Graphics3D g3d, + static void plotClipped(int x, int y, int z, int argb, int argbBackground, + Graphics3D g3d, int textWidth, int textHeight, int[] bitmap) { int offset = 0; int shiftregister = 0; @@ -249,13 +253,14 @@ while (j < textWidth) { if ((offset & 31) == 0) shiftregister = bitmap[offset >> 5]; - if (shiftregister == 0) { + if (shiftregister == 0 && argbBackground == 0) { int skip = 32 - (offset & 31); j += skip; offset += skip; } else { - if (shiftregister < 0) - g3d.plotPixelClipped(argb, x + j, y + i, z); + if (shiftregister < 0 || argbBackground != 0) + g3d.plotPixelClipped(shiftregister < 0 ? argb : argbBackground, + x + j, y + i, z); shiftregister <<= 1; ++offset; ++j; |