public void InverseRectangleShotTest() { var bitmap = Screenshoter.Shot(Rectangle.FromLTRB(5278, 1426, 4509, 808)); var path = $"{Path.GetTempFileName()}.bmp"; bitmap.Save(path); Process.Start(new ProcessStartInfo(path) { UseShellExecute = true, }); }
public void ShotTest() { var bitmap = Screenshoter.Shot(); var path = $"{Path.GetTempFileName()}.bmp"; bitmap.Save(path); Process.Start(new ProcessStartInfo(path) { UseShellExecute = true, }); }
public void ShotEachDisplayTest() { foreach (var rectangle in Screenshoter.GetPhysicalScreens()) { var bitmap = Screenshoter.Shot(rectangle); var path = $"{Path.GetTempFileName()}.bmp"; bitmap.Save(path); Process.Start(new ProcessStartInfo(path) { UseShellExecute = true, }); } }
public override void OnInspectorGUI() { EditorGUILayout.BeginHorizontal(); { t.path = EditorGUILayout.TextField("Save to", t.path); if (GUILayout.Button("...", GUILayout.Width(30))) { string path = EditorUtility.OpenFolderPanel("Select Folder", t.path ?? Application.dataPath, ""); if (!string.IsNullOrEmpty(path)) { t.path = path; } } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { t.pauseOnShoot = EditorGUILayout.Toggle("Pause on Shoot", t.pauseOnShoot); if (Application.isPlaying) { if (GUILayout.Button(GamePaused ? "Unpause" : "Pause")) { if (GamePaused) { ResumeGame(); } else { PauseGame(); } } } } EditorGUILayout.EndHorizontal(); t.landscape = EditorGUILayout.Toggle("Landscape", t.landscape); EditorGUILayout.PropertyField(serializedObject.FindProperty("resolutions"), true); //list.DoLayoutList(); serializedObject.ApplyModifiedProperties(); if (Application.isPlaying) { EditorGUILayout.BeginHorizontal(); { float w = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 80f; EditorGUILayout.LabelField("Switch resolution"); EditorGUIUtility.labelWidth = w; if (GUILayout.Button("<<<")) { currentResolution = Mathf.Clamp(currentResolution - 1, 0, t.resolutions.Length - 1); t.ApplyResolution(currentResolution); } if (GUILayout.Button(">>>")) { currentResolution = Mathf.Clamp(currentResolution + 1, 0, t.resolutions.Length - 1); t.ApplyResolution(currentResolution); } } EditorGUILayout.EndHorizontal(); } if (Application.isPlaying && GUILayout.Button("Shoot All Resolutions")) { t.Shot(); } if (GUILayout.Button("Shoot One")) { t.Capture(""); } }