📄 gifmapproducer.java
字号:
/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
* This code is licensed under the GPL 2.0 license, availible at the root
* application directory.
*/
package org.vfny.geoserver.wms.responses.map.gif;
import org.geotools.image.ImageWorker;
import org.vfny.geoserver.global.WMS;
import org.vfny.geoserver.wms.WmsException;
import org.vfny.geoserver.wms.responses.DefaultRasterMapProducer;
import java.awt.image.RenderedImage;
import java.io.IOException;
import java.io.OutputStream;
/**
* Handles a GetMap request that spects a map in GIF format.
*
* @author Didier Richard
* @author Simone Giannecchini - GeoSolutions
* @version $Id
*/
public final class GIFMapProducer extends DefaultRasterMapProducer {
public GIFMapProducer(String format, WMS wms) {
super(format, wms);
}
/**
* Transforms the rendered image into the appropriate format, streaming to
* the output stream.
* @param image
* The image to be formatted.
* @param outStream
* The stream to write to.
*
* @throws WmsException
* not really.
* @throws IOException
* if encoding to <code>outStream</code> fails.
*/
public void formatImageOutputStream(RenderedImage originalImage, OutputStream outStream)
throws WmsException, IOException {
// /////////////////////////////////////////////////////////////////
//
// Now the magic
//
// /////////////////////////////////////////////////////////////////
new ImageWorker(super.forceIndexed8Bitmask(originalImage)).writeGIF(outStream, "LZW", 0.75f);
}
public String getContentDisposition() {
// can be null
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -