| 3 |
|
import java.awt.image.*; |
| 4 |
|
import Acme.JPM.Encoders.*; |
| 5 |
|
|
| 6 |
< |
|
| 6 |
> |
// Use the gif encoder bits to write our image to a gif file. |
| 7 |
|
public class IscreamChartWriter { |
| 8 |
|
|
| 9 |
+ |
// Dummy constructor. |
| 10 |
|
public IscreamChartWriter() { |
| 11 |
|
|
| 12 |
|
} |
| 13 |
|
|
| 14 |
< |
public static void writeChart(BufferedImage img, String filename) { |
| 14 |
> |
// Write the gif file. |
| 15 |
> |
public static void writeChart(BufferedImage img, File filename) { |
| 16 |
|
try { |
| 17 |
< |
FileOutputStream fos = new FileOutputStream(new File(filename)); |
| 17 |
> |
FileOutputStream fos = new FileOutputStream(filename); |
| 18 |
|
GifEncoder encoder = new GifEncoder(img, fos); |
| 19 |
|
|
| 20 |
|
encoder.encode(); |