/Users/lyon/j4p/src/j2d/hpp/GreyHppFilter3Panel.java
|
1 /*
2 * Created by DocJava, Inc.
3 * User: lyon
4 * Date: Mar 2, 2003
5 * Time: 5:12:56 PM
6 */
7 package j2d.hpp;
8
9 import j2d.ImageUtils;
10 import gui.run.RunSlider;
11 import j2d.ImageProcessListener;
12
13 import javax.swing.*;
14 import java.awt.*;
15
16
17 public class GreyHppFilter3Panel
18 extends JPanel {
19 private float ar = 1;
20 private float ag = 1;
21 private float ab = 1;
22 ImageProcessListener ipl = null;
23
24
25 public GreyHppFilter3Panel(ImageProcessListener _ipl) {
26 ipl = _ipl;
27
28 setLayout(new FlowLayout());
29 add(new RunSlider(1, 100, 50) {
30 public void run() {
31 ar = scaleSlider(getValue());
32 updateImage();
33 }
34 });
35 add(new RunSlider(1, 100, 50) {
36 public void run() {
37 ag = scaleSlider(getValue());
38 updateImage();
39 }
40 });
41 add(new RunSlider(1, 100, 50) {
42 public void run() {
43 ab = scaleSlider(getValue());
44 updateImage();
45 }
46 });
47 }
48
49 private void updateImage() {
50 ipl.update(ImageUtils.getLinearCombineBandsProcessor(ar, ag, ab));
51
52 }
53
54 public static float scaleSlider(int t) {
55 return (float) (t / 50f);
56 }
57 }
58