App
DrawEndCommand.java
Go to the documentation of this file.
1 package mhr.appcore.commands.toolcommands;
2 
3 import mhr.appcore.AppCore;
4 import mhr.appcore.commands.AppCommand;
5 import mhr.appcore.tools.actiondata.BrushLikeToolActionData;
6 import mhr.appcore.tools.actiondata.BrushLikeToolActionData.Action;
7 
13 public class DrawEndCommand extends AppCommand {
14 
16 
22  public DrawEndCommand(int x, int y) {
23  data = new BrushLikeToolActionData(Action.DRAW_END, x, y);
24  }
25 
26  @Override
27  public void action(AppCore target) {
28  synchronized (this) {
29  target.getRenderer().susepnd(this);
30  try {
31  this.wait();
32  } catch (InterruptedException e) {
33  }
34  try {
35  target.getTool().applyTo(target.getImg(), data);
36  } finally {
37  target.getRenderer().wake(this);
38  target.getRenderer().render(); // Optimalizovat, jake se bude volat renderovani, rozhoduje o tom RenderingTask
39  }
40  }
41  }
42 
43 }