java 生成透明背景圖片

        //開始繪圖
         graphics2d.setBackground(Color.WHITE);
         graphics2d.clearRect(0, 0, width, height);                 
        graphics2d.setPaint(new Color(backgroundcolorR, backgroundcolorG, backgroundcolorB,backgroundcolorA));      //設置背景顏色
        graphics2d.fillRect(0, 0, width, height);  //填充顏色

        //設置透明  start  
        bufferedImage = graphics2d.getDeviceConfiguration().createCompatibleImage(width, height, Transparency.TRANSLUCENT);  
        graphics2d=bufferedImage.createGraphics();  
        //設置透明  end  
發佈了38 篇原創文章 · 獲贊 26 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章