@Override public void paint(Graphics g, int localX, int localY, int width, int height) { final IOpenGL gl = g.getOpenGL(); g.setColor(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()); final int globalX = localX + g.getTranslation().getX(); final int globalY = localY + g.getTranslation().getY(); // System.out.println(globalX+" "+globalY+" "+width+" "+height); // System.out.println(localX+" "+localY+" "+width+" "+height+" "+(globalY // + height - getBottom())); if (getLeft() != 1 && getLeft() > 0) { gl.lineWidth(getLeft()); } gl.startLines(); // draw left line if (getLeft() > 0) { gl.vertex(globalX + getLeft() / 2, globalY + getBottom()); gl.vertex(globalX + getLeft() / 2, globalY + height - getTop()); } // draw bottom line if (getBottom() > 0) { if (getBottom() != getLeft()) { changeLineWidth(gl, getBottom()); } gl.vertex(globalX, globalY + getBottom() / 2); gl.vertex(globalX + width, globalY + getBottom() / 2); } // draw rigth line if (getRight() > 0) { if (getRight() != getBottom()) { changeLineWidth(gl, getRight()); } gl.vertex(globalX + width - (getRight() + 1) / 2, globalY + getBottom()); gl.vertex(globalX + width - (getRight() + 1) / 2, globalY + height - getTop()); } // draw top line if (getTop() > 0) { if (getTop() != getRight()) { changeLineWidth(gl, getTop()); } gl.vertex(globalX, globalY + height - (getTop() + 1) / 2); gl.vertex(globalX + width, globalY + height - (getTop() + 1) / 2); } gl.end(); gl.lineWidth(1); }
public void paint(Graphics g, int localX, int localY, int width, int height) { g.setColor(Color.RED); g.drawWireRectangle(localX, localY, width, height); g.setColor(Color.BLUE); g.drawWireRectangle(localX + 1, localY + 1, width - 2, height - 2); g.setColor(Color.YELLOW); g.drawWireRectangle(localX + 2, localY + 2, width - 4, height - 4); }
public void paint(Graphics g, int localX, int localY, int width, int height) { if (pixmap == null || !this.isEnabled()) return; int x = localX + (int) ((double) (width - pixmap.getWidth()) / 2d); int y = localY + (int) ((double) (height - pixmap.getHeight()) / 2d); if (useAlternateBlending) { g.getOpenGL().enableAlternateBlending(true); g.setColor( new Color( modulationColor.getRed() * modulationColor.getAlpha(), modulationColor.getGreen() * modulationColor.getAlpha(), modulationColor.getBlue() * modulationColor.getAlpha(), modulationColor.getAlpha())); g.drawImage(pixmap, x, y); g.getOpenGL().enableAlternateBlending(false); } else { g.setColor(modulationColor); g.drawImage(pixmap, x, y); } }