001package myproject.model.swing;
002
003import java.awt.Graphics;
004
005/**
006 * Static class for drawing using a Translation.
007 */
008class XGraphics {
009        private XGraphics() {}
010        static void clearRect(Graphics g, Translator t, double x, double y, double w, double h) {
011                g.clearRect(t.getX(x,y,w,h), t.getY(x,y,w,h), t.getWidth(w,h), t.getHeight(w,h));
012        }
013        static void drawOval(Graphics g, Translator t, double x, double y, double w, double h) {
014                g.drawOval(t.getX(x,y,w,h), t.getY(x,y,w,h), t.getWidth(w,h), t.getHeight(w,h));
015        }
016        static void drawRect(Graphics g, Translator t, double x, double y, double w, double h) {
017                g.drawRect(t.getX(x,y,w,h), t.getY(x,y,w,h), t.getWidth(w,h), t.getHeight(w,h));
018        }
019        static void fillOval(Graphics g, Translator t, double x, double y, double w, double h) {
020                g.fillOval(t.getX(x,y,w,h), t.getY(x,y,w,h), t.getWidth(w,h), t.getHeight(w,h));
021        }
022        static void fillRect(Graphics g, Translator t, double x, double y, double w, double h) {
023                g.fillRect(t.getX(x,y,w,h), t.getY(x,y,w,h), t.getWidth(w,h), t.getHeight(w,h));
024        }
025        static void drawString(Graphics g, Translator t, String str, double x, double y) {
026                g.drawString(str, t.getX(x,y,0,0), t.getY(x,y,0,0));
027        }
028}