From: Nicolas <ni...@us...> - 2004-12-08 21:26:55
|
Update of /cvsroot/jmol/Jmol/src/org/jmol/g3d In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25697/src/org/jmol/g3d Modified Files: Line3D.java Graphics3D.java Log Message: Bug 1080551: Tooltip problem when slab on Index: Line3D.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/jmol/g3d/Line3D.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Line3D.java 7 Nov 2004 10:51:22 -0000 1.5 +++ Line3D.java 8 Dec 2004 21:26:17 -0000 1.6 @@ -55,6 +55,74 @@ } } + void drawVLine(int argb, int x, int y, int z, int h, boolean checkSlab) { + int width = g3d.width; + int height = g3d.height; + if ((x < 0) || (x >= width)) { + return; + } + if (checkSlab) { + if ((z < g3d.slab) || (z > g3d.depth)) { + return; + } + } + if (h < 0) { + y += h; + h = -h; + } + int[] pbuf = g3d.pbuf; + short[] zbuf = g3d.zbuf; + if (y < 0) { + h += y; + y = 0; + } + if (y + h >= height) { + h = height - 1 - y; + } + int offset = x + width * y; + for (int i = 0; i <= h; i++) { + if (z < zbuf[offset]) { + zbuf[offset] = (short)z; + pbuf[offset] = argb; + } + offset += width; + } + } + + void drawHLine(int argb, int x, int y, int z, int w, boolean checkSlab) { + int width = g3d.width; + int height = g3d.height; + if ((y < 0) || (y >= height)) { + return; + } + if (checkSlab) { + if ((z < g3d.slab) || (z > g3d.depth)) { + return; + } + } + if (w < 0) { + x += w; + w = -w; + } + int[] pbuf = g3d.pbuf; + short[] zbuf = g3d.zbuf; + if (x < 0) { + w += x; + x = 0; + } + if (x + w >= width) { + w = width - 1 - x; + } + int offset = x + width * y; + for (int i = 0; i <= w; i++) { + if (z < zbuf[offset]) { + zbuf[offset] = (short)z; + pbuf[offset] = argb; + } + offset++; + } + } + void drawDashedLine(int argbA, int argbB, int run, int rise, int xA, int yA, int zA, int xB, int yB, int zB) { Index: Graphics3D.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/jmol/g3d/Graphics3D.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- Graphics3D.java 2 Dec 2004 16:25:36 -0000 1.31 +++ Graphics3D.java 8 Dec 2004 21:26:17 -0000 1.32 @@ -321,11 +321,22 @@ int width, int height) { argbCurrent = getArgb(colix); int xRight = x + width - 1; - drawLine(x, y, z, xRight, y, z); + line3d.drawHLine(argbCurrent, x, y, z, width -1, true); int yBottom = y + height - 1; - drawLine(x, y, z, x, yBottom, z); - drawLine(xRight, y, z, xRight, yBottom, z); - drawLine(x, yBottom, z, xRight + 1, yBottom, z); + line3d.drawVLine(argbCurrent, x, y, z, height - 1, true); + line3d.drawVLine(argbCurrent, xRight, y, z, height - 1, true); + line3d.drawHLine(argbCurrent, x, yBottom, z, width, true); + } + + public void drawRectNoSlab(short colix, int x, int y, int z, + int width, int height) { + argbCurrent = getArgb(colix); + int xRight = x + width - 1; + line3d.drawHLine(argbCurrent, x, y, z, width -1, false); + int yBottom = y + height - 1; + line3d.drawVLine(argbCurrent, x, y, z, height - 1, false); + line3d.drawVLine(argbCurrent, xRight, y, z, height - 1, false); + line3d.drawHLine(argbCurrent, x, yBottom, z, width, false); } public void drawString(String str, short colix, @@ -348,6 +359,15 @@ // System.out.println("done"); } + public void drawStringNoSlab(String str, Font3D font3d, short colix, + short bgcolix, int xBaseline, int yBaseline, + int z) { + font3dCurrent = font3d; + argbCurrent = getArgb(colix); + Text3D.plot(xBaseline, yBaseline - font3d.fontMetrics.getAscent(), + z, argbCurrent, getArgb(bgcolix), str, font3dCurrent, this); + } + public void setFontOfSize(int fontsize) { font3dCurrent = getFont3D(fontsize); } |