i resolved the image problem usging this code now it's very good
public BufferedImage getBufferedImage() throws Exception{
final Map<RenderingHints.Key, Object> hintsMap = new
HashMap<RenderingHints.Key, Object>();
hintsMap.put(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
hintsMap.put(JAI.KEY_INTERPOLATION, NN_INTERPOLATION);
hintsMap.put(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
hintsMap.put(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_NORMALIZE);
hintsMap.put(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
GTRenderer renderer = new StreamingRenderer();
renderer.setContext(map);
Rectangle imageBounds = null;
int imageWidth = 800;
int imageHeigth = 600;
imageBounds = new Rectangle(
0, 0, imageWidth, imageHeigth);
BufferedImage image = new
BufferedImage(imageBounds.width,imageBounds.height,
BufferedImage.TYPE_3BYTE_BGR);
Graphics2D g2 = image.createGraphics();
g2.setColor(new Color(252,255,173));
g2.fillRect(0, 0,800,600);
RenderingHints hints = new RenderingHints(hintsMap);
renderer.setJava2DHints(hints);
renderer.paint(g2, imageBounds, map.getAreaOfInterest());
return image;
}
public BufferedImage getBufferedTransaparent(){
final Map<RenderingHints.Key, Object> hintsMap = new
HashMap<RenderingHints.Key, Object>();
hintsMap.put(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
hintsMap.put(JAI.KEY_INTERPOLATION, NN_INTERPOLATION);
hintsMap.put(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
hintsMap.put(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_NORMALIZE);
hintsMap.put(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
GTRenderer renderer = new StreamingRenderer();
renderer.setContext(map);
Rectangle imageBounds = null;
int imageWidth = 800;
int imageHeigth = 600;
imageBounds = new Rectangle(
0, 0, imageWidth, imageHeigth);
BufferedImage image = new
BufferedImage(imageBounds.width,imageBounds.height,
BufferedImage.TYPE_4BYTE_ABGR);
Graphics2D g2 = image.createGraphics();
int type = AlphaComposite.SRC;
g2.setComposite(AlphaComposite.getInstance(type));
Color c = new Color(255,255,255, 0);
g2.setBackground(c);
g2.setColor(c);
g2.fillRect(0, 0,800,600);
type = AlphaComposite.SRC_OVER;
g2.setComposite(AlphaComposite.getInstance(type));
RenderingHints hints = new RenderingHints(hintsMap);
renderer.setJava2DHints(hints);
renderer.paint(g2, imageBounds, map.getAreaOfInterest());
return image;
}
--
View this message in context:
http://n2.nabble.com/IMAGE-QUALITY-STYLE-tp4539813p4556307.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users