package de.gurkenlabs.litiengine.graphics;

import java.awt.BasicStroke;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;

public final class ShapeRenderer {
  public static final Stroke DEFAULT_STROKE = new BasicStroke(1);

  private ShapeRenderer() {
  }

  public static void render(final Graphics2D g, final Shape shape) {
    g.fill(shape);
  }

  public static void render(final Graphics2D g, final Shape shape, double x, double y) {
    g.translate(x, y);
    render(g, shape);
    g.translate(-x, -y);
  }

  public static void render(final Graphics2D g, final Shape shape, Point2D location) {
    render(g, shape, location.getX(), location.getY());
  }

  public static void renderOutline(final Graphics2D g, final Shape shape) {
    renderOutline(g, shape, DEFAULT_STROKE);
  }

  public static void renderOutline(final Graphics2D g, final Shape shape, final float stroke) {
    renderOutline(g, shape, new BasicStroke(stroke));
  }

  public static void renderOutline(final Graphics2D g, final Shape shape, final Stroke stroke) {
    final Stroke oldStroke = g.getStroke();
    g.setStroke(stroke);
    g.draw(shape);
    g.setStroke(oldStroke);
  }

  public static void renderTransformed(final Graphics2D g, final Shape shape, AffineTransform transform) {
    final AffineTransform oldTransForm = g.getTransform();
    g.setTransform(transform);
    render(g, shape);
    g.setTransform(oldTransForm);
  }

  public static void renderOutlineTransformed(final Graphics2D g, final Shape shape, AffineTransform transform) {
    renderOutlineTransformed(g, shape, transform, DEFAULT_STROKE);
  }

  public static void renderOutlineTransformed(final Graphics2D g, final Shape shape, AffineTransform transform, final Stroke stroke) {
    final AffineTransform oldTransForm = g.getTransform();
    g.setTransform(transform);
    renderOutline(g, shape, stroke);
    g.setTransform(oldTransForm);
  }
}

@@ -523,24 +523,77 @@
 double y) %7B%0A
+    AffineTransform oldTransform = g.getTransform();%0A
     g.transl
@@ -635,24 +635,33 @@
   g.
-translate(-x, -y
+setTransform(oldTransform
 );%0A 
@@ -1475,36 +1475,33 @@
 nsform();%0A    g.
-setT
+t
 ransform(transfo
@@ -1944,36 +1944,33 @@
 nsform();%0A    g.
-setT
+t
 ransform(transfo

Improve the ShapeRenderer class