@Override
	public void initialize(URL location, ResourceBundle resources) {
		mLock = new ReentrantLock();
		model = CGService.getInstance();
		EventDispatcher.getInstance().subscribe(this,
				ApplyFilterEvent.class.toString());
		EventDispatcher.getInstance().subscribe(this,
				ChangeEvent.class.toString());
		EventDispatcher.getInstance().subscribe(this,
				CustomFilterEvent.class.toString());
		imageDisplay.addEventHandler(MouseEvent.MOUSE_CLICKED,
				new EventHandler<MouseEvent>() {
					@Override
					public void handle(MouseEvent e) {
						double scaleY = image.getHeight()
								/ imageDisplay.fitHeightProperty()
										.doubleValue();
						scaleY = 1;
						if (mX == -1) {
							if (!mMode.equals("Select")) {
								mX = (int) (e.getX() * scaleY);
								mY = (int) (e.getY() * scaleY);
								if (mMode.equals("Fill")) {
									model.fill(image, mX, mY);
									mX = -1;
								}
							}else
								model.scanline(image, (int)e.getX(), (int)e.getY());
						} else {
							if (mMode.equals("Line")) {
								model.line(image, mX, mY,
										(int) (e.getX() * scaleY),
										(int) (e.getY() * scaleY));
							} else if (mMode.equals("Circle")) {
								model.circle(image, mX, mY,
										(int) (e.getX() * scaleY),
										(int) (e.getY() * scaleY));
							}
							mX = -1;
							//imageDisplay.setImage(model.msaa(image));
							imageDisplay.setImage(image);
						}
					}
				});
	}