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

package com.macromedia.generator.commands;

import com.macromedia.generator.api.*;
import com.macromedia.generator.app.*;
import java.util.Properties;

public class SetTintCommand extends GenericCommand
{

    public SetTintCommand()
    {
    }

    public void doCommand(FlashEnvironment flashenvironment, Script script, Context context, int i, Properties properties)
        throws FlashCommandException
    {
        float f = 0.0F;
        int j = 0;
        int k = 0;
        int l = 0;
        _fld0109 = new GenVector(16);
        Script script1 = (Script)_fld0109.add(script.getCommandScript(i));
        flashenvironment.processScript(script1, context);
        try
        {
            f = Float.valueOf(context.apply(properties.getProperty("percent", ""))).floatValue();
            if((double)f < 0.0D || (double)f > 100D)
            {
                f = 100F;
                logError(flashenvironment, "InvalPercent", null);
            }
        }
        catch(NumberFormatException _ex)
        {
            f = 100F;
            logError(flashenvironment, "InvalPercent", null);
        }
        try
        {
            j = (int)Float.valueOf(context.apply(properties.getProperty("red", ""))).floatValue();
            if(j < 0 || j > 255)
            {
                logError(flashenvironment, "InvalRedRange", null);
                j = 0;
            }
        }
        catch(NumberFormatException _ex)
        {
            j = 0;
            logError(flashenvironment, "InvalRed", null);
        }
        try
        {
            k = (int)Float.valueOf(context.apply(properties.getProperty("green", ""))).floatValue();
            if(k < 0 || k > 255)
            {
                logError(flashenvironment, "InvalGreenRange", null);
                k = 0;
            }
        }
        catch(NumberFormatException _ex)
        {
            k = 0;
            logError(flashenvironment, "InvalGreen", null);
        }
        try
        {
            l = (int)Float.valueOf(context.apply(properties.getProperty("blue", ""))).floatValue();
            if(l < 0 || l > 255)
            {
                logError(flashenvironment, "InvalBlueRange", null);
                l = 0;
            }
        }
        catch(NumberFormatException _ex)
        {
            l = 0;
            logError(flashenvironment, "InvalBlue", null);
        }
        int i1 = 0xff000000 | (j & 0xff) << 16 | (k & 0xff) << 8 | l & 0xff;
        try
        {
            script.setCommandTint(i, i1, f);
        }
        catch(GeneratorApiRuntimeException _ex)
        {
            logError(flashenvironment, "ErrorSettingTint", null);
            return;
        }
        _fld0109.release();
    }

    GenVector _fld0109;
}