@Test
public void testPolygonStyling()
                        throws Exception {

    BufferedImage img = new BufferedImage( 1000, 1000, TYPE_INT_ARGB );
    long time = currentTimeMillis();
    Graphics2D g = img.createGraphics();
    GeometryFactory geomFac = new GeometryFactory();
    Java2DRenderer r = new Java2DRenderer( g, img.getWidth(), img.getHeight(),
                                           geomFac.createEnvelope( new double[] { 0, 0 },
                                                                   new double[] { 5000d, 5000d }, mapcs ) );
    List<Surface> polygons = new LinkedList<Surface>();
    for ( int i = 0; i < 10; ++i ) {
        //polygons.add( randomQuad( 500, i * 500, 0 ) );
        polygons.add( testPolygon( 100 + i * 480, 100, 300, 250 ) );
    }
    PolygonStyling styling = new PolygonStyling();
    styling.fill = new Fill();
    styling.stroke = new Stroke();
    styling.stroke.color = black;
    for ( int y = 0; y < 10; ++y ) {
        if ( y == 0 ) {
            styling.fill.graphic = new Graphic();
            styling.fill.graphic.image = fill;
        } else {
            styling.fill.graphic = null;
        }
        styling.fill.color = new Color( 25 * y, 0, 0 );
        Iterator<Surface> surface = polygons.iterator();
        for ( int x = 0; x < 10; ++x ) {
            styling.stroke.width = x;
            Surface polygon = (Surface) move( surface.next(), 0, ( 9 - y ) * 500 );
            r.render( styling, polygon );
        }
    }
    g.dispose();
    long time2 = currentTimeMillis();
    List<String> texts = new LinkedList<String>();
    texts.add( "first line: polygon style with black lines with line width 0, 1, ..., 9 and external image fill" );
    texts.add( "other lines: polygon style with black lines with line width 0, 1, ..., 9 and increasingly red fill" );
    validateImage( img, time2 - time, "polygonstyling" );
}