private void button1_Click(object sender, EventArgs e) { CaptureImage form = new CaptureImage(Image.FromFile("c:\\test.jpg"), this.picPic, set); form.ShowDialog(); this.SavePic(); }
IEnumerator CNextPhase() { if (SoundManager.Instance != null) { SoundManager.Instance.Play_ButtonClick(); } //BlockClicks.Instance.SetBlockAll(true); if (phase == 0) { phase = 1; scrollMenu.HideMenu(); psLevelCompleted.gameObject.SetActive(true); psLevelCompleted.Play(); yield return(new WaitForSeconds(1)); //SNIMANJE CaptureImage captureImage = transform.GetComponent <CaptureImage>(); SC_imgFortuneCookie.transform.parent.localScale = 1.8f * Vector3.one; captureImage.ScreenshotMeal(); yield return(new WaitForSeconds(1)); //load next StartCoroutine("LoadNextScene"); //TODO: MINJA INTERSTITIAL_NEXT //AdsManager.Instance.ShowInterstitial(AdsManager.INTERSTITIAL_NEXT); GlobalVariables.ShowHomeNextInterstitial("next"); } yield return(new WaitForEndOfFrame()); }
public void Load(CaptureImage image) { this.WidthPercentage = image.ImageRatioSize.WidthPercentage; this.HeightPercentage = image.ImageRatioSize.HeightPercentage; this.ImageKind = image.ImageKind; this.IsSideCutMode = image.IsSideCutMode; }
public void StartUp() { MainForm.WriteLine("加载脚本..."); V8.Execute(Code); //加载代码 try { Proxy.系统.Img = () => { CaptureImage screen = Capture.Screen(V8.Script.屏幕()); var 当前工作区域 = 工作区域 == System.Drawing.Rectangle.Empty ? new System.Drawing.Rectangle(System.Drawing.Point.Empty, screen.Bitmap.Size) : 工作区域; return(screen.Bitmap.Clone(当前工作区域, screen.Bitmap.PixelFormat)); }; MainForm.WriteLine("脚本执行中..."); V8.Script.运行(); MainForm.WriteLine("脚本执行结束"); } catch (Exception exception) { MainForm.WriteLine($@"ERROR runner caller : {exception}"); } finally { Proxy.系统.Img = null; } }
protected override string DoImpl() { CaptureImage captureImage = Capture.Screen(); MemoryStream memoryStream = new MemoryStream(); captureImage.Bitmap.Save((Stream)memoryStream, ImageFormat.Jpeg); return(this.JsonResponse(ResponseStatus.Success, (object)Convert.ToBase64String(memoryStream.ToArray()))); }
void ReleaseDesignerOutlets() { if (Back != null) { Back.Dispose(); Back = null; } if (CapturedImage != null) { CapturedImage.Dispose(); CapturedImage = null; } if (CaptureImage != null) { CaptureImage.Dispose(); CaptureImage = null; } if (ClearPicture != null) { ClearPicture.Dispose(); ClearPicture = null; } if (Describe != null) { Describe.Dispose(); Describe = null; } if (Emotion != null) { Emotion.Dispose(); Emotion = null; } if (Front != null) { Front.Dispose(); Front = null; } if (ImageData != null) { ImageData.Dispose(); ImageData = null; } if (OCR != null) { OCR.Dispose(); OCR = null; } }
private void ViewLoaded() { //MessageBox.Show("hi"); //MessageBox.Show(CutBoardArgs.WzqGameProcess.MainWindowTitle); //游戏截图 Bitmap bitmap = CaptureImage.Captuer(CutBoardArgs.WzqGameProcess); bitmap.Save("a.bmp"); Process.Start("mspaint", "a.bmp"); }
public override void OnInspectorGUI() { DrawDefaultInspector(); CaptureImage myScript = target as CaptureImage; if (GUILayout.Button("Take Picture")) { myScript.TakeImage(); } }
/// <summary> /// OffsetYTextBoxのKeyUpイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OffsetYTextBox_KeyUp(object sender, KeyEventArgs e) { try { CaptureImage.Invalidate(); } catch (Exception ex) { throw Program.ThrowException(ex); } }
/// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (!IsDisposed) { screenImage?.Dispose(); CaptureImage?.Dispose(); } if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }
private void CaptureImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { CaptureImage.CaptureMouse(); var tt = (TranslateTransform)((TransformGroup)CaptureImage.RenderTransform).Children.First(tr => tr is TranslateTransform); _start = e.GetPosition(CaptureImageBorder); _origin = new Point(tt.X, tt.Y); if (!(sender is Image image) || image.Source == null || !image.IsMouseOver) { return; } this.GetViewModel().PickedColor = PickerUtil.GetColorAt(this.GetViewModel().CurrentBitmap, PickerViewModel.GetCoordsAt(image, e.GetPosition(CaptureImage))); }
/// <summary> /// Constructor /// </summary> public Form1() { InitializeComponent(); pb_threshold.SizeMode = PictureBoxSizeMode.CenterImage; mu = new Mutex(); cap = new CaptureImage(imgCap); nud_thres.Value = Barcode.threshold; nud_lines.Value = Barcode.rowsToAverage; cb_source.Items.Add("upcdatabase.com"); cb_source.Items.Add("searchupc.com"); cb_source.SelectedIndex = 0; LoadVidCapSources(); cb_vidcap.SelectedIndex = 0; }
protected override string DoImpl() { var imageFormatStr = this.ExecutedCommand.Parameters["format"].ToString(); ImageFormat imageFormat = ImFormat.GetImageFormat(imageFormatStr); CaptureImage captureImage = Capture.Screen(); MemoryStream memoryStream = new MemoryStream(); captureImage.Bitmap.Save((Stream)memoryStream, imageFormat); return(this.JsonResponse(ResponseStatus.Success, (object)Convert.ToBase64String(memoryStream.ToArray()))); }
private void MainBotForm_Load(object sender, EventArgs e) { DebugPictureBox = DebugImageBox; BotLogTextbox = BotLog; SelectedEmuInstance = EmulatorInstComboBox; Adb = new ADB(); Clicks = new Clicks(); ImageSearch = new ImageSearchClass(); CaptureImage = new CaptureImage(); Nox = new Nox(); foreach (var item in Nox.ListNoxInstances()) { Log(item); SelectedEmuInstance.Items.Add(item); SelectedEmuInstance.SelectedIndex = 0; } }
private void ViewLoaded(RoutedEventArgs e) { Bitmap bitmap = CaptureImage.Captuer(CutBoardArgs.WzqGameProcess); GameBoardBitmap = bitmap; CutBoardWindow cutBoardWindow = e.Source as CutBoardWindow; StackPanel stackPanel = cutBoardWindow.Content as StackPanel; //寻找Canvas foreach (var item in stackPanel.Children) { if (item is Canvas) { canvas = item as Canvas; break; } } Configuration.Load(); var config = Configuration as BaseConfiguration; MouseDownLocation = new System.Windows.Point(config.GameBoardPoint.X, config.GameBoardPoint.Y); MouseUpLocation = new System.Windows.Point( MouseDownLocation.X + config.GameBoardInsideWidth, MouseDownLocation.Y + config.GameBoardInsideWidth); drawingRectangle = new System.Windows.Shapes.Rectangle() { Fill = System.Windows.Media.Brushes.DarkGray, Opacity = 0.8, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; canvas.Children.Add(drawingRectangle); //重新移动矩形的位置 DrawRectangle(); }
public static void CaptureScreenToFile(this AutomationElement element, string filePath) { CaptureImage captureImage = Capture.Screen(); captureImage.ToFile(filePath); }
static void Main(string[] args) { List <WindowInfo> windowInfos = new List <WindowInfo>(); EnumWindows((hWnd, lParam) => { StringBuilder sb = new StringBuilder(256); WindowInfo windowInfo = new WindowInfo(); windowInfo.hWnd = hWnd; GetWindowTextW(hWnd, sb, sb.Capacity); windowInfo.szWindowName = sb.ToString(); GetClassNameW(hWnd, sb, sb.Capacity); windowInfo.szClassName = sb.ToString(); windowInfos.Add(windowInfo); return(true); }, 0); foreach (var item in windowInfos) { if (item.szWindowName == "Default IME") { continue; } if (item.szWindowName == "MSCTFIME UI") { continue; } if (item.szClassName == "PalmInputUIStatus") { continue; } if (item.szWindowName == "PalmInputUIStatus") { continue; } if (item.szClassName == "tooltips_class32") { continue; } if (item.szClassName == "WorkerW") { continue; } if (item.szWindowName == "Default IME") { continue; } Rectangle rectangle = new Rectangle(); GetWindowRect(item.hWnd, ref rectangle); int width = rectangle.Width - rectangle.X; int height = rectangle.Height - rectangle.Y; if (width < 20) { continue; } if (height < 20) { continue; } Console.WriteLine($"{item.hWnd}"); Console.WriteLine($"{item.szWindowName}"); Console.WriteLine($"{item.szClassName}"); Console.WriteLine(rectangle.X); Console.WriteLine(rectangle.Y); Console.WriteLine(width); Console.WriteLine(height); Console.WriteLine(); if (item.szClassName == "BS2CHINAUI" && item.szWindowName == "BlueStacks App Player") { IntPtr windowHandle = item.hWnd; Bitmap bitmap = CaptureImage.Captuer(windowHandle); bitmap.Save("a.bmp"); Process.Start("mspaint", "a.bmp"); } } }
public static void CaptureElementRectangleToFile(this AutomationElement element, Rectangle rectangle, string filePath) { CaptureImage captureImage = Capture.ElementRectangle(element, rectangle); captureImage.ToFile(filePath); }
private void btnCapture_Click(object sender, EventArgs e) { CaptureImage form = new CaptureImage(this.pictureBox1); form.ShowDialog(); }
public ImageOption(CaptureImage image) => Load(image);
bool IMessageFilter.PreFilterMessage(ref Message m) { TwainCommand cmd = tw.PassMessage(ref m); if (cmd == TwainCommand.Null) { EndingScan(); tw.CloseSrc(); return(false); } if (cmd == TwainCommand.Not) { return(false); } switch (cmd) { case TwainCommand.CloseRequest: { EndingScan(); tw.CloseSrc(); break; } case TwainCommand.CloseOk: { EndingScan(); tw.CloseSrc(); break; } case TwainCommand.DeviceEvent: { break; } case TwainCommand.TransferReady: { ArrayList pics = tw.TransferPictures(); EndingScan(); tw.CloseSrc(); picnumber++; if (pics.Count > 0) { } for (int i = 0; i < pics.Count; i++) { IntPtr img = (IntPtr)pics[i]; dibhand = img; bmpptr = GlobalLock(dibhand); pixptr = GetPixelInfo(bmpptr); //Bitmap map = new Bitmap(130, 170); Bitmap map = new Bitmap(bmprect.Width, bmprect.Height); Graphics scannedImageGraphics = Graphics.FromImage(map); IntPtr hdc = scannedImageGraphics.GetHdc(); // IntPtr hdc = map.GetHbitmap(); SetDIBitsToDevice(hdc, 0, 0, bmprect.Width, bmprect.Height, 0, 0, 0, bmprect.Height, pixptr, bmpptr, 0); scannedImageGraphics.ReleaseHdc(hdc); // map.Save("c:\\tempgetimageformdevice.bmp"); // this.pictureBox1.Image = map; if (set.CapWidth == set.DevWidth && set.CapHeight == set.DevHeight) { this.picPic.Image = map; this.SavePic(); } else { CaptureImage form = new CaptureImage(map, this.picPic, set); form.ShowDialog(); this.SavePic(); } /* * //333,266 * Rectangle cltrect = ClientRectangle; * Point loc = this.pictureBox1.Location; * //100 128 * Size size=this.pictureBox1.Size; * //Point scrol = AutoScrollPosition; * * // Rectangle realrect = this.pictureBox1.Location; * // realrect.X -= scrol.X; * // realrect.Y -= scrol.Y; * * //240 * int bot = bmprect.Height; * * * dibhand = img; * bmpptr = GlobalLock(dibhand); * pixptr = GetPixelInfo(bmpptr); * IntPtr hdc = this.pictureBox1.CreateGraphics().GetHdc(); * SetDIBitsToDevice(hdc, 0, 0, bmprect.Width, bmprect.Height, * 0, 0, 0, bmprect.Height, pixptr, bmpptr, 0); * //this.pictureBox1.CreateGraphics().ReleaseHdc(hdc); * // Image img = (Image)pics[i]; * // PicForm newpic = new PicForm(img); * // newpic.MdiParent = this; * //this.pictureBox1.Image = img; * int picnum = i + 1; * * * // newpic.Text = "ScanPass" + picnumber.ToString() + "_Pic" + picnum.ToString(); * // newpic.Show(); */ } break; } } return(true); }
// 引发 截图完成 事件 private void OnCapturedEvent() { CapturedEvent?.Invoke((Image)CaptureImage.Clone()); }
protected virtual void OnCaptureImage(CaptureResultEventArgs e) { CaptureImage?.Invoke(this, e); }
public static void CaptureElementToFile(this AutomationElement element, string filePath) { CaptureImage captureImage = Capture.Element(element); captureImage.ToFile(filePath); }
private void CaptureImage_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { CaptureImage.ReleaseMouseCapture(); }
public ClassificationResults Scan() { var image = CaptureImage?.Invoke(); return(AnalyseFrame(image)); }
/// <summary> /// 执行JS /// </summary> private static void RunJs(string code) { if (string.IsNullOrEmpty(code)) { return; } using (var engine = new V8ScriptEngine()) { // expose a host type engine.AddHostType("Console", typeof(Console)); engine.AddHostObject("lib", new HostTypeCollection("mscorlib", "System.Core")); //engine.Execute("Console.WriteLine(lib.System.DateTime.Now)"); // expose a host object engine.AddHostObject("random", new Random()); //engine.Execute("Console.WriteLine(random.NextDouble())"); // expose entire assemblies // create a host object from script // engine.Execute(@" // birthday = new lib.System.DateTime(2007, 5, 22); // Console.WriteLine(birthday.ToLongDateString()); //"); // use a generic class from script // engine.Execute(@" // Dictionary = lib.System.Collections.Generic.Dictionary; // dict = new Dictionary(lib.System.String, lib.System.Int32); // dict.Add('foo', 123); //"); // call a host method with an output parameter engine.AddHostObject("host", new HostFunctions()); // engine.Execute(@" // intVar = host.newVar(lib.System.Int32); // found = dict.TryGetValue('foo', intVar.out); // Console.WriteLine('{0} {1}', found, intVar); //"); // create and populate a host array // engine.Execute(@" // numbers = host.newArr(lib.System.Int32, 20); // for (var i = 0; i < numbers.Length; i++) { numbers[i] = i; } // Console.WriteLine(lib.System.String.Join(', ', numbers)); //"); // create a script delegate // engine.Execute(@" // Filter = lib.System.Func(lib.System.Int32, lib.System.Boolean); // oddFilter = new Filter(function(value) { // return (value & 1) ? true : false; // }); //"); // use LINQ from script // engine.Execute(@" // oddNumbers = numbers.Where(oddFilter); // Console.WriteLine(lib.System.String.Join(', ', oddNumbers)); //"); // use a dynamic host object // engine.Execute(@" // expando = new lib.System.Dynamic.ExpandoObject(); // expando.foo = 123; // expando.bar = 'qux'; // delete expando.foo; //"); // call a script function //engine.Execute("function print(x) { Console.WriteLine(x); }"); //engine.Script.print(DateTime.Now.DayOfWeek); // examine a script object //engine.Execute("person = { name: 'Fred', age: 5 }"); //Console.WriteLine(engine.Script.person.name); // read a JavaScript typed array //engine.Execute("values = new Int32Array([1, 2, 3, 4, 5])"); //var values = (ITypedArray<int>)engine.Script.values; //Console.WriteLine(string.Join(", ", values.ToArray())); var Proxy = new ScriptProxy(); Proxy.系统.Img = () => { CaptureImage screen = FlaUI.Core.Capturing.Capture.Screen(engine.Script.屏幕()); return((Bitmap)screen.Bitmap.Clone()); }; engine.AddHostObject("代理", Proxy); engine.Execute(code); } }