本文整理汇总了C#中System.Drawing.Imaging.BitmapData.ThrowIfNull方法的典型用法代码示例。如果您正苦于以下问题:C# BitmapData.ThrowIfNull方法的具体用法?C# BitmapData.ThrowIfNull怎么用?C# BitmapData.ThrowIfNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Imaging.BitmapData
的用法示例。
在下文中一共展示了BitmapData.ThrowIfNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetHeight
private static float GetHeight(int x, int y, BitmapData BlackAndWhiteData, int BlackAndWhitePixelSize)
{
BlackAndWhiteData.ThrowIfNull("BlackAndWhiteData");
Color TempColor = BlackAndWhiteData.GetPixel(x, y, BlackAndWhitePixelSize);
return GetHeight(TempColor);
}
示例2: GetMinMaxPixel
private static void GetMinMaxPixel(out Color Min, out Color Max, BitmapData ImageData, int PixelSize)
{
ImageData.ThrowIfNull("ImageData");
int MinR = 255, MinG = 255, MinB = 255;
int MaxR = 0, MaxG = 0, MaxB = 0;
for (int x = 0; x < ImageData.Width; ++x)
{
for (int y = 0; y < ImageData.Height; ++y)
{
Color TempImage = ImageData.GetPixel(x, y, PixelSize);
if (MinR > TempImage.R)
MinR = TempImage.R;
if (MaxR < TempImage.R)
MaxR = TempImage.R;
if (MinG > TempImage.G)
MinG = TempImage.G;
if (MaxG < TempImage.G)
MaxG = TempImage.G;
if (MinB > TempImage.B)
MinB = TempImage.B;
if (MaxB < TempImage.B)
MaxB = TempImage.B;
}
}
Min = Color.FromArgb(MinR, MinG, MinB);
Max = Color.FromArgb(MaxR, MaxG, MaxB);
}
示例3: UnlockImage
/// <summary>
/// Unlocks the image's data
/// </summary>
/// <param name="Image">Image to unlock</param>
/// <param name="ImageData">The image data</param>
/// <returns>Returns the image</returns>
public static Bitmap UnlockImage(this Bitmap Image, BitmapData ImageData)
{
Image.ThrowIfNull("Image");
ImageData.ThrowIfNull("ImageData");
Image.UnlockBits(ImageData);
return Image;
}