Solved

How to create a WaveImageFilter .

Posted on 2001-06-15
5
215 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 124
hibernate jars 4 57
Eclipse with various Java releases 7 44
Java array sort 10 29
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

740 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