App
LaplaceSharpenFilterLayer.java
Go to the documentation of this file.
1 package mhr.appcore.image.layers.filter;
2 
3 import org.w3c.dom.Document;
4 import org.w3c.dom.Element;
5 
6 import mhr.appcore.bitmap.exceptions.BitmapAllocationException;
7 import mhr.appcore.bitmap.exceptions.UnsupportedBitmapException;
8 import mhr.appcore.filters.Filter;
9 import mhr.appcore.image.Image;
10 import mhr.appcore.image.exceptions.InvalidLayerSpecificPresentationSuppliedException;
11 import mhr.appcore.image.exceptions.LayerCreationException;
12 import mhr.appcore.image.layers.Layer;
13 import mhr.appcore.image.layers.LayerPDInfo;
14 import mhr.appcore.image.layers.LayerType;
15 import mhr.appcore.interfaces.ImageFile;
16 import mhr.appcore.pointops.LUT;
17 import mhr.appcore.pointops.LUTAllocationException;
18 
22 public class LaplaceSharpenFilterLayer extends FilterLayer {
23 
24  //===== INTERFACES, CLASSES, ENUMS ==========================================================================================================//
25  //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
26  //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
27 
28  //===== FIELDS ==============================================================================================================================//
29  //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
30  protected double force = -1;
31  //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
32 
33  //===== CONSTRUCTORS, DESTRUCTORS, RELATED METHODS ==========================================================================================//
34  //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
35  @Override
36  protected void finalize() throws Throwable {
37  dispose();
38  super.finalize();
39  }
40 
41 
43  super(l, newId);
44  this.force = l.force;
45  filter = new Filter();
48  }
49  //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
59  super(owner, id);
60  filter = new Filter();
61  }
62 
64  super(owner, i, f);
65  try {
66  force = Double.parseDouble(i.getElementsByTagName("Force").item(0).getTextContent());
67  } catch (Exception e) {
68  throw new LayerCreationException(e);
69  }
70 
71  filter = new Filter();
73  }
74 
75  @Override
76  public synchronized int dispose() {
77  super.dispose();
78  return 0;
79  }
80 
81  //===== METHODS =============================================================================================================================//
82  //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
83 
84  protected void fillSpecificElement(Document d, ImageFile f, Element e) {
85  appendLeafElement(d, e, "Force", Double.toString(force));
86  }
87 
88  //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
89 
90  @Override
91  public Layer duplicate(int newId) {
92  return new LaplaceSharpenFilterLayer(this, newId);
93  }
94 
95  @Override
96  public LayerType getType() {
98  }
99 
100 
101 //----- Pole --------------------------------------------------------------------------------------------------------------------------------//
102 
103 //----- Accessory a primitivní metody -------------------------------------------------------------------------------------------------------//
104 
105 //----- Pomocné metody ----------------------------------------------------------------------------------------------------------------------//
106 //----- Konstruktory ------------------------------------------------------------------------------------------------------------------------//
107 
108 //----- Destruktory -------------------------------------------------------------------------------------------------------------------------//
109 
110 //----- Metody ------------------------------------------------------------------------------------------------------------------------------//
111 
112  @Override
113  protected void updateSpecificData(LayerPDInfo info) {
115  info.extra = p;
116  }
117 
118  @Override
119  public void updateFromSpecificPresentation(LayerPDInfo presentation) {
120  if (!(presentation.extra instanceof LaplaceSharpenFilterLayerSpecificPresentation)) {
121  throw new InvalidLayerSpecificPresentationSuppliedException("Invalid specific data supplied");
122  }
123  LaplaceSharpenFilterLayerSpecificPresentation p = (LaplaceSharpenFilterLayerSpecificPresentation) presentation.extra;
124  force = p.force;
127  presentation.isChanged = true;
129  }
130 }