/// <summary> /// Loads an image /// </summary> /// <param name="ImageUsing">Image to load</param> public virtual void LoadImage(SwiftBitmap ImageUsing) { Contract.Requires <ArgumentNullException>(ImageUsing != null, "ImageUsing"); Width = ImageUsing.Width; Height = ImageUsing.Height; ImageUsing.Lock(); R.Clear(); G.Clear(); B.Clear(); for (int x = 0; x < ImageUsing.Width; ++x) { for (int y = 0; y < ImageUsing.Height; ++y) { var TempColor = ImageUsing.GetPixel(x, y); ++R[(int)TempColor.R]; ++G[(int)TempColor.G]; ++B[(int)TempColor.B]; } } ImageUsing.Unlock(); }
private static float GetHeight(int x, int y, SwiftBitmap BlackAndWhiteData) { Contract.Requires<ArgumentNullException>(BlackAndWhiteData != null, "BlackAndWhiteData"); Color TempColor = BlackAndWhiteData.GetPixel(x, y); return GetHeight(TempColor); }
private static void GetMinMaxPixel(out Color Min, out Color Max, SwiftBitmap ImageData) { Contract.Requires<ArgumentNullException>(ImageData != null, "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); 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); }
/// <summary> /// Loads an image /// </summary> /// <param name="ImageUsing">Image to load</param> public virtual void LoadImage(SwiftBitmap ImageUsing) { Contract.Requires<ArgumentNullException>(ImageUsing != null, "ImageUsing"); Width = ImageUsing.Width; Height = ImageUsing.Height; ImageUsing.Lock(); R.Clear(); G.Clear(); B.Clear(); for (int x = 0; x < ImageUsing.Width; ++x) { for (int y = 0; y < ImageUsing.Height; ++y) { Color TempColor = ImageUsing.GetPixel(x, y); ++R[(int)TempColor.R]; ++G[(int)TempColor.G]; ++B[(int)TempColor.B]; } } ImageUsing.Unlock(); }