⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fsmorphsolidfill.java

📁 利用opensource的开源jar实现生成flash文件
💻 JAVA
字号:
/*
 * FSMorphSolidFill.java
 * Transform
 * 
 * Copyright (c) 2001-2006 Flagstone Software Ltd. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 *
 *  * Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright notice, 
 *    this list of conditions and the following disclaimer in the documentation 
 *    and/or other materials provided with the distribution.
 *  * Neither the name of Flagstone Software Ltd. nor the names of its contributors 
 *    may be used to endorse or promote products derived from this software 
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
 * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package com.flagstone.transform;

/**
FSMorphSolidFill defines the solid colours that are used to fill a morphing shape at 
the start and end of the morphing process.
 
<table class="datasheet">

<tr><th align="left" colspan="2">Attributes</th></tr>

<tr>
<td><a name="FSMorphSolidFill_0">type</a></td>
<td>Identifies the data structure when it is encoded.</td>
</tr>

<tr>
<td><a name="FSMorphSolidFill_1">startColor</a></td>
<td>The colour applied to the shape at the start of the morphing process.</td>
</tr>

<tr>
<td><a name="FSMorphSolidFill_2">startColor</a></td>
<td>The colour applied to the shape at the end of the morphing process.</td>
</tr>

</table>

<p>The parent class, FSFillStyle allows the type to be set. This should only be used for manipulating bitmap and gradient fill styles.</p> 

<p>The FSMorphSolidFill object is added to a FSDefineMorphShape so both the start colour and end colour should have a value specified for the alpha channel that defines how transparent the colour is.</p>

<pre>
FSColor red = new FSColor(255, 0, 0, 128);
FSColor green = new FSColor(0, 255, 0, 128);
FSMorphSolidFill fill = new FSMorphSolidFill(red, green);
</pre>

<h1 class="datasheet">History</h1>

<p>The FSMorphSolidFill class represents the MorphFillStyle structure from the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 3.</p>
 */  
public class FSMorphSolidFill extends FSFillStyle
{
    private FSColor startColor = null;
    private FSColor endColor = null;
    
    /**
     * Construct an FSMorphSolidFill object, initalizing it with values decoded 
     * from an encoded object.
     * 
     * @param coder an FSCoder containing the binary data.
     */
    public FSMorphSolidFill(FSCoder coder)
    {
        decode(coder);
    }
    /** Constructs an FSMorphSolidFill object specifying the starting and ending colours.

        @param aStartColor the colour at the start of the morphing process.
        @param anEndColor the colour at the end of the morphing process.
        */
    public FSMorphSolidFill(FSColor aStartColor, FSColor anEndColor)
    {
        super(Solid);
        setStartColor(aStartColor);
        setEndColor(anEndColor);
    }
    /**
     * Constructs an FSMorphSolidFill object by copying values from an existing 
     * object.
     *
     * @param obj an FSMorphSolidFill object.
     */
    public FSMorphSolidFill(FSMorphSolidFill obj)
    {
        super(obj);
        startColor = new FSColor(obj.startColor);
        endColor = new FSColor(obj.endColor);
    }    

    /** Gets the colour at the start of the morphing process.

        @return the starting colour.
        */
    public FSColor getStartColor() { return startColor; }

    /** Gets the colour at the end of the morphing process.

        @return the end colour.
        */
    public FSColor getEndColor() { return endColor; }

    /** Sets the colour at the start of the morphing process.

        @param aColor the start colour.
        */
    public void setStartColor(FSColor aColor)
    {
        startColor = aColor;
    }

    /** Sets the colour at the end of the morphing process.

        @param aColor the end colour.
        */
    public void setEndColor(FSColor aColor)
    {
        endColor = aColor;
    }

    public Object clone()
    {
        FSMorphSolidFill anObject = (FSMorphSolidFill)super.clone();
        
        anObject.startColor = (startColor != null) ? (FSColor)startColor.clone() : null;
        anObject.endColor = (endColor != null) ? (FSColor)endColor.clone() : null;
        
        return anObject;
    }

    public boolean equals(Object anObject)
    {
        boolean result = false;
        
        if (super.equals(anObject))
        {
            FSMorphSolidFill typedObject = (FSMorphSolidFill)anObject;
            
            if (startColor != null)
                result = startColor.equals(typedObject.startColor);
            else
                result = startColor == typedObject.startColor;

            if (endColor != null)
                result = result && endColor.equals(typedObject.endColor);
            else
                result = result && endColor == typedObject.endColor;
        }
        return result;
    }

    public void appendDescription(StringBuffer buffer, int depth)
    {
        buffer.append(name());
        
        if (depth > 0)
        {
            buffer.append(": { ");
            Transform.append(buffer, "startColor", startColor, depth);
            Transform.append(buffer, "endColor", endColor, depth);
            buffer.append("}");
        }
    }

    public int length(FSCoder coder)
    {
        int length = super.length(coder);
    
        length += startColor.length(coder);
        length += endColor.length(coder);
    
        return length;
    }
    
    public void encode(FSCoder coder)
    {
        super.encode(coder);
        startColor.encode(coder);
        endColor.encode(coder);
    }
    
    public void decode(FSCoder coder)
    {
        super.decode(coder);
        startColor = new FSColor(coder);
        endColor = new FSColor(coder);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -