Beispiel #1
0
  private void askWhat() {
    int apa =
        Dialog.ask(
            "What to do?",
            new String[] {"Draw to image", "Add Filter", "Transparent", "Remove"},
            0);
    if (apa == 0) {
      this.g.setGlobalAlpha(gbrfield.getTransparent());
      if (gbrfield.getText() != null) {
        this.g.setFont(gbrfield.getFont());
        int c = g.getColor();
        this.g.setFont(gbrfield.getFont());
        this.g.setColor(gbrfield.getColor());
        this.g.drawText(gbrfield.getText(), gbrfield.getX(), gbrfield.getY());
        this.g.setColor(c);
        gbrfield.setText(null);
        gbrfield.setGbr(null);
      } else if (gbrfield.getGbr() != null) {
        this.g.drawBitmap(
            gbrfield.getX(),
            gbrfield.getY(),
            gbrfield.getGbr().getWidth(),
            gbrfield.getGbr().getHeight(),
            gbrfield.getGbr(),
            0,
            0);
        gbrfield.setText(null);
        gbrfield.setGbr(null);
      }
      gbrfield.setTransparent(255);
      latar.invalidate();
      Mulai.playTune();
    } else if (apa == 1) {
      if (gbrfield.getGbr() != null) {
        int ask =
            Dialog.ask(
                "What Filter?", new String[] {"GrayScale", "Negative", "Sephia", "Thermal"}, 0);
        FilterImg.doit(gbrfield.getGbr(), ask);
        gbrfield.setGbr(gbrfield.getGbr());
      }
    } else if (apa == 2) {
      int ask =
          Dialog.ask("Transparent Value?", new String[] {"255", "200", "150", "100", "50"}, 0);
      switch (ask) {
        case 0:
          gbrfield.setTransparent(255);
          break;
        case 1:
          gbrfield.setTransparent(200);
          break;
        case 2:
          gbrfield.setTransparent(150);
          break;
        case 3:
          gbrfield.setTransparent(100);
          break;
        case 4:
          gbrfield.setTransparent(50);
          break;

        default:
          break;
      }
    } else if (apa == 3) {
      gbrfield.setText(null);
      gbrfield.setGbr(null);
      gbrfield.setTransparent(255);
    }
  }