Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to create a WaveImageFilter .

Posted on 2001-06-15
5
Medium Priority
?
229 Views
Last Modified: 2010-03-31
Somebody know how to implements undersurface shadow effect like follow link show ,

http://ns.strategicstaff.lt/~monarch/java/edu/ImageEffect/test.html

thanks.
0
Comment
Question by:bruce_luo
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:Sasha_Mapa
ID: 6195598
I have written my own version of the lake effect, I've just put the source code for download from http://www.hightemplar.com/sasha/lakeeffect.zip

Sasha Maryanovsky.
0
 

Author Comment

by:bruce_luo
ID: 6197300
public class LakeTest extends Applet
{
     /**
      * This method is called when the applet is created.
      */
     private LakeComponent wave = null ;
     private Image img = null ;
     
     public void init()
     {
         
          MediaTracker mt = new MediaTracker(this) ;
          try {
               img = this.getImage(this.getCodeBase(), "java.gif") ;
               mt.addImage(img, 0) ;
               mt.waitForID(0) ;
          }
          catch (Exception e) {
               e.printStackTrace() ;
          }
         
          int w = img.getWidth(this) ;
          int h = img.getHeight(this) ;
         
         
          wave = new LakeComponent(img) ;
          this.setLayout(null) ;
          this.add(wave) ;
          wave.setBounds(w + 20, 0, w, h) ;
          wave.createAnimation() ;
          wave.startAnimation() ;
     }
     
     public void paint(Graphics g)
     {
          g.drawImage(img, 0, 0, this) ;
     }
     
     public void update(Graphics g)
     {
          paint(g) ;
     }    
}

    The wave Object isn't work, the object always display a same picture at Applet . Some parameter need config ? Something wrong ?

regards,
Bruce
0
 

Author Comment

by:bruce_luo
ID: 6197306
public class LakeTest extends Applet
{
     /**
      * This method is called when the applet is created.
      */
     private LakeComponent wave = null ;
     private Image img = null ;
     
     public void init()
     {
         
          MediaTracker mt = new MediaTracker(this) ;
          try {
               img = this.getImage(this.getCodeBase(), "java.gif") ;
               mt.addImage(img, 0) ;
               mt.waitForID(0) ;
          }
          catch (Exception e) {
               e.printStackTrace() ;
          }
         
          int w = img.getWidth(this) ;
          int h = img.getHeight(this) ;
         
         
          wave = new LakeComponent(img) ;
          this.setLayout(null) ;
          this.add(wave) ;
          wave.setBounds(w + 20, 0, w, h) ;
          wave.createAnimation() ;
          wave.startAnimation() ;
     }
     
     public void paint(Graphics g)
     {
          g.drawImage(img, 0, 0, this) ;
     }
     
     public void update(Graphics g)
     {
          paint(g) ;
     }    
}

    The wave Object isn't work, the object always display a same picture at Applet . Some parameter need config ? Something wrong ?

regards,
Bruce
0
 
LVL 7

Accepted Solution

by:
Sasha_Mapa earned 400 total points
ID: 6197722
LakeComponent displays a vertical reflection of the image, so you need to make it twice taller than the image, not the same height.

Sasha Maryanovsky.
0
 

Author Comment

by:bruce_luo
ID: 6200647
perfect source. thanks,

Bruce
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question