public Point?Find(bool highlight) { this.bitmap = WowScreen.GetCroppedBitmap(highlight); Score?best = Score.ScorePoints(FindYellowPoints()); var e = new NodeEventArgs() { Bitmap = this.bitmap }; if (best != null && best.count > 2) { e.Point = best.point; } NodeEvent?.Invoke(this, e); this.bitmap.Dispose(); return(best?.point); }
private void RenderColour(bool renderMatchedArea) { var bitmap = new System.Drawing.Bitmap(256, 256); var points = new List <Point>(); for (var b = 0; b < 256; b++) { for (var g = 0; g < 256; g++) { if (pixelClassifier.IsMatch((byte)this.YellowValue, (byte)g, (byte)b)) { points.Add(new Point(b, g)); } bitmap.SetPixel(b, g, System.Drawing.Color.FromArgb(this.YellowValue, g, b)); } } if (ScreenCapture == null) { ScreenCapture = WowScreen.GetCroppedBitmap(false); renderMatchedArea = true; } this.WowScreenshot.Source = ScreenCapture.ToBitmapImage(); if (renderMatchedArea) { Dispatch(() => { Bitmap bmp = new Bitmap(ScreenCapture); MarkYellowOnBitmap(bmp); this.WowScreenshot.Source = bmp.ToBitmapImage(); }); } }
private void Capture() { ScreenCapture = WowScreen.GetCroppedBitmap(false); RenderColour(true); }