コード例 #1
0
 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
0
        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
0
 /// <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;
 }