static public bool SearchPixelOne(string hexcode, Coordinate coordinate) { int x = coordinate.GetX(); int y = coordinate.GetY(); // Take an image from the screen // Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); // Create an empty bitmap with the size of the current screen Bitmap bitmap = new Bitmap(1, 1); // Create an empty bitmap with the size of all connected screen Graphics graphics = Graphics.FromImage(bitmap as Image); // Create a new graphics objects that can capture the screen graphics.CopyFromScreen(x, y, 0, 0, bitmap.Size); // Screenshot moment → screen content to graphics object Color desiredPixelColor = ColorTranslator.FromHtml(hexcode); // Get the current pixels color Color currentPixelColor = bitmap.GetPixel(0, 0); //bitmap.Save(@"C:\Users\alexp\Desktop\pixelsuche\try1.png", ImageFormat.Png); speichert das bild // Finally compare the pixels hex color and the desired hex color (if they match we found a pixel) if (desiredPixelColor == currentPixelColor) { //MessageBox.Show(String.Concat("Found Pixel - Now set mouse cursor " + x, "x " + y, "y")); bitmap.Dispose(); graphics.Dispose(); return(true); } //MessageBox.Show("Did not find pixel"); graphics.Dispose(); bitmap.Dispose(); return(false); }
public SkillRunner(Skill s, int position) { running = true; if (s.GetSkillType() == SkillType.ColorTrigger) { c = new Coordinate(s.GetX(), s.GetY()); inputHexColorCode = s.GetColor(); boxSend = position.ToString(); delay = 50; t = new Thread(RunColorTrigger); } else if (s.GetSkillType() == SkillType.TimeTrigger) { c = new Coordinate(s.GetX(), s.GetY()); boxSend = position.ToString(); delay = s.GetDelayTime(); t = new Thread(RunTimeTrigger); } else if (s.GetSkillType() == SkillType.AuslaufTrigger) { } else { if (s.GetSkillName() == SkillName.HungeringArrow) { delay = 1; t = new Thread(RunMomentum); boxSend = position.ToString(); } } if (position == 2) { c.SetX(c.GetX() + 66); } else if (position == 3) { c.SetX(c.GetX() + 133); } else if (position == 4) { c.SetX(c.GetX() + 200); } }