Clazz.declarePackage ("J.render");
Clazz.load (null, "J.render.TextRenderer", ["java.lang.Float", "JM.Text"], function () {
c$ = Clazz.declareType (J.render, "TextRenderer");
c$.render = Clazz.defineMethod (c$, "render", 
function (text, g3d, scalePixelsPerMicron, imageFontScaling, isAbsolute, boxXY, temp, doPointer, pointerColix, pointerWidth, isAntialiased) {
if (text == null || text.image == null && !text.doFormatText && text.lines == null) return false;
var showText = g3d.setC (text.colix);
if (!showText && (text.image == null && (text.bgcolix == 0 || !g3d.setC (text.bgcolix)))) return false;
text.setPosition (scalePixelsPerMicron, imageFontScaling, isAbsolute, boxXY);
if (text.image == null) {
if (text.bgcolix != 0) {
if (g3d.setC (text.bgcolix)) J.render.TextRenderer.showBox (g3d, text.colix, Clazz.floatToInt (text.boxX), Clazz.floatToInt (text.boxY) + text.boxYoff2 * 2, text.z + 2, text.zSlab, Clazz.floatToInt (text.boxWidth), Clazz.floatToInt (text.boxHeight), text.fontScale, !text.isEcho);
if (!showText) return false;
}for (var i = 0; i < text.lines.length; i++) {
text.setXYA (temp, i);
g3d.drawString (text.lines[i], text.font, Clazz.floatToInt (temp[0]), Clazz.floatToInt (temp[1]), text.z, text.zSlab, text.bgcolix);
}
} else {
g3d.drawImage (text.image, Clazz.floatToInt (text.boxX), Clazz.floatToInt (text.boxY), text.z, text.zSlab, text.bgcolix, Clazz.floatToInt (text.boxWidth), Clazz.floatToInt (text.boxHeight));
}if (!doPointer) return true;
J.render.TextRenderer.drawLineXYZ (g3d, text.atomX, text.atomY, text.atomZ, text.boxX, text.boxY, text.zSlab, text.boxWidth, text.boxHeight, pointerColix, pointerWidth * (isAntialiased ? 2 : 1));
return true;
}, "JM.Text,J.api.JmolRendererInterface,~N,~N,~B,~A,~A,~B,~N,~N,~B");
c$.drawLineXYZ = Clazz.defineMethod (c$, "drawLineXYZ", 
 function (g3d, x0, y0, z0, x1, y1, z1, w, h, pointerColix, pointerWidth) {
var offsetX = x1 - x0;
var offsetY = y1 - y0;
if (offsetX <= 0 && -offsetX <= w && offsetY <= 0 && -offsetY <= h) return;
var setX = (offsetY > 0 || offsetY < -h);
var pt = NaN;
x1 += (setX ? (offsetX > w / 2 ? 0 : offsetX < -w * 3 / 2 ? w : (pt = w / 2)) : (offsetX > 0 ? 0 : w));
var setY = !Float.isNaN (pt);
y1 += (setY && offsetY > 0 ? 0 : setY && offsetY < -h ? h : h / 2);
if (pointerWidth > 1) {
g3d.fillCylinderXYZ (pointerColix, pointerColix, 2, pointerWidth, x0, y0, z0, Clazz.floatToInt (x1), Clazz.floatToInt (y1), z1);
} else {
g3d.setC (pointerColix);
g3d.drawLineXYZ (x0, y0, z0, Clazz.floatToInt (x1), Clazz.floatToInt (y1), z1);
}}, "J.api.JmolRendererInterface,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N");
c$.renderSimpleLabel = Clazz.defineMethod (c$, "renderSimpleLabel", 
function (g3d, font, strLabel, colix, bgcolix, boxXY, z, zSlab, xOffset, yOffset, ascent, descent, isAbsolute, doPointer, pointerColix, pointerWidth, isAntialiased) {
var w = font.stringWidth (strLabel) + 8;
var h = ascent + descent + 8;
var x0 = Clazz.floatToInt (boxXY[0]);
var y0 = Clazz.floatToInt (boxXY[1]);
JM.Text.setBoxXY (w, h, xOffset, yOffset, boxXY, isAbsolute);
var x = boxXY[0];
var y = boxXY[1];
if (bgcolix != 0 && g3d.setC (bgcolix)) {
J.render.TextRenderer.showBox (g3d, colix, Clazz.floatToInt (x), Clazz.floatToInt (y), z, zSlab, Clazz.floatToInt (w), Clazz.floatToInt (h), 1, true);
} else {
g3d.setC (colix);
}g3d.drawString (strLabel, font, Clazz.floatToInt (x + 4), Clazz.floatToInt (y + 4 + ascent), z - 1, zSlab, bgcolix);
if (doPointer && (xOffset != 0 || yOffset != 0)) {
J.render.TextRenderer.drawLineXYZ (g3d, x0, y0, zSlab, x, y, zSlab, w, h, pointerColix, pointerWidth * (isAntialiased ? 2 : 1));
}}, "J.api.JmolRendererInterface,JU.Font,~S,~N,~N,~A,~N,~N,~N,~N,~N,~N,~B,~B,~N,~N,~B");
c$.showBox = Clazz.defineMethod (c$, "showBox", 
 function (g3d, colix, x, y, z, zSlab, boxWidth, boxHeight, imageFontScaling, atomBased) {
g3d.fillTextRect (x, y, z, zSlab, boxWidth, boxHeight);
g3d.setC (colix);
if (!atomBased) return;
if (imageFontScaling >= 2) {
g3d.drawRect (x + 3, y + 3, z - 1, zSlab, boxWidth - 6, boxHeight - 6);
} else {
g3d.drawRect (x + 1, y + 1, z - 1, zSlab, boxWidth - 2, boxHeight - 2);
}}, "J.api.JmolRendererInterface,~N,~N,~N,~N,~N,~N,~N,~N,~B");
});
