水波纹特效

来源:互联网 发布:下载pdf软件 编辑:程序博客网 时间:2024/04/28 02:50


算法原理:
从一个能量源出发,每此绘图周期中,波形向四周扩张,可以证明,扩张的过程可以简单的认为能量扩散到相邻的四个点。
t2[x,y] = ((t1[x-1,y]+t1[x,y-1]+t1[x+1,y]+t1[x,y+1])/2)-t2[x,y];
再考虑衰减:
t2[x,y] -= (t2[x,y]>>5);
之后根据每个点能量值,直接换算成像素偏移量,新一帧的图像就得到了:
x2=(x1-width/2)*(1024-t2[x,y])/1024+width/2
y2=(y1-height/2)*(1024-t2[x,y])/1024+height/2
pixel(x2,y2)=pixel(x1,y1)


void CHrdView::DDRipple()
{
        LPDIRECTDRAW            lpDD;           
        LPDIRECTDRAWSURFACE     lpDDSPrimary;   
        LPDIRECTDRAWSURFACE     lpDDSPic1;      

        LPDIRECTDRAWSURFACE     lpDDSPic2;      

        LPDIRECTDRAWCLIPPER             lpClipper;      


    DDSURFACEDESC       ddsd;
    HRESULT             ddrval;       


        ddrval = DirectDrawCreate( NULL, &lpDD, NULL );
    if( ddrval != DD_OK )
        return;
    ddrval = lpDD->SetCooperativeLevel(NULL, DDSCL_NORMAL);
    if( ddrval != DD_OK )
        return;

    ddsd.dwSize = sizeof( ddsd );
    ddsd.dwFlags = DDSD_CAPS ;
    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;

    ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL );
    if( ddrval != DD_OK )
       return;

    ZeroMemory(&ddsd, sizeof(ddsd));
    ddsd.dwSize = sizeof(ddsd);

    ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH;
    ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN |DDSCAPS_SYSTEMMEMORY ;
        ddsd.dwWidth  = 400;
    ddsd.dwHeight = 500;

    if (lpDD->CreateSurface(&ddsd, &lpDDSPic1, NULL) != DD_OK)
                return;

    if (lpDD->CreateSurface(&ddsd, &lpDDSPic2, NULL) != DD_OK)
                return;

        lpDD->CreateClipper(0, &lpClipper, NULL);
        lpClipper->SetHWnd(0, GetSafeHwnd());
        lpDDSPrimary->SetClipper(lpClipper);

    lpDDSPic1->Restore();
        CDC memDc;
//      CBitmap bitMap, *oldBmp;
    int dx = 400;
    int dy = 500;
        HRESULT hr;
        HDC hdc;

    if ((hr = lpDDSPic1->GetDC(&hdc)) == DD_OK)
    {
                BitBlt(hdc, 0, 0, dx, dy, GetDC()->GetSafeHdc(), 0, 0, SRCCOPY);
                lpDDSPic1->ReleaseDC(hdc);
    }

    if ((hr = lpDDSPic2->GetDC(&hdc)) == DD_OK)
    {
                BitBlt(hdc, 0, 0, dx, dy, GetDC()->GetSafeHdc(), 0, 0, SRCCOPY);
                lpDDSPic2->ReleaseDC(hdc);
    }

    int * b1 = new int[dx*dy];
    int * b2 = new int[dx*dy];
    ZeroMemory(b1, dx*dy*sizeof(int));
    ZeroMemory(b2, dx*dy*sizeof(int));

