File: DrawImageOperation.java

package info (click to toggle)
libpixie-java 1%3A0.8.4-1
  • links: PTS
  • area: contrib
  • in suites: etch, etch-m68k
  • size: 1,000 kB
  • ctags: 2,695
  • sloc: java: 11,136; xml: 114; makefile: 16
file content (44 lines) | stat: -rw-r--r-- 1,035 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
 * Date: Mar 9, 2003
 * Time: 1:49:47 PM
 *
 * $Id: DrawImageOperation.java,v 1.3 2004/11/21 16:29:31 taqua Exp $
 */
package org.jfree.pixie.g2recorder;

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.geom.AffineTransform;
import java.awt.image.ImageObserver;

public class DrawImageOperation implements G2Operation
{
  private Image image;
  private AffineTransform transform;
  private ImageObserver observer;

  public DrawImageOperation (final Image image, final AffineTransform transform,
                             final ImageObserver observer)
  {
    this.image = image;
    this.transform = transform;
    this.observer = observer;
  }

  public void draw (final Graphics2D g2)
  {
    // wait until the image is loaded and completly drawn ...
    while (g2.drawImage(image, transform, observer) == false)
    {
      try
      {
        Thread.sleep(100);
      }
      catch (InterruptedException ie)
      {
        // this thread got a signal to die at once.
        return;
      }
    }
  }
}