public void dispose() { if (drawWidth != null) { drawWidth.dispose(); } if (drawHeight != null) { drawHeight.dispose(); } }
public synchronized void drawWidth(LGraphics g, int x, int y) { try { if (drawWidth == null) { drawWidth = new LImage(width, height, true); LGraphics gl = drawWidth.getLGraphics(); for (int i = 0; i < width; i++) { gl.setColor( new Color( (start.getRed() * (width - i)) / width + (end.getRed() * i) / width, (start.getGreen() * (width - i)) / width + (end.getGreen() * i) / width, (start.getBlue() * (width - i)) / width + (end.getBlue() * i) / width, alpha)); gl.drawLine(i, 0, i, height); } gl.dispose(); gl = null; } g.drawImage(drawWidth, x, y); } catch (Exception e) { for (int i = 0; i < width; i++) { g.setColor( new Color( (start.getRed() * (width - i)) / width + (end.getRed() * i) / width, (start.getGreen() * (width - i)) / width + (end.getGreen() * i) / width, (start.getBlue() * (width - i)) / width + (end.getBlue() * i) / width, alpha)); g.drawLine(i + x, y, i + x, y + height); } } }
public synchronized void drawHeight(LGraphics g, int x, int y) { try { if (drawHeight == null) { drawHeight = new LImage(width, height, true); LGraphics gl = drawHeight.getLGraphics(); for (int i = 0; i < height; i++) { gl.setColor( new Color( (start.getRed() * (height - i)) / height + (end.getRed() * i) / height, (start.getGreen() * (height - i)) / height + (end.getGreen() * i) / height, (start.getBlue() * (height - i)) / height + (end.getBlue() * i) / height, alpha)); gl.drawLine(0, i, width, i); } gl.dispose(); gl = null; } g.drawImage(drawHeight, x, y); } catch (Exception e) { for (int i = 0; i < height; i++) { g.setColor( new Color( (start.getRed() * (height - i)) / height + (end.getRed() * i) / height, (start.getGreen() * (height - i)) / height + (end.getGreen() * i) / height, (start.getBlue() * (height - i)) / height + (end.getBlue() * i) / height, alpha)); g.drawLine(x, i + y, x + width, i + y); } } }
public LPixmapData(LImage pix) { this(pix.getPixels(), pix.getWidth(), pix.getHeight()); }