我想在JMapFrame中提高渲染质量
this.Map = new MapContent();
this.MainWindow = new JMapFrame(this.Map);
// rendering START
GTRenderer renderer = this.MainWindow.getMapPane().getRenderer();
java.util.Map<Object, Object> hints = renderer.getRendererHints();
hints.put(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
hints.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
hints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
hints.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
hints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
renderer.setRendererHints(hints);
this.MainWindow.getMapPane().setRenderer(renderer);
// rendering END
在有或没有代码的情况下,渲染质量没有差异 //呈现START 和 //呈现END
答案 0 :(得分:0)
您似乎将Java2D提示传递给渲染器而不是Graphic。来自JavaDocs
Rectangle paintArea = new Rectangle(width, height);
ReferencedEnvelope mapArea = map.getBounds();
renderer = new StreamingRenderer();
renderer.setContext(map);
RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
renderer.setJava2DHints(hints);
Map rendererParams = new HashMap();
rendererParams.put("optimizedDataLoadingEnabled",new Boolean(true) );
renderer.setRendererHints( renderParams );
renderer.paint(graphic, paintArea, mapArea);
答案 1 :(得分:0)
工作代码
GTRenderer renderer = this.MainWindow.getMapPane().getRenderer();
RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
hints.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
hints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
hints.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
hints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
renderer.setJava2DHints(hints);
this.MainWindow.getMapPane().setRenderer(renderer);