Ejemplo n.º 1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Declare variables
            IGH_Goo         X = null;
            int             M = 0;
            List <Vector3d> V = new List <Vector3d>();

            // Access the input parameters
            if (!DA.GetData(0, ref X))
            {
                return;
            }
            if (!DA.GetData(1, ref M))
            {
                return;
            }
            if (!DA.GetDataList(2, V))
            {
                return;
            }

            Bitmap A = new Bitmap(10, 10);

            if (X != null)
            {
                X.CastTo(out A);
            }

            if (M != ModeIndex)
            {
                ModeIndex = M;
                UpdateMessage();
            }

            mGetChannel C = null;

            List <double> i = new List <double>();
            List <double> j = new List <double>();

            for (int k = 0; k < V.Count; k++)
            {
                i.Add(V[k].X);
                j.Add(1.0 - V[k].Y);
            }

            switch (M)
            {
            default:
                C = new mGetRGBColor(A, i, j);
                break;

            case 1:
                C = new mGetAlpha(A, i, j, unitize);
                break;

            case 2:
                C = new mGetRed(A, i, j, unitize);
                break;

            case 3:
                C = new mGetGreen(A, i, j, unitize);
                break;

            case 4:
                C = new mGetBlue(A, i, j, unitize);
                break;

            case 5:
                C = new mGetHue(A, i, j, unitize);
                break;

            case 6:
                C = new mGetSaturation(A, i, j);
                break;

            case 7:
                C = new mGetBrightness(A, i, j);
                break;
            }


            if (M == 0)
            {
                DA.SetDataList(0, C.Colors);
            }
            else
            {
                DA.SetDataList(0, C.Values);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Declare variables
            IGH_Goo Z = null;
            int     M = 0;

            // Access the input parameters
            if (!DA.GetData(0, ref Z))
            {
                return;
            }
            if (!DA.GetData(1, ref M))
            {
                return;
            }

            if (M != ModeIndex)
            {
                ModeIndex = M;
                UpdateMessage();
            }

            Bitmap A = new Bitmap(10, 10);

            if (Z != null)
            {
                Z.CastTo(out A);
            }

            mGetChannel C = null;

            switch (M)
            {
            default:
                C = new mGetRGBColor(A);
                break;

            case 1:
                C = new mGetAlpha(A);
                break;

            case 2:
                C = new mGetRed(A);
                break;

            case 3:
                C = new mGetGreen(A);
                break;

            case 4:
                C = new mGetBlue(A);
                break;

            case 5:
                C = new mGetHue(A);
                break;

            case 6:
                C = new mGetSaturation(A);
                break;

            case 7:
                C = new mGetBrightness(A);
                break;
            }

            if (M == 0)
            {
                DA.SetDataList(0, C.Colors);
            }
            else
            {
                DA.SetDataList(0, C.Values);
            }
        }