當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。