コード例 #1
0
 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);
 }
コード例 #2
0
 protected void computeGeometry() {
   // get the squares
   Rectangle r1 = firstSquareOfTwo(width, height, true);
   Rectangle r2 = secondSquareOfTwo(width, height, true);
   Rectangle r3 = innerRect(r1, CenterSize.getDouble());
   Rectangle r4 = innerRect(r2, CenterSize.getDouble());
   getDisplayElement(s1).setRect(r1);
   getDisplayElement(s2).setRect(r2);
   getDisplayElement(s3).setRect(r3);
   getDisplayElement(s4).setRect(r4);
 }
コード例 #3
0
 protected void computeGeometry() {
   Rectangle r = centeredRect(width, height, 2 * width / 3, 3 * height / 4);
   Rectangle r1 = new Rectangle(r.x, r.y, r.width / 2, r.height);
   Rectangle r2 = new Rectangle(r.x + r1.width, r.y, r1.width, r1.height);
   double par = LineThickness.getDouble();
   int x1 = r1.width / 8;
   int xx1 = 8 * x1;
   int xSize = xx1 / 8;
   int y1 = r1.height / 10;
   int yy1 = y1 * 10;
   int ySize = yy1 / 10;
   Rectangle r3 =
       new Rectangle(r1.x + 2 * xSize, r1.y + 2 * ySize, (int) (xSize * par), 6 * ySize);
   Rectangle r5 =
       new Rectangle((int) (r1.x + 5 * xSize + xSize - (xSize * par)), r3.y, r3.width, r3.height);
   Rectangle r4 =
       new Rectangle(
           r3.x + r3.width,
           (int) (r3.y + r3.height - (int) (xSize * par)),
           r5.x - r3.x - r3.width,
           (int) (xSize * par));
   Rectangle r7 =
       new Rectangle(
           r2.x + (r2.x - r5.x - r5.width), r2.y + 2 * ySize, (int) (xSize * par), 6 * ySize);
   Rectangle r6 =
       new Rectangle(r5.x + r5.width, r5.y, r7.x - r5.x - r5.width, (int) (xSize * par));
   Rectangle r9 =
       new Rectangle((int) (r2.x + 5 * xSize + xSize - (xSize * par)), r7.y, r7.width, r7.height);
   Rectangle r8 =
       new Rectangle(
           r7.x + r7.width,
           (int) (r7.y + r7.height - (int) (xSize * par)),
           r9.x - r7.x - r7.width,
           (int) (xSize * par));
   getDisplayElement(s1).setRect(r1);
   getDisplayElement(s2).setRect(r2);
   getDisplayElement(s3).setRect(r3);
   getDisplayElement(s4).setRect(r4);
   getDisplayElement(s5).setRect(r5);
   getDisplayElement(s6).setRect(r6);
   getDisplayElement(s7).setRect(r7);
   getDisplayElement(s8).setRect(r8);
   getDisplayElement(s9).setRect(r9);
 }