App
SetLayerOpacityCommand.java
Go to the documentation of this file.
1 package mhr.appcore.commands.imagecommands;
2 
3 import mhr.appcore.AppCore;
4 import mhr.appcore.commands.AppCommand;
5 import mhr.appcore.image.ImageSelectedState;
6 
12 public class SetLayerOpacityCommand extends AppCommand {
13 
14  protected int id;
15  protected double opacity;
16 
22  public SetLayerOpacityCommand(int id, double opacity) {
23  this.opacity = opacity;
24  this.id = id;
25  }
26 
27  @Override
28  protected void action(AppCore target) {
29  synchronized (this) {
30  target.getRenderer().susepnd(this); // možná zbytečné...
31  try {
32  this.wait();
33  } catch (InterruptedException e) {
34  }
35  try {
36  target.getImg().setLayerOpacity(id, opacity);
37  } finally {
38  target.getRenderer().wake(this);
39  target.getRenderer().renderOnThisThread(); // Optimalizovat, jake se bude volat renderovani, rozhoduje o tom RenderingTask
40  }
41  }
42 
43  }
44 
45 }