Solved

How to create a WaveImageFilter .

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now