火曜日, 1月 27, 2009

ImageIO.write(): To save transparent PNG image files

The ImageIO class and its write method that comes with JDK1.60 does not support writing out transparent GIF images (at least in the way shown below). The write method of the class won't write out proper GIF format files with a transparent color. The method will create PNG files all right. The following shows how to save an image file. Suppose you have (BufferedImage)bufferedImage that you want to save:



FileOutputStream out=new FileOutputStream(fileName);
String descriptor="PNG";
BufferedImage image=new BufferedImage(right-left,bottom-top,BufferedImage.TYPE_INT_ARGB);
Graphics2D g=(Graphics2D)image.getGraphics();
g.drawImage(bufferedImage,0,0,right-left,bottom-top,left,top,right,bottom,this);
g.dispose();
ImageIO.write(image,descriptor,out);
out.flush();

I2S プロトコル

I²S(Inter-IC Sound)は、マイコンやオーディオ機器間で音声データをやり取りするために設計された、シリアル通信プロトコルです。I²CやSPIと名前は似ていますが、I²Sは音声専用のプロトコルです。 I²Sは、以下の3つの主要な信号線を使って通信します。 BCLK (...