本文整理汇总了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");
}
示例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;
}