protected void computeGeometry() { pictHalfWidth = Width.getInt() / 2; pictWidth = pictHalfWidth + pictHalfWidth - 1; pictHeight = Height.getInt(); xLoc = -pictHalfWidth; yLoc = -pictHeight / 2; setFramesPerCycle(pictWidth - 1); setFrameIncrement(FrameIncrement.getInt()); // System.out.println("width = " + pictWidth); // System.out.println(" x = " + xLoc); // System.out.println(" y = " + yLoc); PxlColor[] ramp = AColor.getPxlColor().sinusoidalRampTo(BColor.getPxlColor(), pictHalfWidth); // System.out.println("w=" + (4*pictHalfWidth-1) + ", h=" + pictHeight); int ibWidth = 4 * pictHalfWidth - 1; if ((imageBuffer == null) || (imageBuffer.getWidth() != ibWidth) || (imageBuffer.getHeight() != pictHeight)) { imageBuffer = new BufferedImage(ibWidth, pictHeight, BufferedImage.TYPE_INT_RGB); } Graphics g = imageBuffer.getGraphics(); for (int x = 0; x < pictHalfWidth; x++) { g.setColor(ramp[x].dev()); g.drawLine(x, 0, x, pictHeight - 1); if (x < (pictHalfWidth - 1)) g.drawLine(pictWidth - x - 1, 0, pictWidth - x - 1, pictHeight - 1); if (x > 0) g.drawLine(pictWidth + x - 1, 0, pictWidth + x - 1, pictHeight - 1); if ((x > 0) && (x < (pictHalfWidth - 1))) g.drawLine(4 * pictHalfWidth - 4 - x, 0, 4 * pictHalfWidth - 4 - x, pictHeight - 1); } g.dispose(); BitMapElement p = (BitMapElement) getDisplayElement(pictElement); p.setImage(imageBuffer); p.setLocation(xLoc, yLoc); p.setClipRect(xLoc, yLoc, pictWidth, pictHeight); }
protected int create() { BitMapElement pict = new BitMapElement(); pict.setReferencePoint(PositionReferenceCodes.TOP_LEFT); pict.setColorPar(AColor); pictElement = enterDisplayElement(pict, group[0]); enterTiming(FrameTimer, FrameDuration, 0); return (pictElement); }