Example #1
0
        override public ModuleBase GetModule()
        {
            // check that has inputs
            if (type != COLORTYPE.COLOR)
            {
                for (int i = 0; i < inputs.Length; i++)
                {
                    if (inputs[i] == null)
                    {
                        return(null);
                    }
                }
            }

            // get module
            switch (type)
            {
            case COLORTYPE.GRADIENT:
                if (gradient == null)
                {
                    gradient = new Gradient();
                    if (gradientColorKeys != null)
                    {
                        gradient.colorKeys = SerializableGradientColorKey.ToGradientColorKeys(gradientColorKeys);
                    }
                    if (gradientAlphaKeys != null)
                    {
                        gradient.alphaKeys = SerializableGradientAlphaKey.ToGradientColorKeys(gradientAlphaKeys);
                    }
                }
                if (gradientColorKeys == null)
                {
                    gradientColorKeys = SerializableGradientColorKey.FromGradientColorKeys(gradient.colorKeys);
                }
                if (gradientAlphaKeys == null)
                {
                    gradientAlphaKeys = SerializableGradientAlphaKey.FromGradientColorKeys(gradient.alphaKeys);
                }

                module = new GradientModule(inputs[0].GetModule(), gradient);
                break;

            case COLORTYPE.ADD:
                module = new AddColorModule(inputs[0].GetModule(), inputs[1].GetModule());
                break;

            case COLORTYPE.MULTIPLY:
                module = new MultiplyColorModule(inputs[0].GetModule(), inputs[1].GetModule());
                break;

            case COLORTYPE.BLEND:
                module = new BlendColorModule(inputs[0].GetModule(), inputs[1].GetModule(), inputs[2].GetModule());
                break;

            case COLORTYPE.COLOR:
                module = new ColorSource(color.ToColor());
                break;

            case COLORTYPE.OVERLAY:
                module = new OverlayColorModule(inputs[0].GetModule(), inputs[1].GetModule());
                break;
            }

            SetOutputOptions();

            return(this.module);
        }
Example #2
0
        public override ModuleBase GetModule()
        {
            // check that has inputs
            if(type != COLORTYPE.COLOR) {
            for(int i = 0; i < inputs.Length; i++) {
                if(inputs[i] == null) {
                    return null;
                }
            }
            }

            // get module
            switch(type) {
            case COLORTYPE.GRADIENT:
            if(gradient == null) {
                gradient = new Gradient();
                if(gradientColorKeys != null)
                    gradient.colorKeys = SerializableGradientColorKey.ToGradientColorKeys(gradientColorKeys);
                if(gradientAlphaKeys != null)
                    gradient.alphaKeys = SerializableGradientAlphaKey.ToGradientColorKeys(gradientAlphaKeys);
            }
            if(gradientColorKeys == null)
                gradientColorKeys = SerializableGradientColorKey.FromGradientColorKeys(gradient.colorKeys);
            if(gradientAlphaKeys == null)
                gradientAlphaKeys = SerializableGradientAlphaKey.FromGradientColorKeys(gradient.alphaKeys);

            module = new GradientModule(inputs[0].GetModule(), gradient);
            break;
            case COLORTYPE.ADD:
            module = new AddColorModule(inputs[0].GetModule(), inputs[1].GetModule());
            break;
            case COLORTYPE.MULTIPLY:
            module = new MultiplyColorModule(inputs[0].GetModule(), inputs[1].GetModule());
            break;
            case COLORTYPE.BLEND:
            module = new BlendColorModule(inputs[0].GetModule(), inputs[1].GetModule(), inputs[2].GetModule());
            break;
            case COLORTYPE.COLOR:
            module = new ColorSource(color.ToColor());
            break;
            case COLORTYPE.OVERLAY:
            module = new OverlayColorModule(inputs[0].GetModule(), inputs[1].GetModule());
            break;
            }

            SetOutputOptions();

            return this.module;
        }