public EditableImage(EditableImage image) { this.colors = image.colors.Clone() as int[, ]; this.PixelFormat = image.PixelFormat; this.Stride = image.Stride; this.Palette = image.Palette; }
public static Bitmap EditImage(Bitmap bmp, ImageEditEventHandler evt) { EditableImage img = new EditableImage(bmp); img.EditImage(evt); return(img.Image); }
/// <summary> /// Gets the average color. This process needs time /// </summary> /// <param name="bmp"></param> /// <returns>The average color</returns> public static System.Drawing.Color GetAverageColor(this Bitmap bmp) { EditableImage img = new EditableImage(bmp); long r = 0, g = 0, b = 0; for (int y = 0; y < img.Height; y++) { for (int x = 0; x < img.Width; x++) { System.Drawing.Color color = img.GetPixel(x, y); r += color.R; g += color.G; b += color.B; } } long count = img.Width * img.Height; return(System.Drawing.Color.FromArgb( (int)(r / count).PutInto(0, 255), (int)(g / count).PutInto(0, 255), (int)(b / count).PutInto(0, 255))); }
public EditableImage(EditableImage image) { this.colors = image.colors.Clone() as int[,]; this.PixelFormat = image.PixelFormat; this.Stride = image.Stride; this.Palette = image.Palette; }
/// <summary> /// Gets the average color. This process needs time /// </summary> /// <param name="bmp"></param> /// <returns>The average color</returns> public static System.Drawing.Color GetAverageColor(this Bitmap bmp) { EditableImage img = new EditableImage(bmp); long r = 0, g = 0, b = 0; for(int y = 0; y < img.Height; y++) for (int x = 0; x < img.Width; x++) { System.Drawing.Color color = img.GetPixel(x, y); r += color.R; g += color.G; b += color.B; } long count = img.Width * img.Height; return System.Drawing.Color.FromArgb( (int)(r / count).PutInto(0, 255), (int)(g / count).PutInto(0, 255), (int)(b / count).PutInto(0, 255)); }
public static Bitmap EditImage(Bitmap bmp, ImageEditEventHandler evt) { EditableImage img = new EditableImage(bmp); img.EditImage(evt); return img.Image; }