// Decompiled by DJ v2.6.6.51 Copyright 2000 Atanas Neshkov  Date: 6/15/2001 17:41:54
// 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/Color

package com.macromedia.generator.api;

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

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

public class Color extends GenObject
{

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

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

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

    public int getAlpha()
        throws GeneratorApiException
    {
        int ai[] = new int[1];
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = ColorPeer.GetAlpha(peer, ai);
        if(i == 0)
            throw new GeneratorApiException("error getting alpha");
        else
            return ai[0];
    }

    public int getBlue()
        throws GeneratorApiException
    {
        int ai[] = new int[1];
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = ColorPeer.GetBlue(peer, ai);
        if(i == 0)
            throw new GeneratorApiException("error getting blue");
        else
            return ai[0];
    }

    public static int getBlueValue(int i)
    {
        int j = ColorPeer.GetBlueValue(i);
        return j;
    }

    public int getGreen()
        throws GeneratorApiException
    {
        int ai[] = new int[1];
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = ColorPeer.GetGreen(peer, ai);
        if(i == 0)
            throw new GeneratorApiException("error getting green");
        else
            return ai[0];
    }

    public static int getGreenValue(int i)
    {
        int j = ColorPeer.GetGreenValue(i);
        return j;
    }

    public static int getRGBValue(int i, int j, int k)
    {
        int l = ColorPeer.GetRgbValue(i, j, k);
        return l;
    }

    public static int getRGBValue(String s)
        throws GeneratorApiException
    {
        int ai[] = new int[1];
        int i = ColorPeer.GetRgbValue(s, ai);
        if(i == 0)
            throw new GeneratorApiException("error setting rgb");
        else
            return ai[0];
    }

    public int getRed()
        throws GeneratorApiException
    {
        int ai[] = new int[1];
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = ColorPeer.GetRed(peer, ai);
        if(i == 0)
            throw new GeneratorApiException("error getting red");
        else
            return ai[0];
    }

    public static int getRedValue(int i)
    {
        int j = ColorPeer.GetRedValue(i);
        return j;
    }

    public static int getReducedColor(int i)
    {
        int j = ColorPeer.GetReducedColor(i);
        return j;
    }

    public int getRgb()
        throws GeneratorApiException
    {
        int ai[] = new int[1];
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = ColorPeer.GetRgb(peer, ai);
        if(i == 0)
            throw new GeneratorApiException("error getting rgb");
        else
            return ai[0];
    }

    public static int makeWebSafeColor(int i)
    {
        int j = ColorPeer.MakeWebSafeColor(i);
        return j;
    }

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

    public void setAlpha(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = ColorPeer.SetAlpha(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting alpha");
        else
            return;
    }

    public void setBlue(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = ColorPeer.SetBlue(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting blue");
        else
            return;
    }

    public void setGreen(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = ColorPeer.SetGreen(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting green");
        else
            return;
    }

    public void setRGBValue(String s)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = ColorPeer.SetRgbValue(peer, s);
        if(i == 0)
            throw new GeneratorApiException("error setting rgb");
        else
            return;
    }

    public void setRed(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = ColorPeer.SetRed(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting red");
        else
            return;
    }

    public void setRgb(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = ColorPeer.SetRgb(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting rgb");
        else
            return;
    }
}