public abstract boolean drawImage(Image img,
                                  int dx1,
                                  int dy1,
                                  int dx2,
                                  int dy2,
                                  int sx1,
                                  int sy1,
                                  int sx2,
                                  int sy2,
                                  ImageObserver observer)  这个函数里各个参数具体代表了什么啊?还有CANVAS能否为透明?

解决方案 »

  1.   

    Parameters:
    img - the specified image to be drawn
    dx1 - the x coordinate of the first corner of the destination rectangle.
    dy1 - the y coordinate of the first corner of the destination rectangle.
    dx2 - the x coordinate of the second corner of the destination rectangle.
    dy2 - the y coordinate of the second corner of the destination rectangle.
    sx1 - the x coordinate of the first corner of the source rectangle.
    sy1 - the y coordinate of the first corner of the source rectangle.
    sx2 - the x coordinate of the second corner of the source rectangle.
    sy2 - the y coordinate of the second corner of the source rectangle.
    observer - object to be notified as more of the image is scaled and converted. 
    Returns:
    true if the current output representation is complete; false otherwise.dx,dy是目的地址,就是要画在画布的范围
    sx,sy就是源文件的范围了,复制image的那个范围的图像到画布上咯
    observer  是一个component~~JFrame, JPanel之类啦
      

  2.   

    http://www.java2s.com/ExampleCode/Swing-JFC/showthumbnailsofgraphicfiles.htm
    例子