Example #1
0
 public void draw(LGraphics g, int x, int y, int w, int h) {
   switch (style) {
     case 0:
       Color oldColor = g.getColor();
       g.setAntiAlias(true);
       g.setColor(color);
       float alpha = 0.0f;
       int nx = x + w / 2 - (int) r * 4, ny = y + h / 2 - (int) r * 4;
       g.translate(nx, ny);
       for (Iterator it = list.iterator(); it.hasNext(); ) {
         Shape s = (Shape) it.next();
         alpha = isRunning ? alpha + 0.1f : 0.5f;
         g.setAlpha(alpha);
         g.fill(s);
       }
       g.setAntiAlias(false);
       g.setAlpha(1.0F);
       g.translate(-nx, -ny);
       g.setColor(oldColor);
       break;
     case 1:
       g.translate(x, y);
       g.setAntialiasAll(true);
       g.setColor(fill);
       g.drawRect(0, 0, width, height);
       g.setStroke(stroke);
       int sa = angle % 360;
       g.setPaint(border);
       g.drawArc(
           x + (width - paintWidth) / 2,
           y + (height - paintHeight) / 2,
           paintWidth,
           paintHeight,
           sa,
           sa + ANGLE_STEP);
       g.setAntialiasAll(false);
       g.translate(-x, -y);
       break;
   }
 }
Example #2
0
 protected void setPixels() {
   int[] dest = image.getPixels();
   if (lastDispose > 0) {
     if (lastDispose == 3) {
       int n = frameCount - 2;
       if (n > 0) {
         lastImage = getFrame(n - 1);
       } else {
         lastImage = null;
       }
     }
     if (lastImage != null) {
       int[] prev = lastImage.getPixels();
       image.setPixels(prev, width, height);
       if (lastDispose == 2) {
         LGraphics g = image.getLGraphics();
         Color c = null;
         if (transparency) {
           c = new Color(0, 0, 0, 0);
         } else {
           c = new Color(lastBgColor);
         }
         g.setColor(c);
         g.fill(lastRect);
         g.dispose();
       }
     }
   }
   int pass = 1;
   int inc = 8;
   int iline = 0;
   for (int i = 0; i < ih; i++) {
     int line = i;
     if (interlace) {
       if (iline >= ih) {
         pass++;
         switch (pass) {
           case 2:
             iline = 4;
             break;
           case 3:
             iline = 2;
             inc = 4;
             break;
           case 4:
             iline = 1;
             inc = 2;
         }
       }
       line = iline;
       iline += inc;
     }
     line += iy;
     if (line < height) {
       int k = line * width;
       int dx = k + ix;
       int dlim = dx + iw;
       if ((k + width) < dlim) {
         dlim = k + width;
       }
       int sx = i * iw;
       while (dx < dlim) {
         int index = ((int) pixels[sx++]) & 0xff;
         int c = act[index];
         if (c != 0) {
           dest[dx] = c;
         }
         dx++;
       }
     }
   }
   image.setPixels(dest, width, height);
 }