package com.torn.tools;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;


/* 中心を移動をさせたGraphicsを管理する */
public class MyGraphics2D {

	private static MyGraphics2D instance = new MyGraphics2D();
	private Graphics2D g2;
	
	private MyGraphics2D() {
	}
	/* setToTranslation使えばよいかも */
	public void registGraphics(Graphics g, int offsetX, int offsetY) {
		
		this.g2 = (Graphics2D)g;	
		AffineTransform affine = new AffineTransform(1, 0, 0, 1, offsetX, offsetY);
		this.g2.setTransform(affine);
	}
	
	public static MyGraphics2D getInstance() {
		return instance;
	}
	
	public void setColor(Color c) {
		g2.setColor(c);
	}
	
	public void fillOval(int x, int y, int width, int height) {
		g2.fillOval(x, y, width, height);
	}
	public void drawOval(int x, int y, int width, int height) {
		g2.drawOval(x, y, width, height);
	}
}
