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)
        {
            string P = null;

            if (!DA.GetData(0, ref P))
            {
                return;
            }

            Bitmap bitmap = GetBitmap.GetBitmapFromFile(P);

            DA.SetData(0, new Image(bitmap));
        }
Esempio n. 2
0
        /// <summary>
        /// 获取插件图标
        /// </summary>
        /// <param name="plugin"></param>
        /// <param name="imageFolderPath">默认插件图标目录,仅在<see cref="PluginItem.IconPath"/>为相对路径时使用该值</param>
        /// <returns></returns>
        public static Bitmap GetIcon(this IPluginItem plugin, string imageFolderPath = null)
        {
            var path = plugin.IconPath;
            if (!string.IsNullOrWhiteSpace(path) && !Path.IsPathRooted(path))
            {
                if (!string.IsNullOrWhiteSpace(imageFolderPath))
                    path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, imageFolderPath, path);
                else
                    path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path);
            }
            if (!File.Exists(path))
                return null;

            return GetBitmap.FromFile(path);
        }
Esempio n. 3
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
            string P = null;

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

            GetBitmap bmpObj = new GetBitmap(P);


            DA.SetData(0, bmpObj.BitmapObject);
            DA.SetData(1, bmpObj.Width);
            DA.SetData(2, bmpObj.Height);
        }
Esempio n. 4
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)
        {
            string P = String.Empty;

            if (!DA.GetData(0, ref P))
            {
                return;
            }

            Plane plane = Plane.WorldXY;

            if (!DA.GetData(1, ref plane))
            {
                return;
            }

            Bitmap bitmap = GetBitmap.GetBitmapFromFile(P);

            int width  = bitmap.Width;
            int height = bitmap.Height;

            Mesh mesh = Mesh.CreateFromPlane(plane, new Interval(0, width), new Interval(0, height), 1, 1);
        }