Solved

How to create a WaveImageFilter .

Posted on 2001-06-15
5
203 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 100 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
web services creation SOAP vs REST 5 41
xampp tool 12 50
reverse digits of a number using for loop 5 41
Detect Closed Loops (circles, figure-8s, etc) in PNG Images 6 33
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…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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.

778 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