Esempio 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)
        {
            IGH_Goo goo   = null;
            Image   image = new Image();

            if (!DA.GetData(0, ref goo))
            {
                return;
            }
            if (!goo.TryGetImage(ref image))
            {
                return;
            }

            int mode = 0;

            DA.GetData(1, ref mode);

            int width = 100;

            DA.GetData(2, ref width);

            int height = 100;

            DA.GetData(3, ref height);

            Filter filter = new Af.Resize(width, height, (Af.Resize.Modes)mode);

            image.Filters.Add(new Af.Resize(width, height, (Af.Resize.Modes)mode));

            DA.SetData(0, image);
            DA.SetData(1, filter);
        }
Esempio 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)
        {
            IGH_Goo goo   = null;
            Image   image = new Image();

            if (!DA.GetData(0, ref goo))
            {
                return;
            }
            if (!goo.TryGetImage(ref image))
            {
                return;
            }

            int mode = 0;

            DA.GetData(1, ref mode);

            double scale = 1.0;

            DA.GetData(2, ref scale);

            int width  = (int)(image.Bitmap.Width * scale);
            int height = (int)(image.Bitmap.Height * scale);

            if (width < 10)
            {
                width = 10;
            }
            if (height < 10)
            {
                height = 10;
            }
            Filter filter = new Af.Resize(width, height, (Af.Resize.Modes)mode);

            image.Filters.Add(new Af.Resize(width, height, (Af.Resize.Modes)mode));

            DA.SetData(0, image);
            DA.SetData(1, filter);
        }