// Decompiled by DJ v2.6.6.51 Copyright 2000 Atanas Neshkov  Date: 6/15/2001 17:41:59
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   com/macromedia/generator/api/Gradient

package com.macromedia.generator.api;

import com.macromedia.generator.api.peer.GradientPeer;

// Referenced classes of package com.macromedia.generator.api:
//            GenObject, GeneratorApiException, Color

public class Gradient extends GenObject
{

    public Gradient()
        throws GeneratorApiException
    {
        peer = GradientPeer.New();
        if(peer == 0)
            throw new GeneratorApiException("unable to create peer");
        else
            return;
    }

    protected Gradient(int i)
        throws GeneratorApiException
    {
        peer = i;
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        else
            return;
    }

    public void addColor(int i, Color color)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = GradientPeer.AddColor(peer, i, color.peer);
        if(j == 0)
            throw new GeneratorApiException("error adding color");
        else
            return;
    }

    public void addRgb(int i, int j)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int k = GradientPeer.AddRgb(peer, i, j);
        if(k == 0)
            throw new GeneratorApiException("error adding rgb");
        else
            return;
    }

    protected void finalize()
        throws Throwable
    {
        if(peer != 0)
            GradientPeer.Release(peer);
        peer = 0;
    }

    public void release()
    {
        if(peer != 0)
            GradientPeer.Release(peer);
        peer = 0;
    }
}