dcsimg
proxy object for java.awt.Polygon to support double precision coordinates without heap-creating a Polygon instance all the time
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   nico_lasius
Posted On:   Tuesday, August 15, 2006 09:08 AM

Hi, i search for a possibility to support double precision coordinates for polygons. my approach is like this class PolyProxy { private final CoordinateMapper cm; public PolyProxy(CoordinateMapper cm) { this.cm = cm; } public void paint(Graphics g) { Polygon p = new Polygon(); for(Point pt : polyPoints) { cm.transform(pt); p.addPoint((int)pt.getX(),(int)pt.getY()); } g.drawPolygon(p); } } CoordinateMapper maps the double precision coords to screenspace. How can i avoid instanciating the polygon all the time it is painted? Thanks in advance    More>>

Hi,
i search for a possibility to support double precision coordinates for polygons.
my approach is like this

			
class PolyProxy {
private final CoordinateMapper cm;
public PolyProxy(CoordinateMapper cm) {
this.cm = cm;
}
public void paint(Graphics g) {
Polygon p = new Polygon();
for(Point pt : polyPoints) {
cm.transform(pt);
p.addPoint((int)pt.getX(),(int)pt.getY());
}
g.drawPolygon(p);
}
}

CoordinateMapper maps the double precision coords to
screenspace.

How can i avoid instanciating the polygon all the time it
is painted?
Thanks in advance    <<Less
About | Sitemap | Contact