drawImage(((ImageCache)paramPImage.getCache(this)).image, (int)paramFloat1, (int)paramFloat2, (int)paramFloat3, (int)paramFloat4, paramInt1, paramInt2, paramInt3, paramInt4, null);
这个函数怎么画的啊。
可以画像素的颜色么

解决方案 »

  1.   

    大致意思差不多吧
    import java.applet.*;  
    import java.awt.*; 
    import java.net.*;public class JTabbedTest extends Applet{ 
        private Image image;     public void init(){ 
            try{
                image = getImage(new URL("http://avatar.profile.csdn.net/5/2/8/2_ufofind.jpg")); 
                
            }catch (Exception e){
                e.printStackTrace();
            }
        }     public void paint(Graphics g){ 
            g.drawImage(image, 0, 0, this); 
        }
    }
      

  2.   

    import java.io.FileOutputStream; import javax.imageio.ImageIO; import com.sun.image.codec.jpeg.JPEGCodec; 
    import com.sun.image.codec.jpeg.JPEGImageEncoder; public final class ImageUtils { 
    public ImageUtils() { } 
    public static void readDefinePixel(String imagePath) 
    { // int ggwidth=120; 
    //     int ggheight=150; try { 
    File _file = new File(imagePath); 
    Image src = ImageIO.read(_file); 
    //图片的宽度 
    int wideth = src.getWidth(null);  //读取文件的长宽 
    //图片的高度 
    int height = src.getHeight(null); System.out.println("图片宽度wideth:"+wideth); 
    System.out.println("图片高度height:"+height); 
    BufferedImage image = new BufferedImage(120, 150, 
    BufferedImage.TYPE_INT_RGB);  //表示一个图像,该图像具有打包成整数像素的 8 位 RGB 颜色分量 
    Graphics g = image.createGraphics(); 
    //g.drawImage(src, 20, 20, wideth/2, height/2, null); 
    int x1=(wideth-120)/2; 
    int y1=(height-150)/2; 
    int x2=(wideth-120)/2+120; 
    int y2=(height-150)/2+150; 
                Color color = new Color(0x00,0x00,0x00); 
    g.drawImage(src, 0, 0, 120, 150, x1, y1, x2, y2,color, null); 
    // 
    //写文件 
    //取指定区域的图像 
    Color color1 = new Color(0,0,0); 
    g.setXORMode(color1); 
    g.dispose(); 
    System.out.println(g.getColor()); 
    //目标文件 
    File itemFile = new File("c:/shuiyin/P1060512.gif"); 
    FileOutputStream out = new FileOutputStream(itemFile); 
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); 
    encoder.encode(image); 
    out.flush(); 
    out.close(); } catch (Exception e) { 
    // TODO: handle exception 
    e.printStackTrace(); 

    } public static void main(String[] args) { 
    readDefinePixel("c:/shuiyin/P1060567.JPG"); 

      

  3.   

    g.drawImage(src, 0, 0, 120, 150, x1, y1, x2, y2,color, null); 这条程序和这条程序drawImage(((ImageCache)paramPImage.getCache(this)).image, x1, x2, x3, x4, m1, m2, m3, m4, null); 
    第一个有11个参数,第二个有10个参数,我想问问这些参数代表什么,这个函数的具体作用;
    因为很重要,所以想知道的很清楚。