//*******************************************************************//
 //* Called everytime applet need painting or whenever repaint is
 //*   called.
 //*******************************************************************//
 public override void paint(Graphics g)
 {
     if (fOffscreenImage != null)
         g.drawImage(fOffscreenImage, 0, 0, this);
 }
Пример #2
0
 protected internal virtual void paintComponent(Graphics g)
 {
   if (this.image == null)
     g.fillRect(0, 0, ((JComponent) this).getWidth(), ((JComponent) this).getHeight());
   else if (((Boolean) this.__\u003C\u003EaspectKept.getValue()).booleanValue())
   {
     int num1 = (int) ((Component) this).getBounds().width;
     int num2 = (int) ((Component) this).getBounds().height;
     double num3 = Math.min((double) num1 / (double) this.image.getWidth(), (double) num2 / (double) this.image.getHeight());
     g.drawImage((Image) this.image, ByteCodeHelper.d2i((double) num1 - num3 * (double) this.image.getWidth()) / 2, ByteCodeHelper.d2i((double) num2 - num3 * (double) this.image.getHeight()) / 2, ByteCodeHelper.d2i(((double) num1 + num3 * (double) this.image.getWidth()) / 2.0), ByteCodeHelper.d2i((double) num2 + num3 * (double) this.image.getHeight()) / 2, 0, 0, this.image.getWidth(), this.image.getHeight(), (ImageObserver) null);
   }
   else
     g.drawImage((Image) this.image, 0, 0, ((JComponent) this).getWidth(), ((JComponent) this).getHeight(), 0, 0, this.image.getWidth(), this.image.getHeight(), (ImageObserver) null);
 }
Пример #3
0
 public override void paint(Graphics g) {
     var insets = getInsets();
     var bounds = getBounds();
     var width = (int)(bounds.getWidth() - insets.left - insets.right);
     var height = (int)(bounds.getHeight() - insets.top - insets.bottom - status.getBounds().getHeight());
     var cellWidth = width / WIDTH;
     var cellHeight = height / HEIGHT;
     var hmargin = (cellWidth % WIDTH) / 2 + insets.left;
     var vmargin = (cellHeight % HEIGHT) / 2 + insets.top;
     if (buffer == null) {
         buffer = createImage((int)bounds.getWidth(), (int)bounds.getHeight());
     }
     var bg = buffer.getGraphics();
     bg.clearRect(0, 0, (int)bounds.getWidth(), (int)bounds.getHeight());
     for (int i = 0; i < WIDTH; i++) {
         for (int j = 0; j < HEIGHT; j++) {
             if ((i % 2 == 0) == (j % 2 == 0)) {
                 bg.setColor(LIGHT_GRAY2);
             } else {
                 bg.setColor(Color.LIGHT_GRAY);
             }
             bg.fillRect(i * cellWidth + hmargin, j * cellHeight + vmargin, cellWidth, cellHeight);
         }                
     }
     for (int i = 0; i < WIDTH; i++) {
         for (int j = 0; j < HEIGHT; j++) {
             var dalek = board[i][j];
             if (dalek != null) {
                 bg.drawImage((dalek.Broken) ? this.Wreckage : this.Dalek, i * cellWidth + hmargin, j * cellHeight + vmargin, null);
             }
         }
     }
     if (whoX >= 0) {
         bg.drawImage(this.DoctorWho, whoX * cellWidth + hmargin, whoY * cellHeight + vmargin, null);
     }
     if (state == State.GameOver) {
         bg.setFont(FONT);
         bg.setColor(Color.DARK_GRAY);
         bg.drawString("Game Over", 205, 305);
         bg.setColor(Color.BLACK);
         bg.drawString("Game Over", 200, 300);
     }
     g.drawImage(buffer, 0, 0, this);
 }