acmegifformatter.java

来自「OpenMap是一个基于JavaBeansTM的开发工具包。利用OpenMap你」· Java 代码 · 共 87 行

JAVA
87
字号
// **********************************************************************// // <copyright>// //  BBN Technologies//  10 Moulton Street//  Cambridge, MA 02138//  (617) 873-8000// //  Copyright (C) BBNT Solutions LLC. All rights reserved.// // </copyright>// **********************************************************************// // $Source: /cvs/distapps/openmap/src/openmap/com/bbn/openmap/image/AcmeGifFormatter.java,v $// $RCSfile: AcmeGifFormatter.java,v $// $Revision: 1.2.2.2 $// $Date: 2008/02/19 23:34:44 $// $Author: dietrick $// // **********************************************************************package com.bbn.openmap.image;import com.bbn.openmap.layer.util.http.HttpConnection;import com.bbn.openmap.util.Debug;import java.util.*;import java.awt.image.BufferedImage;/** * This formatter requires the Acme.JPM.Encoders package. That code * can be found at <a * href="http://www.acme.com/java">http://www.acme.com/java </a>. */public class AcmeGifFormatter extends AbstractImageFormatter {    public AcmeGifFormatter() {}    public void setProperties(String prefix, Properties props) {}    public ImageFormatter makeClone() {        return new AcmeGifFormatter();    }    public byte[] formatImage(BufferedImage bi) {        try {            return AcmeGifHelper.encodeGif(bi);        } catch (java.io.IOException ioe) {            Debug.error("AcmeGifFormatter caught IOException formatting image!\n  "                    + ioe);            return new byte[0];        }    }    /**     * Get the Image Type created by the ImageFormatter. These     * responses should adhere to the OGC WMT standard format labels.     * Some are listed in the WMTConstants interface file.     */    public String getFormatLabel() {        return WMTConstants.IMAGEFORMAT_GIF;    }    /**     * Return the applicable Graphics to use to paint the layers into.     * If the internal BufferedImage hasn't been created yet, or has     * been set to null, then a new buffered Image is created, set to     * the size specified by the height and width. The ImageGenerator     * extends MapBean. Remember to dispose of the graphics object     * when you are done with it. Uses the BufferedImage.TYPE_INT_ARGB     * colormodel.     *      * @param width pixel width of Graphics.     * @param height pixel height of Graphics.     * @return java.awt.Graphics object to use.     * @see java.awt.image.BufferedImage     */    public java.awt.Graphics getGraphics(int width, int height) {        return getGraphics(width, height, BufferedImage.TYPE_INT_ARGB);    }        public String getContentType() {        return HttpConnection.CONTENT_GIF;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?