//      CBitmap bmp, bm2, *od2, *oldbmp;
        CDC memdc, mem2;
        {
                int * t1, * t2;
                int kt, k1, j1, n;
                POINT   pt, ptOld = {-1, -1};
                RECT Window;
                int nsrc = 0, nSwap = 0, nCount = 0;

                while(nInd==1)

                {
                        GetCursorPos(&pt);
                        ScreenToClient(&pt);
                        GetWindowRect(&Window);

                        if((ptOld.x != pt.x || ptOld.y != pt.y) && pt.x>0 && pt.x<399 
                                && pt.y>0 && pt.y<499)
                        {
                                b1[pt.x+pt.y*400] = 310;
                                b1[pt.x+pt.y*400-1] = 310*.444;
                                b1[pt.x+pt.y*400+1] = 310*.444;
                                b1[pt.x+pt.y*400+400] = 310*.444;
                                b1[pt.x+pt.y*400-400] = 310*.444;
                                ptOld = pt;
                        }


                        nCount++;

                        if(nCount > 32) { nsrc--; nCount=0;}


                        if(nSwap) 
                        {

                                t1 = b1; t2 = b2;

                        }
                        else
                        {
                                t1 = b2; t2 = b1;
                        }


                        nSwap = (nSwap)?0:1;
                        DDSURFACEDESC ddsd1, ddsd2;
                        ddsd1.dwSize = sizeof (DDSURFACEDESC);
                        ddsd2.dwSize = sizeof(DDSURFACEDESC);
                        lpDDSPic1->Lock(NULL, &ddsd1, DDLOCK_WAIT, NULL);
                        lpDDSPic2->Lock(NULL, &ddsd2, DDLOCK_WAIT, NULL);

                        int depth=ddsd1.ddpfPixelFormat.dwRGBBitCount/8;
                        BYTE *Bitmap1 = (BYTE*)ddsd1.lpSurface;

                        BYTE *Bitmap2 = (BYTE*)ddsd2.lpSurface;


                        for(n=400; n<400*500-400; n++)
                        {
                                t2[n] = ((t1[n-400]+t1[n-1]+t1[n+400]+t1[n+1])/2)-t2[n];
                                t2[n] -= (t2[n]>>5);
                                kt = 1024 - t2[n];
                                k1 = n%400;
                                j1 = n/400;
                                int l = ((k1 - 200) * kt >> 10) + 200;
                                if(l >= 400 || l < 0)
                                        l = 0;
                                int i1 = ((j1 - 250) * kt >> 10) + 250;
                                if(i1 >= 500 || i1 < 0)
                                        i1 = 0;

                                int pos1, pos2;
                                pos1=ddsd1.lPitch*(i1)+ depth*(l);
                                pos2=ddsd2.lPitch*j1+ depth*k1;

                                memcpy(Bitmap2+pos2, Bitmap1+pos1, depth);
                        }


                        lpDDSPic1->Unlock(&ddsd1);
                        lpDDSPic2->Unlock(&ddsd2);
                        lpDDSPrimary->Blt(&Window, lpDDSPic2, NULL, DDBLT_WAIT, NULL);
                        Sleep(5);
                }
        }       


    if( lpDD != NULL )//释放DirectDraw对象
    {
        if( lpDDSPrimary != NULL )//释放主页面。
        {
            lpDDSPrimary->Release();
            lpDDSPrimary = NULL;
        }

        if( lpDDSPic1 != NULL )//释放离屏页面。
        {
            lpDDSPic1->Release();
            lpDDSPic1 = NULL;
        }

        if( lpDDSPic2 != NULL )
        {
            lpDDSPic2->Release();
            lpDDSPic2 = NULL;
        }
                if (lpClipper!=NULL)
                {
                        lpClipper->Release();
                        lpClipper=NULL;
                }

        lpDD->Release();
        lpDD = NULL;
    }

        delete b1;
        delete b2;
}



以上的算法是从anfy java软件中得到的,故在此也给出反编译anfy water特效的代码:


// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3)
// Source File Name:   AnWater.java


import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*;
import java.awt.image.*;
import java.io.*;

import java.net.MalformedURLException;
import java.net.URL;

