//初始化成员 public SliderData(NumericUpDown numericUpDown, PhotoAction action, int imageIndexLow, int imageIndexHigh) { this.NumericUpDown = numericUpDown; this.Action = action; this.ImageIndexLow = imageIndexLow; this.ImageIndexHigh = imageIndexHigh; }
public Effect(PhotoAction action, int xClick, int yClick, int cRaidus, bool marker) { this.action = action; this.xClick = xClick; this.yClick = yClick; this.cRaidus = cRaidus; this.marker = marker; }
public ActionItem(PhotoAction action) { // 存储数值 _action = action; // 存储个滑块的当前值 SetSliderValues(Global.SliderValues.Contrast, Global.SliderValues.Brightness, Global.SliderValues.Gamma, Global.SliderValues.Saturation); }
public ActionItem(PhotoAction acction, Rectangle bounds) { //存储数值 _action = acction; _bounds = bounds; //存储个滑块的当前值 SetSliderValues(Global.SliderValues.Contrast, Global.SliderValues.Brightness, Global.SliderValues.Gamma, Global.SliderValues.Saturation); }
public ActionItem(PhotoAction action, int percent) { // store values _action = action; _percent = percent; // store the current slider values SetSliderValues(Global.SliderValues.Contrast, Global.SliderValues.Brightness, Global.SliderValues.Gamma, Global.SliderValues.Saturation); }
public ActionItem(ActionItem actionItem) { //存储数值 _action = actionItem.Action; _percent = actionItem.Percent; _bounds = actionItem.Bounds; //存储个滑块的当前值 SetSliderValues(Global.SliderValues.Contrast, Global.SliderValues.Brightness, Global.SliderValues.Gamma, Global.SliderValues.Saturation); }
public void MofifyImage(PhotoAction action,int xClick, int yClick) { if (InvalidCount > 0) { InvalidCount--; return; } bool mark = Interlocked.CompareExchange(ref marker, 0, 1) == 1; Effect effect = new Effect(action, xClick, yClick, radius, mark); switch (action) { case PhotoAction.Gray: MofifyImageImpl(grayImagePixels, xClick, yClick, radius); doneEffects.Push(effect); break; case PhotoAction.Color: MofifyImageImpl(originalImagePixels, xClick, yClick, radius); doneEffects.Push(effect); break; } }
private void ToogleBrush(object sender, EventArgs e) { //changebutton = sender as ApplicationBarIconButton; if(action == PhotoAction.Gray) { action = PhotoAction.Color; changebutton.Text = "Gray"; ColoringTitle.Text = "NOW COLORING"; ColoringTitle.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 0)); changebutton.IconUri = new Uri("/Images/appbar.gray.png", UriKind.RelativeOrAbsolute); TileImage.Source = new BitmapImage(new Uri("/Images/StripeColorful.png", UriKind.RelativeOrAbsolute)); } else { action = PhotoAction.Gray; changebutton.Text = "Color"; ColoringTitle.Text = "NOW ERASING"; ColoringTitle.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)); changebutton.IconUri = new Uri("/Images/appbar.color.png", UriKind.RelativeOrAbsolute); TileImage.Source = new BitmapImage(new Uri("/Images/StripeBW.png", UriKind.RelativeOrAbsolute)); } }
private void StartLoadingImage(Stream choosenPhoto) { image.Visibility = Visibility.Collapsed; warning.Text = "LOADING GRAYSCALE PICTURE..."; ColoringTitle.Text = ""; TileImage.Source = null; iamgeProgressBar.IsIndeterminate = true; imageMan = new ImageManipulator(choosenPhoto, image, brush.Size); ThreadStart loadStart = new ThreadStart( () => { DateTime Start = DateTime.Now; imageMan.convertToBlackWhite(); int timeSpend = (int)(DateTime.Now - Start).TotalMilliseconds; if( timeSpend < 2000) { Thread.Sleep(2000 - timeSpend); } Dispatcher.BeginInvoke( () => { warning.Text = ""; action = PhotoAction.Gray; ToogleBrush(changebutton, null); image.RenderTransform = GetDefaultTransform(); image.Width = ContentPanel.ActualWidth; image.Height = (image.Width*imageMan.originalImage.PixelHeight)/imageMan.originalImage.PixelWidth; image.Source = imageMan.finalImage; image.Visibility = Visibility.Visible; iamgeProgressBar.IsIndeterminate = false; }); System.GC.Collect(); } ); Thread loadImage=new Thread(loadStart); loadImage.Start(); }
/// <summary> /// Event handler for when the user wants to delete the image from the qustion /// </summary> private void Remove_Activated(object sender, EventArgs e) { this.currentAction = PhotoAction.delete; this.Navigation.PopAsync(); }
/// <summary> /// Event handler for when the user wants to change the image from the qustion /// </summary> private void ChangePhoto_Activated(object sender, EventArgs e) { this.currentAction = PhotoAction.change; this.Navigation.PopAsync(); }
public ActionEventArgs(PhotoAction action) { _actionItem = new ActionItem(action); }