本文整理匯總了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;
}