public void DirectlyToAdvanced() { AdvancedSettingsPanel.SetActive(true); PicturePanel.SetActive(false); TakePicture.Instance.taken = true; TakePicture.Instance.CameraUI.transform.parent.gameObject.SetActive(false); }
public fromCreate(PicturePanel pp) { picPanel = pp; InitializeComponent(); comboBoxExportFormat.Items.Add(CommonLib.GetImageType(ImageFormat.Png)); comboBoxExportFormat.Items.Add(CommonLib.GetImageType(ImageFormat.Jpeg)); comboBoxExportFormat.Items.Add(CommonLib.GetImageType(ImageFormat.Gif)); comboBoxExportFormat.DisplayMember = "MimeType"; if (String.IsNullOrEmpty(Global.CurrentProject.ImageFormat) || Global.CurrentProject.ImageFormat.Equals("image/png", StringComparison.CurrentCultureIgnoreCase)) { comboBoxExportFormat.SelectedIndex = 0; } else if (Global.CurrentProject.ImageFormat.Equals("image/jpeg", StringComparison.CurrentCultureIgnoreCase)) { comboBoxExportFormat.SelectedIndex = 1; } else if (Global.CurrentProject.ImageFormat.Equals("image/gif", StringComparison.CurrentCultureIgnoreCase)) { comboBoxExportFormat.SelectedIndex = 2; } trackImageQuality.Value = Global.CurrentProject.ImageQuality; numImageQuality.Value = Global.CurrentProject.ImageQuality; txtExportPath.Text = AppDomain.CurrentDomain.BaseDirectory; ChangeLanguage(); }
public void ReturnFromHelp() { HelpPanel.SetActive(false); PicturePanel.SetActive(true); TakePicture.Instance.taken = false; TakePicture.Instance.CameraUI.transform.parent.gameObject.SetActive(true); }
public void AddPicturePanel(int id, string header, HttpPostedFileBase thisFile) { if (thisFile == null) { return; } var pp = new PicturePanel(); pp.Header = header; pp.P_Id = id; var lenght = thisFile.ContentLength; var tempimage = new byte[lenght]; thisFile.InputStream.Read(tempimage, 0, lenght); pp.ImageData = tempimage; pp.ImageType = thisFile.ContentType; using (this.ef = new CMSDbEntities()) { this.ef.PicturePanels.Add(pp); this.ef.SaveChanges(); } }
public void DirectlyFromAdvanced() { SettingManager.SaveSettings(); AdvancedSettingsPanel.SetActive(false); PicturePanel.SetActive(true); TakePicture.Instance.taken = false; TakePicture.Instance.CameraUI.transform.parent.gameObject.SetActive(true); }
public void InitClip(PicturePanel picPanel) { FinitClip(); _picPanel = picPanel; _picPanel.MouseMove += _picPanel_MouseMove; _picPanel.Paint += _picPanel_Paint; _picPanel.MouseDown += _picPanel_MouseDown; _picPanel.MouseUp += _picPanel_MouseUp; _picPanel.MouseDoubleClick += _picPanel_MouseDoubleClick; }
/// <summary> /// Resets the global variables to their initial values and prepares another scan. /// </summary> /// <param name="saveBitmaps">Whether to save the scanned bitmaps or not.</param> public void Reset(bool saveBitmaps) { //saves the bitmaps if the user wants to and the scan was a nonempty, correct sudoku if (success && saveBitmaps && !allZero) { Status = "Saving Bitmaps"; BitmapEncoding.SaveBitmaps(storedBitmaps, MaxStoredBitmapsPerDigit); } else { storedBitmaps = BitmapEncoding.LoadBitmaps(); } texture.Play(); Status = "Ready to take picture"; taken = false; TakePictureNow = false; success = false; debugText.enabled = false; SudokuPanel.transform.parent.gameObject.SetActive(false); PicturePanel.SetActive(true); CameraUI.transform.parent.gameObject.SetActive(true); }
/// <summary> /// Open selected file to display right panel. /// </summary> /// <param name="id"></param> private void PreviewById(uint id) { PackResource Res = m_Pack.GetFileByIndex(id); Status.Text = Properties.Resources.Str_LoadingPreview; this.Update(); if (Res != null) { PicturePanel.Hide(); hexBox.ResetText(); TextView.Hide(); pPlay.Hide(); String InternalName = Res.GetName(); string Ext = Path.GetExtension(@InternalName); // loading file content. byte[] buffer = new byte[Res.GetSize()]; Res.GetData(buffer); Res.Close(); MemoryStream ms = new MemoryStream(buffer); switch (Ext) { case ".dds": case ".tga": case ".jpg": case ".gif": case ".png": case ".bmp": if (handle.IsAllocated) { handle.Free(); } string Info = ""; switch (Ext) { case ".dds": case ".tga": Info = "DDS (Direct Draw Surfice)"; break; case ".jpg": Info = "JPEG"; break; case ".gif": Info = "GIF"; break; case ".bmp": Info = "Bitmap"; break; case ".png": Info = "PNG (Portable Network Graphic)"; break; } if (Ext == ".tga" || Ext == ".dds") { PictureView.Image = DDS2Bitmap(ms); } else { PictureView.Image = Image.FromStream(ms); } PictureView.Update(); Status.Text = String.Format("{0} Image file. ({1} x {2})", Info, PictureView.Width, PictureView.Height); PictureView.SizeMode = PictureBoxSizeMode.AutoSize; PicturePanel.AutoScroll = true; PicturePanel.Update(); PicturePanel.Show(); break; case ".xml": case ".html": case ".txt": case ".trn": string text = Encoding.Unicode.GetString(buffer); TextView.Clear(); TextView.Text = text; TextView.Update(); TextView.Show(); Status.Text = String.Format("Ascii file."); break; case ".wav": case ".mp3": pPlay.Show(); // http://msdn.microsoft.com/en-us/library/ms143770%28v=VS.100%29.aspx this.wave = new WavePlayer(buffer); this.wave.Play(); Status.Text = "Sound file."; break; default: if (InternalName == "vf.dat") { TextView.Clear(); TextView.Text = Encoding.ASCII.GetString(buffer); TextView.Update(); TextView.Show(); Status.Text = "Version infomation."; } else { DynamicByteProvider d = new DynamicByteProvider(buffer); hexBox.ByteProvider = d; Status.Text = "Unknown file."; } break; } ms.Dispose(); } this.Update(); }
void modelManager_FrameModified(object sender, ContentsModifiedEventArgs<SaveFrame<Texture2DWithPos>> e) { if (e.Action == ContentAction.Add) { PicturePanel panel = new PicturePanel(this, e.Element); Controls.Add(panel); Controls.SetChildIndex(panel, modelManager.Frames.IndexOf(e.Element)); } else if (e.Action == ContentAction.Remove) { Controls.Remove(getFramePanel(e.Element)); } }
private async void Page_Loading(FrameworkElement sender, object args) { try { string root = Windows.ApplicationModel.Package.Current.InstalledLocation.Path; string path = root + @"\Images"; // Get the folder object that corresponds to // this absolute path in the file system. StorageFolder folder = await StorageFolder.GetFolderFromPathAsync(path); //StorageFolder storageFolder = KnownFolders.PicturesLibrary; //IReadOnlyList<StorageFile> files = await storageFolder.GetFilesAsync(); IReadOnlyList <StorageFile> files = await folder.GetFilesAsync(); imageList.Clear(); int count = files.Count; if (count == 0) { return; } foreach (var file in files) { imageList.Add(file.Path); } if (imageList.Count == 0) { return; } int index = 0; foreach (var item in imageList) { try { StorageFile file = await StorageFile.GetFileFromPathAsync(item); using (IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read)) { BitmapImage image = new BitmapImage(); image.SetSource(fileStream); ImageBrush brush = new ImageBrush(); brush.ImageSource = image; PicturePanel panel = new PicturePanel(); panel._gridBackgroud = brush; Button btn = new Button(); btn.Width = btn.Height = MinPictureWith; btn.BorderThickness = new Thickness(0); btn.Background = new SolidColorBrush(Color.FromArgb(0, 255, 255, 255)); btn.Click += Btn_Click; //btn.Name = item; panel.Name = item; panel.PicButton = btn; if (index > 0 && picturePanels.ContainsKey(index - 1)) { panel.SetValue(RelativePanel.RightOfProperty, picturePanels[index - 1].Name); } else { panel.SetValue(RelativePanel.AlignLeftWithPanelProperty, true); } panel.SetValue(RelativePanel.AlignTopWithPanelProperty, true); picturePanels.Add(index++, panel); picsPanel.Children.Add(panel); } } catch (Exception e) { #if DEBUG System.Diagnostics.Debug.WriteLine(e.Message); #endif continue; } } ResetPicturePanelPositon(); } catch (Exception e) { #if DEBUG System.Diagnostics.Debug.WriteLine(e.Message); #endif } }
/// <summary> /// Main program loop. /// </summary> void Update() { if (!taken) { if ((TakePictureNow && texture != null && texture.isPlaying) || Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.Space)) { //grab the image data from the WebCamTexture taken = true; original = texture.GetPixels(); Color[] pixels = new Color[original.Length]; System.Array.Copy(original, pixels, original.Length); texture.Stop(); print(string.Format("Took {0}x{1} picture", texture.width, texture.height)); //refresh the settings and rotate the texture if it is needed Status = "Loading Settings"; SettingManager.LoadSettings(); ArrayHandling.RotateTexture(ref pixels, texture.width, texture.height, texture.videoRotationAngle); //start a new worker thread debugText.enabled = true; if (workThread != null && workThread.IsAlive) { workThread.Abort(); workThread.Join(200); } workThread = new System.Threading.Thread(() => Worker(pixels)); workThread.Start(); PicturePanel.SetActive(false); CameraUI.transform.parent.gameObject.SetActive(false); } } //check if the worker thread has completed its tasks else if (Status == StatusDone) //this works, but an enum would probably be better suited for this kind of check { Status = ""; debugText.enabled = false; FillSudoku(solvedSudoku, unsolvedSudoku); print("Displayed the result"); #if WRITE_IMAGES_TO_DISK Texture2D originalTexture = new Texture2D(texture.width, texture.height), processedTexture = new Texture2D(side, side); originalTexture.filterMode = FilterMode.Point; originalTexture.SetPixels(original); originalTexture.Apply(); processedTexture.filterMode = FilterMode.Point; processedTexture.SetPixels(debugPicture); processedTexture.Apply(); File.WriteAllBytes(Path.Combine(BitmapEncoding.PersistentPath, "Output.png"), processedTexture.EncodeToPNG()); File.WriteAllBytes(Path.Combine(BitmapEncoding.PersistentPath, "Input.png"), originalTexture.EncodeToPNG()); print("Saved images to " + BitmapEncoding.PersistentPath); #endif } //update explanatory text if it is needed if (debugText.enabled && Status != oldStatus) { if (Status.Contains(StatusError)) { debugText.text = Status; } else { debugText.text = (Status.Length != 0 ? "Please Wait" + System.Environment.NewLine + Status : ""); } oldStatus = Status; } //trigger popup if needed if (Popup.queued != null) { Popup.ActivatePopup(Popup.queued.Value.Key, Popup.queued.Value.Value); Popup.queued = null; } //if the user presses escape (back button on Android), go back/abort calculation/exit the app if (Input.GetKeyDown(KeyCode.Escape)) { var eb = PicturePanel.GetComponentsInChildren <ExtraButtons>(true)[0]; if (PicturePanel.activeInHierarchy || (debugText.enabled && workThread != null && workThread.IsAlive)) { Application.Quit(); } else if (infoPopup.gameObject.activeInHierarchy) { infoPopup.Close(); } else if (QuestionPopup.Instance.gameObject.activeInHierarchy) { QuestionPopup.Instance.Close(false); } else if (digitPrompt.gameObject.activeInHierarchy) { digitPrompt.Choose(-1); } else if (SudokuPanel.activeInHierarchy) { Reset(false); } else if (SettingManager.AdvancedSettingsPanel != null && SettingManager.AdvancedSettingsPanel.activeInHierarchy) { eb.DirectlyFromAdvanced(); } else if (eb.HelpPanel != null && eb.HelpPanel.activeInHierarchy) { eb.ReturnFromHelp(); } } }
private void creataButton_Click_1(object sender, EventArgs e) { graphics = PicturePanel.CreateGraphics(); graphics.Clear(Color.White); drawTree.drawCayleyTree(10, 180, 300, 100, -Math.PI / 2, this.graphics); }