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