当前位置: 首页>>代码示例>>C#>>正文


C# Image.GetBlue方法代码示例

本文整理汇总了C#中System.Image.GetBlue方法的典型用法代码示例。如果您正苦于以下问题:C# Image.GetBlue方法的具体用法?C# Image.GetBlue怎么用?C# Image.GetBlue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Image的用法示例。


在下文中一共展示了Image.GetBlue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

 public void Load(string filename)
 {
     //Bitmap bitmap = Bitmap.FromFile(filename) as Bitmap;
     //Bitmap bitmap = DevIL.DevIL.LoadBitmap(filename);
     Image image = new Image(filename);
     int width = image.Width;
     int height = image.Height;
     Terrain.GetInstance().HeightMapWidth = width;
     Terrain.GetInstance().HeightMapHeight = height;
     Terrain.GetInstance().Map = new double[width, height];
     LogFile.GetInstance().WriteLine("loaded bitmap " + width + " x " + height);
     double minheight = Config.GetInstance().minheight;
     double maxheight = Config.GetInstance().maxheight;
     double heightmultiplier = ( maxheight - minheight ) / 255;
     for (int i = 0; i < width; i++)
     {
         for (int j = 0; j < height; j++)
         {
             Terrain.GetInstance().Map[i, j] = (float)( minheight +
                 heightmultiplier *
                 image.GetBlue(i, j) );
         }
     }
     Terrain.GetInstance().HeightmapFilename = filename;
     Terrain.GetInstance().OnTerrainModified();
     MainUI.GetInstance().uiwindow.InfoMessage("Heightmap loaded");
 }
开发者ID:hughperkins,项目名称:SpringMapDesigner,代码行数:27,代码来源:HeightMapPersistence.cs

示例2: LoadHeightMap

        void LoadHeightMap( string sm3directory, TdfParser.Section terrainsection)
        {
            string filename = Path.Combine( sm3directory, terrainsection.GetStringValue("heightmap") );
            double heightoffset = terrainsection.GetDoubleValue("heightoffset");
            double heightscale = terrainsection.GetDoubleValue("heightscale");
            LogFile.GetInstance().WriteLine("heightoffset: " + heightoffset + " heightscale " + heightscale);
            Terrain.GetInstance().MinHeight = heightoffset;
            Terrain.GetInstance().MaxHeight = heightoffset + heightscale; // I guess???

            Image image = new Image(filename);
            //Bitmap bitmap = DevIL.DevIL.LoadBitmap(filename);
            int width = image.Width;
            int height = image.Height;
            Terrain.GetInstance().HeightMapWidth = width;
            Terrain.GetInstance().HeightMapHeight = height;
            Terrain.GetInstance().Map = new double[width, height];
            LogFile.GetInstance().WriteLine("loaded bitmap " + width + " x " + height);
            double minheight = Terrain.GetInstance().MinHeight;
            double maxheight = Terrain.GetInstance().MaxHeight;
            double heightmultiplier = (maxheight - minheight) / 255;
            LogFile.GetInstance().WriteLine("heightmultiplier: " + heightmultiplier + " minheight: " + minheight);
            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < height; j++)
                {
                    Terrain.GetInstance().Map[i, j] =
                        (float)(minheight + heightmultiplier *
                        image.GetBlue(i,j) );
                }
            }
            terrain.HeightmapFilename = filename;
        }
开发者ID:hughperkins,项目名称:SpringMapDesigner,代码行数:32,代码来源:Sm3Persistence.cs


注:本文中的System.Image.GetBlue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。