public class AnWater extends Applet
implements Runnable, ImageObserver
{
    public AnWater()
    {
        R = false;
        bV = 1;
        d = -0.59999999999999998D;
        v = false;
        bz = false;
        e = false;
        bU = false;
        bs = false;
    }


    private final void a()
    {
        do
        {
            showStatus("Don't remove www.anfyjava.com credits line in HTML!");
            try
            {
                Thread.sleep(500L);
            }
            catch(InterruptedException _ex) { }
        } while(true);
    }

    public synchronized boolean b()
    {
        prepareImage(bC, this);
        if(R)
        {
            for(int i1 = 0; i1 < 3; i1++)
            {
                notifyAll();
                Thread.yield();
                try
                {
                    Thread.sleep(100L);
                }
                catch(InterruptedException _ex) { }
            }

            return bz;

        } 

else

        {
            return false;
        }
    }

    final void c()
    {
        float f1 = bH;
        float af[];
        if(M == 1)
            af = J;
        else

            af = I;


        byte byte0 = -2;
        float f2 = 0.0F;
        bM = 6 + (int)(Math.random() * (double)cG) % (cG - 12);
        bN = 6 + (int)(Math.random() * (double)H) % (H - 14);
        for(int i1 = -2; i1 < 3; i1++)
            for(cK = 0; cK < H; cK++)
            {
                if(i1 == 0)
                    f2 = f1;
                else
                    if(i1 == 1)
                        f2 = f1 / 2.0F;
                    else
                        if(i1 == 2)
                            f2 = f1 / 4F;
                        else
                            if(i1 == -1)
                                f2 = f1 / 2.0F;
                            else
                                if(i1 == -2)
                                    f2 = f1 / 4F;
                af[cG * cK + bM + i1] += f2;
            }

        for(int j1 = -2; j1 < 3; j1++)
            for(cI = 0; cI < cG; cI++)
            {
                if(j1 == 0)
                    f2 = f1;
                else
                    if(j1 == 1)
                        f2 = f1 / 2.0F;
                    else
                        if(j1 == 2)
                            f2 = f1 / 4F;
                        else
                            if(j1 == -1)
                                f2 = f1 / 2.0F;
                            else
                                if(j1 == -2)
                                    f2 = f1 / 4F;
                af[cG * (bN + j1) + cI] += f2;
            }
    }

    public void destroy()
    {
        if(bC != null)
            bC.flush();
        bC = null;
        if(bx != null)
            bx.flush();
        bx = null;
        if(bw != null)
            bw.dispose();

        bw = null;


        System.gc();

    }


    final synchronized void a(int i1)
    {
        i1++;
        float f1 = bH;
        float af[];
        if(M == 1)
            af = J;
        else
            af = I;
        float f3 = (float)i1 - 1.5F;
        cI = C;
        cK = D;
        if(i1 == 2)
        {
            af[cG * cK + cI] = (float)(int)(Math.random() * (double)f1) % f1;
            return;
        }
        bW = i1 * i1;
        float f2 = f3 * f3;
        float f4 = (float)bW - f2;
        for(q = -i1; q < i1; q++)
        {
            r = q * q;
            for(p = -i1; p < i1; p++)
            {
                int j1 = p * p + r;
                if(j1 < bW)
                    if((float)j1 > f2)
                    {
                        float f5 = (float)j1 - f2;

                        f5 /= f4;

                        af[cG * (q + cK) + (p + cI)] += f1 - f5 * f1;

                    } 

    else

                    {
                        af[cG * (q + cK) + (p + cI)] += f1;
                    }

            }
        }

    }


    Image a(String s1)
    {
        try
        {
            return b(s1);
        }
        catch(NoSuchMethodError _ex)
        {
            return b(s1);
        }
    }


    synchronized Image b(String s1)
    {
        URL url = null;
        Image image = null;
        try
        {
            url = new URL(getDocumentBase(), s1);
        }
        catch(MalformedURLException _ex) { }

        try
        {
            try
            {
                InputStream inputstream = getClass().getResourceAsStream(url.toString());
                if(inputstream != null)
                {
                    ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(1024);
                    byte abyte0[] = new byte[512];
                    boolean flag = false;
                    byte abyte1[] = null;
                    try
                    {
                        while(!flag)
                        {
                            int k1 = inputstream.read(abyte0, 0, 512);
                            if(k1 != -1)
                            {
                                bytearrayoutputstream.write(abyte0, 0, k1);
                                bytearrayoutputstream.flush();
                            } else
                            {
                                flag = true;
                            }
                        }

                        abyte1 = bytearrayoutputstream.toByteArray();
                        bytearrayoutputstream.close();
                        inputstream.close();
                    }
                    catch(IOException _ex)
                    {
                        abyte1 = null;
                    }
                    System.gc();
                    if(abyte1 != null)
                    {
                        image = getToolkit().createImage(abyte1);
                        prepareImage(image, this);
                    }
                }
            }
            catch(NoSuchMethodError _ex) { }
        }
        catch(SecurityException _ex) { }

        if(image == null)
        {
            for(int i1 = 0; i1 < 5;)

                try

                {



                    if(i1 % 2 == 0)


                        image = Toolkit.getDefaultToolkit().getImage(url);


                    else


                        image = getImage(url);


                    i1++;


                    MediaTracker mediatracker = new MediaTracker(this);


                    notifyAll();


                    Thread.currentThread();


                    Thread.yield();


                    try
                    {
                        mediatracker.addImage(image, 0);
                        mediatracker.waitForID(0);
                    }
                    catch(InterruptedException _ex)
                    {
                        image = null;
                    }


                    if(mediatracker.isErrorID(0))
                        image = null;
                    else
                        i1 = 6;
                }
            catch(NullPointerException _ex)
            {
                System.gc();
            }
        }


        if(image == null)
        {
            for(int j1 = 0; j1 < 25; j1++)
            {
                showStatus("Image " + s1 + " not found!");
                try
                {
                    Thread.currentThread();
                    Thread.sleep(250L);
                }
                catch(InterruptedException _ex) { }
            }
        } else
        {
            while(image.getWidth(this) < 0)
            {
                notifyAll();
                Thread.currentThread();
                Thread.yield();
                try
                {
                    Thread.currentThread();
                    Thread.sleep(100L);
                }
                catch(InterruptedException _ex) { }
            }
        }
        return image;
    }

    public void a(String s1, int i1)
    {
        try
        {
            b(s1, i1);
            return;
        }
        catch(NoSuchMethodError _ex)
        {
            b(s1, i1);
        }
    }

    public void b(String s1, int i1)
    {
        try
        {
            URL url = new URL(getDocumentBase(), s1);
            try
            {
                DataInputStream datainputstream = new DataInputStream(url.openStream());
                if(datainputstream != null)
                {
                    ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(1024);
                    byte abyte0[] = new byte[512];
                    boolean flag = false;
                    int k1 = 0;
                    boolean flag1 = false;
                    try
                    {
                        while(!flag1)
                        {
                            int j1 = datainputstream.read(abyte0, 0, 512);
                            if(j1 == -1)
                            {
                                flag1 = true;
                            } else
                            {
                                bytearrayoutputstream.write(abyte0, 0, j1);
                                bytearrayoutputstream.flush();
                                k1 += j1;
                            }
                        }

                        byte abyte1[] = bytearrayoutputstream.toByteArray();
                        bytearrayoutputstream.close();
                        bytearrayoutputstream = null;
                        datainputstream.close();

                        System.gc();


                        if(i1 == 0)
                        {
                            for(int l1 = 0; l1 < k1; l1++)
                            {
                                byte byte0 = abyte1[l1];
                                if(byte0 == 13 || byte0 == 10)
                                    abyte1[l1] = 32;
                            }

                            try
                            {
                                bX = new String(abyte1);
                                return;
                            }
                            catch(NoSuchMethodError _ex)
                            {
                                bX = new String(abyte1, 0);
                            }
                            return;
                        }

                        int i2 = 1;
                        for(int j2 = 0; j2 < k1; j2++)
                            if(abyte1[j2] == 10)
                                i2++;

                        U = new String[i2 - 1];
                        int ai[] = new int[i2 + 1];
                        int ai1[] = new int[i2 + 1];
                        ai[0] = 0;
                        int k2 = 0;

                        int l2 = 0;


                        for(int i3 = 0; i3 < k1; i3++)
                        {
                            byte byte1 = abyte1[i3];
                            if(byte1 == 10)
                            {
                                ai[k2 + 1] = i3 + 1;
                                if(l2 == 13)
                                    ai1[k2] = i3 - ai[k2] - 1;
                                else
                                    ai1[k2] = i3 - ai[k2];

                                k2++;
                            }

                            l2 = byte1;
                        }

                        ai1[k2] = k1 - ai[k2 + 1] - 1;
                        try
                        {
                            for(int j3 = 0; j3 < i2 - 1; j3++)
                                try
                                {
                                    U[j3] = new String(abyte1, ai[j3], ai1[j3]);
                                }
                            catch(NoSuchMethodError _ex)
                            {
                                U[j3] = new String(abyte1, 0, ai[j3], ai1[j3]);
                            }
                            return;
                        }
                        catch(StringIndexOutOfBoundsException _ex)
                        {
                            U = null;
                        }
                        return;
                    }
                    catch(IOException _ex)
                    {
                        return;
                    }
                }
            }
            catch(IOException _ex)
            {
                return;
            }
        }
        catch(MalformedURLException _ex) { }
    }

    public void a(Graphics g1)
    {
        g1.setFont(E);
        if(a == 0)
        {
            cL = cM;
        } else
        {
            Q += cx;
            cL = cM - (int)Math.abs((double)a * Math.sin(((double)Q / 90D) * 3.1415926535897931D));
        }

        if(cd != 0)
        {
            for(int i1 = 0; i1 < cz; i1++)
            {
                int k1 = ci[cc + i1];
                g1.copyArea(i1, k1, 1, cf, 0, bS - k1);
            }

            if(ct)
            {
                g1.setColor(cb);
                g1.drawString(bX, cJ + 1, bS + bY + 1);
            }

            g1.setColor(cp);
            g1.drawString(bX, cJ, bS + bY);
            for(int j1 = 0; j1 < cz; j1++)
                g1.copyArea(j1, bS, 1, cg, 0, cj[cc + j1]);

            cc -= ch;
            if(cc < 0)
                cc += 360;
        } else
        {
            if(ct)
            {
                g1.setColor(cb);
                g1.drawString(bX, cJ + 1, cL + 1);
            }

            g1.setColor(cp);
            g1.drawString(bX, cJ, cL);
        }

        cJ -= cy;
        if(cJ < -bZ)
            cJ = cz;
    }

    public boolean imageUpdate(Image image, int i1, int j1, int k1, int l1, int i2)
    {
        if(image == bC)
        {
            if(i1 == 16)
                bz = true;
            return true;
        } else
        {
            return true;
        }
    }


    public void init()
    {
        setLayout(null);
        addNotify();
        cu = getToolkit();
        co = getParameter("statusmsg");
        String s1 = null;
        s1 = getParameter("credits");
        if(s1 != null)
        {
            if(!s1.startsWith("Applet by Fabio Ciucci (www.anf"))
                a();
        } else
        {
            a();

        }


        String s2 = null;

        String s3 = null;
        try
        {
            s2 = getDocumentBase().getProtocol();
        }
        catch(SecurityException _ex)
        {
            s2 = "file";
        }

        try
        {
            s3 = getDocumentBase().getHost();
        }
        catch(SecurityException _ex)
        {
            s3 = "";
        }

        if(s2.equalsIgnoreCase("file") || s3.length() == 0 || s3.equalsIgnoreCase("localhost") || s3.equals("127.0.0.1"))
        {
            bU = true;
        } else
        {
            if(s3.startsWith("www."))
                s3 = s3.substring(4);
            String s4 = null;
            s4 = getParameter("regcode");
            if(s4 != null && !s4.equals("NO") && s4.length() > 10)
            {
                int i1 = 1;

                try
                {
                    for(int j1 = 0; j1 < s4.length(); j1++)
                        if(s4.charAt(j1) == '+')
                            i1++;
                }
                catch(StringIndexOutOfBoundsException _ex) { }

                int ai[] = new int[i1];
                if(i1 == 1)
                {
                    ai[0] = s4.length();
                } else
                {
                    int k1 = 0;
                    try
                    {
                        for(int l1 = 0; l1 < s4.length(); l1++)
                            if(s4.charAt(l1) == '+')
                            {
                                ai[k1] = l1;
                                k1++;
                            }
                    }
                    catch(StringIndexOutOfBoundsException _ex) { }
                    ai[k1] = s4.length();
                }


                String as[] = new String[i1];
                int i2 = 0;
                for(int j2 = 0; j2 < i1; j2++)
                {
                    try
                    {
                        as[j2] = s4.substring(i2, ai[j2]);
                    }
                    catch(StringIndexOutOfBoundsException _ex) { }
                    i2 = ai[j2] + 1;
                }

                for(int l2 = 0; l2 < i1; l2++)
                {
                    int j3 = as[l2].length() - 8;

                    byte abyte0[] = new byte[j3];

                    byte abyte1[] = new byte[8];


                    as[l2].getBytes(0, j3, abyte0, 0);

                    as[l2].getBytes(j3, j3 + 8, abyte1, 0);

                    int l3 = j3 % 7;

                    int j4 = j3 % 3;

                    for(int k4 = 0; k4 < j3; k4++)
                    {
                        byte byte0 = abyte0[k4];
                        if(byte0 >= 48 && byte0 <= 57)
                            abyte0[k4] = a(byte0, l3, 48, 57);
                        else
                            if(byte0 >= 65 && byte0 <= 90)
                                abyte0[k4] = a(byte0, l3, 65, 90);
                            else
                                if(byte0 >= 97 && byte0 <= 122)
                                    abyte0[k4] = a(byte0, l3, 97, 122);
                                else
                                    if(byte0 == 45)
                                        abyte0[k4] = 46;
                                    else
                                        if(byte0 == 46)
                                            abyte0[k4] = 45;
                        if((l3 = l3 + j4) > 7)
                            l3 = 1;
                    }

                    int l4 = 0;
                    int i5 = 0;
                    for(int j5 = 0; j5 < 4; j5++)
                       abyte1[j5] -= 52;

 

                    for(int k5 = 4; k5 < 8; k5++)

                        abyte1[k5] -= 55;

                    for(int l5 = 0; l5 < j3; l5 += 2)
                        l4 = l4 + abyte0[l5];

                    for(int i6 = 1; i6 < j3; i6 += 2)

                        i5 += abyte0[i6];


                    String s11 = String.valueOf(l4);
                    String s12 = String.valueOf(i5);
                    for(; s11.length() < 4; s11 = "0" + s11);
                    for(; s12.length() < 4; s12 = "0" + s12);
                    byte abyte2[] = new byte[8];
                    s11.getBytes(0, 4, abyte2, 0);

                    s12.getBytes(0, 4, abyte2, 4);


                    String s13 = new String(abyte2, 0);
                    if(s13.equals(new String(abyte1, 0)))
                    {
                        String s14 = new String(abyte0, 0);
                        String s15 = null;
                        if(s14.startsWith("www."))
                            s15 = s14.substring(4);
                        else
                            s15 = s14;
                        if(s3.equalsIgnoreCase(s15))
                            bU = true;
                    }
                }
            }
        }

        String s5 = getParameter("reglink");
        if(s5 != null && !s5.equalsIgnoreCase("NO"))
            try
            {
                V = new URL(getDocumentBase(), s5);
            }
        catch(MalformedURLException _ex)
        {
            V = null;
        }

        String s6 = getParameter("regnewframe");
        if(s6.equalsIgnoreCase("YES"))
            bs = true;
        Container container;
        for(container = getParent(); !(container instanceof Frame); container = ((Component)container).getParent());
        b = (Frame)container;
        b.setCursor(3);
        String s7 = getParameter("overimg");
        if(s7 != null && !s7.equalsIgnoreCase("NO"))
        {
            bC = a(s7);
            if(bC != null)
            {
                String s8 = getParameter("overimgX");
                if(s8 == null)
                    s8 = "0";
                bD = Integer.valueOf(s8).intValue();
                String s10 = getParameter("overimgY");
                if(s10 == null)
                    s10 = "0";
                bE = Integer.valueOf(s10).intValue();
            }
        }

        bl = getParameter("MinSYNC");
        if(bl == null)
            bl = "10";
        Z = Integer.valueOf(bl).intValue();
        ba = getParameter("image");
        bb = getParameter("res");
        if(bb == null)
            bb = "1";
        cG = size().width / bV;
        H = size().height / bV;
        bg = getParameter("light");
        if(bg.equalsIgnoreCase("YES"))
            T = true;
        else

            T = false;


        bg = getParameter("fluidmode");

        if(bg == null)            

bg = "oil";

        if(bg.equalsIgnoreCase("water"))
            by = false;
        else
            by = true;
        bh = getParameter("autodesign");
        if(bh.equalsIgnoreCase("YES"))
            v = true;
        else
            v = false;

        bi = getParameter("density");
        if(bi == null)
            bi = "4";
        bj = getParameter("fishnum");
        if(bj == null)
            bj = "0";
        bk = getParameter("cross");
        if(bk.equalsIgnoreCase("YES"))
            o = true;
        else
            o = false;

        bm = getParameter("crossfactor");
        if(bm == null)
            bm = "30";
        bn = getParameter("rainsize");
        if(bn == null)
            bn = "0";
        bo = getParameter("rainfactor");
        if(bo == null)
            bo = "10";
        bc = getParameter("srainsize");
        if(bc == null)
            bc = "0";
        bd = getParameter("srainfactor");
        if(bd == null)
            bd = "10";
        be = getParameter("memdelay");
        bf = getParameter("priority");
        bV = Integer.valueOf(bb).intValue();
        t = Integer.valueOf(bi).intValue();
        y = Integer.valueOf(bj).intValue();
        n = Integer.valueOf(bm).intValue();
        bP = Integer.valueOf(bn).intValue();
        bO = Integer.valueOf(bo).intValue();
        cm = Integer.valueOf(bc).intValue();
        cl = Integer.valueOf(bd).intValue();
        X = Integer.valueOf(be).intValue();
        bJ = Integer.valueOf(bf).intValue();
        if(X < 0)
            X = 0;
        if(bJ > 10)
            bJ = 10;
        else
            if(bJ < 1)
                bJ = 1;

        bk = getParameter("fixdrop");
        if(bk == null)
            bk = "NO";
        if(bk.equalsIgnoreCase("YES"))
            z = true;
        else
            z = false;
        bd = getParameter("fixdropX");
        if(bd == null)
            bd = "0";
        C = Integer.valueOf(bd).intValue();
        bd = getParameter("fixdropY");
        if(bd == null)
            bd = "0";

        D = Integer.valueOf(bd).intValue();
        bd = getParameter("fixdropF");
        if(bd == null)
            bd = "0";
        A = Integer.valueOf(bd).intValue();
        x = A - 10;
        bd = getParameter("fixdropS");
        if(bd == null)
            bd = "0";
        B = Integer.valueOf(bd).intValu();
        bd = getParameter("pressure");
        if(bd == null)
            bd = "400";
        bH = Float.valueOf(bd).floatValue();
        bd = getParameter("minlight");
        if(bd == null)
            bd = "-20";
        Y = Integer.valueOf(bd).intValue();
        bd = getParameter("maxlight");

        if(bd == null)
            bd = "100";
        W = Integer.valueOf(bd).intValue();
        String s9 = getParameter("interactive");
        if(s9 == null)
            s9 = "no";
        if(s9.equalsIgnoreCase("YES"))
            P = true;
        else
            P = false;
        if(bV > 8)
            bV = 8;
        else
            if(bV < 1)
                bV = 1;
        bT = cG * bV;
        bS = H * bV;
        if(t > 6)
            t = 6;
        else
            if(t < 2)
                t = 2;
        if(y > 2)
            y = 2;
        else
            if(y < 0)
                y = 0;
        if(n < 0)
            n = 0;
        if(bO < 0)
            bO = 0;
        if(cl < 0)
            cl = 0;
        if(bP > cG)
            bP = cG - 1;
        else
            if(bP < 0)
                bP = 0;
        if(cm > cG)
            cm = cG - 1;
        else
            if(cm < 0)
                cm = 0;
        if(v)
        {
            bH = 10F;
            y = 0;
            bP = 0;
            cm = 0;
            o = false;
        }
        showStatus("Loading image...");
        O = a(ba);
        bR = (float)Math.pow(2D, t);
        cw = cG * H;
        int k2 = cG + 1;
        int i3 = cw - k2;
        int k3 = cw - 1;
        I = new float[cG * (H + 2) + k2 + 1];
        J = new float[cG * (H + 2) + k2 + 1];
        ck = new int[cG * H];
        w = new int[cG * H + 2];

        PixelGrabber pixelgrabber = new PixelGrabber(O, 0, 0, cG, H, ck, 0, cG);
        try
        {
            pixelgrabber.grabPixels();
        }
        catch(InterruptedException _ex) { }
        if(T)
        {
            cE = new short[cG * H + 2];
            cD = new short[cG * H + 2];
            cC = new short[cG * H + 2];
            for(N = 0; N < cw; N++)
            {
                int i4 = ck[N];
                cE[N] = (short)(i4 >> 16 & 0xff);
                cD[N] = (short)(i4 >> 8 & 0xff);
                cC[N] = (short)(i4 & 0xff);
            }
        }
        try
        {
            d();
        }
        catch(NoSuchMethodError _ex)
        {
            d();
        }
        h();
        bx = createImage(bT, bS + cf);
        bw = bx.getGraphics();
        if(!bU)
        {
            Label label = new Label("Water applet by Fabio Ciucci 1996/98.");
            cH = new Lware(getAppletContext(), label);
            cH.setTitle("Water Applet by Fabio Ciucci");
            cH.hide();
        }
    }


    private int a;
    Frame b;
    double c;
    double d;
    boolean e;
    final String f = "Applet by Fabio Ciucci (www.anf";
    int g;
    int h;
    int i;
    int j;
    int k;
    int l;
    int m;
    int n;
    boolean o;
    int p;
    int q;
    int r;
    long s;
    int t;
    int u;
    boolean v;
    int w[];
    int x;
    int y;
    boolean z;
    int A;
    int B;
    int C;
    int D;
    Font E;
    int F;
    private Graphics G;
    int H;
    float I[];
    float J[];
    float K;
    float L;
    int M;
    int N;
    private Image O;
    boolean P;
    int Q;
    boolean R;
    int S;
    boolean T;
    String U[];
    URL V;
    int W;
    int X;
    int Y;
    int Z;
    String ba;
    String bb;
    String bc;
    String bd;
    String be;

    Font cQ[];
}



原创粉丝点击