Exemplo n.º 1
0
 public void HighlightPoints()
 {
     new List <PointD>()
     {
         Top, Bottom, LeftTop, LeftBottom, RightTop, RightBottom, Center
     }.ForEach(p => MainImage.Draw(new DrawablePoint(p.X, p.Y)));
 }
Exemplo n.º 2
0
        private async void Fly()
        {
            var rdm = new Random();

            do
            {
                var w = rdm.Next(1, 100);
                var h = rdm.Next(1, 100);

                MainImage.TranslateTo(w, h, 5000, Easing.Linear);
                if (w % 2 == 0)
                {
                    MainImage.ScaleTo(3, 5000, Easing.Linear);
                }
                else
                {
                    MainImage.ScaleTo(2, 5000, Easing.Linear);
                }



                await Task.Delay(5000);

                //await MainImage.TranslateTo(Math.Abs(w), Math.Abs(h), 5000, Easing.Linear);
            } while (true);
        }
Exemplo n.º 3
0
 /// <summary>
 /// RegistrationTool.xaml 的视图模型
 /// </summary>
 public RegistrationToolViewModel()
 {
     //应用程序标题
     Title = "注册工具";
     //设置软件图标
     MainAppLargeIcon = ImageHelper.ByteArrayToImageSource(MainImage.GetImageByteArray("AppLargeIcon"));
 }
Exemplo n.º 4
0
        private void drawSplineToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_points.Count == 0)
            {
                return;
            }

            float[] ex;
            float[] ey;


            CubicSpline.FitParametric(_points.Select(x => x.X).ToArray(), _points.Select(x => x.Y).ToArray(), _points.Count * 100, out ex, out ey);
            using (Graphics g = Graphics.FromImage(MainImage.Image))
            {
                for (int i = 1; i < _points.Count; i++)
                {
                    g.DrawLine(new Pen(Color.Green, 1), _points[i - 1], _points[i]);
                }

                for (int i = 1; i < ex.Length; i++)
                {
                    g.DrawLine(new Pen(Color.Red, 2), ex[i - 1], ey[i - 1], ex[i], ey[i]);
                }

                g.DrawCurve(new Pen(Color.Blue), _points.ToArray());
            }
            MainImage.Invalidate();
            MessageBox.Show("RED: Spline interpolation\r\nBLUE: C# Curve line\r\nGREEN: Line by points", "INFO",
                            MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
        }
Exemplo n.º 5
0
        protected override void OnCreate(Bundle bundle)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Viewer);
            // associate the views
            MainImage   = FindViewById <ZoomImageView>(Resource.Id.MainImage);
            Zoom        = FindViewById <ZoomControls>(Resource.Id.ZoomButtons);
            OpenButton  = FindViewById <ImageButton>(Resource.Id.OpenButton);
            LeftButton  = FindViewById <ImageButton>(Resource.Id.LeftButton);
            RightButton = FindViewById <ImageButton>(Resource.Id.RightButton);
            // wire the views
            Zoom.ZoomInClick  += (src, args) => MainImage.ZoomIn();
            Zoom.ZoomOutClick += (src, args) => MainImage.ZoomOut();
            OpenButton.Click  += (src, args) => OnOpenButtonClick(args);
            LeftButton.Click  += (src, args) => OnLeftButtonClick(args);
            RightButton.Click += (src, args) => OnRightButtonClick(args);
            // get preferences
            var prefs = GetSharedPreferences("Global", FileCreationMode.Private);

            // check bundles and prefs
            if (Intent.Extras != null && Intent.Extras.ContainsKey("ComicsPath"))
            {
                Controller = new ViewerController(this, Intent.Extras.GetString("ComicsPath"));
            }
            else if (bundle != null && bundle.ContainsKey("ComicsPath"))
            {
                Controller = new ViewerController(this, bundle.GetString("ComicsPath"));
            }
            else
            {
                Controller = new ViewerController(this, prefs.GetString("ComicsPath", null));
            }
        }
Exemplo n.º 6
0
        private void MainImage_MouseMove(object sender, MouseEventArgs e)
        {
            if (MainImage.Image == null)
            {
                return;
            }

            if (_painted)
            {
                int r = new Random().Next(0, 10);
                if (r % 2 == 0)
                {
                    return;
                }

                if (_points.Where(x => (int)x.Y == e.Y && (int)x.X == e.X).ToList().Count == 0)
                {
                    _points.Add(e.Location);
                    using (Graphics g = Graphics.FromImage((Bitmap)MainImage.Image))
                    {
                        g.DrawRectangle(new Pen(Color.Green), e.X, e.Y, 1, 1);
                    }
                    MainImage.Invalidate();
                }
            }
        }
Exemplo n.º 7
0
 private void MainImage_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (DataContext is ViewModel vm)
     {
         if (e.LeftButton == MouseButtonState.Pressed)
         {
             if (e.ClickCount == 2)
             {
                 vm.SolidMode = false;
                 vm.SetRotation(0.0, 0.0);
             }
             else if (e.ClickCount < 2)
             {
                 _draggingMode = DraggingMode.Left;
                 _x            = vm.CenterX;
                 _y            = vm.CenterY;
                 _dragStart    = e.GetPosition(MainImage);
                 MainImage.CaptureMouse();
             }
         }
         else if (e.RightButton == MouseButtonState.Pressed)
         {
             _draggingMode = DraggingMode.Right;
             _x            = vm.Yaw;
             _y            = vm.Pitch;
             _dragStart    = e.GetPosition(MainImage);
             MainImage.CaptureMouse();
         }
         else
         {
             _draggingMode = DraggingMode.None;
             MainImage.ReleaseMouseCapture();
         }
     }
 }
Exemplo n.º 8
0
    public static void GeneratePDF()
    {
        var TC = new TextContainer();


        var img = new MainImage();

        var textManager = GameObject.FindObjectOfType <TextManager>();
        var TMrect      = textManager.GetComponent <RectTransform>().rect;

        img.x          = TMrect.yMin;
        img.y          = TMrect.xMin;
        img.width      = TMrect.width;
        img.height     = TMrect.height;
        img.totalPages = textManager.images.Count;

        TC.image = img;


        TC.list = new List <TextJSON>();

        foreach (var c in GameObject.FindObjectsOfType <TextItem>())
        {
            TC.list.Add(c.toJSON());
        }

        var str = JsonConvert.SerializeObject(TC, Formatting.Indented);

        EditorGUIUtility.systemCopyBuffer = str;
    }
Exemplo n.º 9
0
        void InitializeBeacons()
        {
            StopRanging();

            if (viewModel.Quest.Major >= 0)
            {
                beaconRegion = new CLBeaconRegion(new NSUuid(viewModel.UUID), (ushort)viewModel.Quest.Major, BeaconId);
                beaconRegion.NotifyOnExit  = true;
                beaconRegion.NotifyOnEntry = true;
            }

            InvokeOnMainThread(() =>
            {
                Beacon1.Image  = Beacon2.Image = Beacon3.Image = undiscoveredBeacon;
                Beacon1.Hidden = Beacon2.Hidden = Beacon3.Hidden = true;
                SetBeaconText(false);
                for (int i = 0; i < viewModel.Quest.Beacons.Count; i++)
                {
                    beacons[i].Hidden = false;
                }

                UpdateBeacons();
                MainImage.LoadUrl(viewModel.Quest.Clue.Image);
                MainText.Text = viewModel.Quest.Clue.Message;
            });
            StartRanging();
        }
Exemplo n.º 10
0
        private void DrawTopPlate()
        {
            if (TopPlate == PlateType.Text)
            {
                var text = GetText();

                PrepareForPlate(text, Plate.Top, Gravity.West);

                text.Scale(new Percentage(((MainImage.Height / 2d)) / text.Height * 90d));
                //text.Write("text-plate-modified.png");

                MainImage.Composite(text, /*Scale(570, 310)*/ new PointD((((MainImage.Width - (Scale(FrameThickness + FrameMargin * 2))) - text.Width) / 2) + Scale(FrameMargin + FrameThickness), Scale(FrameMargin + FrameThickness)), CompositeOperator.Over);
            }
            else if (TopPlate == PlateType.Image)
            {
                //TopPlateImage.Scale(new Percentage(((MainImage.Width / 2d)) / TopPlateImage.Width * 100d));
                PrepareForPlate(TopPlateImage, Plate.Top);
                TopPlateImage.Scale(new Percentage(((MainImage.Height / 2d)) / TopPlateImage.Height * TopPlateImagePercentage));

                MainImage.Composite(TopPlateImage, /*Scale(570, 310)*/ new PointD((((MainImage.Width - (Scale((FrameMargin + FrameMargin) * 2))) - TopPlateImage.Width) / 2) + Scale(FrameMargin + FrameThickness), /*Scale(FrameMargin) + */ (((100d - TopPlateImagePercentage) / 200d) * Center.Y)), CompositeOperator.Over);
            }
            else if (TopPlate == PlateType.Empty)
            {
                return;
            }
        }
Exemplo n.º 11
0
        private async void UndoExecute()
        {
            _buffer        = new int[MainImage.PixelWidth * MainImage.PixelHeight];
            _maskBuffer    = new byte[MainImage.PixelWidth * MainImage.PixelHeight];
            _filterApplied = false;

            _originalStream.Seek(0, SeekOrigin.Begin);
            _editingSession = await EditingSessionFactory.CreateEditingSessionAsync(_originalStream);

            await _editingSession.RenderToWriteableBitmapAsync(MainImage);

            MainImage.Invalidate();

            CanApply   = false;
            _noChanges = true;
            UndoCommand.RaiseCanExecuteChanged();

            if (PreviewImage != null)
            {
                for (var i = 0; i < PreviewImage.Pixels.Length; ++i)
                {
                    PreviewImage.Pixels[i] = 0;
                }
                PreviewImage.Invalidate();
            }

            BindTool();
        }
Exemplo n.º 12
0
 /// <summary>
 /// Encryption.xaml 的视图模型
 /// </summary>
 public EncryptionViewModel()
 {
     //应用程序标题
     Title = "加密解密工具";
     //设置软件图标
     MainAppLargeIcon = ImageHelper.ByteArrayToImageSource(MainImage.GetImageByteArray("AppLargeIcon"));
 }
Exemplo n.º 13
0
        private void InitializeCompositor()
        {
            compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;
            InitializeEffects();
            MainImage.Source = item.ImageSource;
            MainImage.InvalidateArrange();

            var destinationBrush = compositor.CreateBackdropBrush();

            var graphicsEffectFactory = compositor.CreateEffectFactory(graphicsEffect, new[] {
                "SaturationEffect.Saturation", "ExposureEffect.Exposure", "Blur.BlurAmount",
                "TemperatureAndTintEffect.Temperature", "TemperatureAndTintEffect.Tint",
                "ContrastEffect.Contrast"
            });

            combinedBrush = graphicsEffectFactory.CreateBrush();
            combinedBrush.SetSourceParameter("Backdrop", destinationBrush);

            var effectSprite = compositor.CreateSpriteVisual();

            effectSprite.Size  = new Vector2((float)item.ImageSource.PixelWidth, (float)item.ImageSource.PixelHeight);
            effectSprite.Brush = combinedBrush;
            ElementCompositionPreview.SetElementChildVisual(MainImage, effectSprite);

            editingInitialized = true;
        }
Exemplo n.º 14
0
        public void AcceptImages()
        {
            var isSliced = false;

            if (buttonSprite != null)
            {
                var border = buttonSprite.border;
                isSliced = border.x > 0 || border.y > 0 || border.z > 0 || border.w > 0;
            }

            MainImage.sprite   = buttonSprite;
            ShadowImage.sprite = buttonSprite;

            if (isSliced)
            {
                ShadowTrs.sizeDelta = MainTrs.sizeDelta;
                SetAllDirty();
            }
            else
            {
                MainImage.SetNativeSize();
                ShadowImage.SetNativeSize();
            }

            ShadowImage.color = shadowColor;

            ShadowTrs.localPosition = new Vector2(MainTrs.localPosition.x, MainTrs.localPosition.y - PressingDown);
        }
Exemplo n.º 15
0
        private void imgCanny_Click(object sender, EventArgs e)
        {
            resetControl();
            if (this.image == null)
            {
                MessageBox.Show("Please upload image first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                lblHigh.Show();
                trackHigh.Show();

                lblLow.Show();
                trackLow.Show();

                lblAperture.Show();
                comboAperture.Show();

                this.lblCanny.Font      = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold);
                this.lblCanny.ForeColor = System.Drawing.Color.Aqua;

                this.imgMain.Image = this.canny.ToBitmap();

                this.flag = MainImage.canny;
            }
        }
Exemplo n.º 16
0
        private void resetControl()
        {
            comboAperture.SelectedIndex = 0;

            gbEditor.Enabled = true;

            lblAperture.Hide();
            comboAperture.Hide();

            lblHigh.Hide();
            trackHigh.Hide();

            lblLow.Hide();
            trackLow.Hide();

            this.lblCanny.Font   = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular);
            this.lblLaplace.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular);
            this.lblSobel.Font   = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular);

            this.lblCanny.ForeColor   = System.Drawing.Color.Black;
            this.lblLaplace.ForeColor = System.Drawing.Color.Black;
            this.lblSobel.ForeColor   = System.Drawing.Color.Black;

            this.flag = MainImage.ori;
        }
Exemplo n.º 17
0
 private void AnimateIn()
 {
     MainImage.LayoutTo(detailsRect, 1200, Easing.SpringOut);
     BottomFrame.TranslateTo(0, 0, 1200, Easing.SpringOut);
     Title.TranslateTo(0, 0, 1200, Easing.SpringOut);
     ExpandBar.FadeTo(.01, 250, Easing.SinInOut);
 }
Exemplo n.º 18
0
 private void AnimateOut()
 {
     MainImage.LayoutTo(expandedRect, 1200, Easing.SpringOut);
     BottomFrame.TranslateTo(0, BottomFrame.Height, 1200, Easing.SpringOut);
     Title.TranslateTo(-Title.Width, 0, 1200, Easing.SpringOut);
     ExpandBar.FadeTo(1, 250, Easing.SinInOut);
 }
Exemplo n.º 19
0
 /// <summary>
 /// DBConversion.xaml 的视图模型
 /// </summary>
 public DBConversionViewModel()
 {
     //应用程序标题
     Title = "数据库转换工具";
     //设置软件图标
     MainAppLargeIcon = ImageHelper.ByteArrayToImageSource(MainImage.GetImageByteArray("AppLargeIcon"));
 }
Exemplo n.º 20
0
        private async void DoSome()
        {
            //await Task.Delay(2000);
            await MainImage.ScaleTo(3, 500, Easing.Linear);

            Fly2();
        }
Exemplo n.º 21
0
 /// <summary>
 /// FileSharing.xaml 的视图模型
 /// </summary>
 public FileSharingViewModel()
 {
     //应用程序标题
     Title = "文件共享工具";
     //设置软件图标
     MainAppLargeIcon = ImageHelper.ByteArrayToImageSource(MainImage.GetImageByteArray("AppLargeIcon"));
 }
Exemplo n.º 22
0
    public void OnTapNext()
    {
        MainImage mainImageOpe = GameObject.Find("MainImage").GetComponent <MainImage>();

        mainImageOpe.SetImages();

        SceneManager.LoadScene(1);
    }
Exemplo n.º 23
0
 private void SaveExecute()
 {
     using (var mediaLibrary = new MediaLibrary())
         using (var stream = MainImage.ToStream())
         {
             mediaLibrary.SavePicture("SavedPicture.jpg", stream);
         }
 }
Exemplo n.º 24
0
 private void AnimateIn()
 {
     MainImage.LayoutTo(detailsRect, animationSpeed, Easing.SpringOut);
     BottomFrame.TranslateTo(0, 0, animationSpeed, Easing.SpringOut);
     Title.TranslateTo(0, 0, animationSpeed, Easing.SpringOut);
     Title.Opacity = 1;
     ExpandBar.FadeTo(.01, 250, Easing.SinInOut);
 }
Exemplo n.º 25
0
 /// <summary>
 /// FileSharingSettings.xaml 的视图模型
 /// </summary>
 public FileSharingSettingsViewModel()
 {
     //应用程序标题
     Title = "文件共享设置";
     //设置软件图标
     MainAppLargeIcon = ImageHelper.ByteArrayToImageSource(MainImage.GetImageByteArray("AppLargeIcon"));
     //初始化数据
     SetSharingIndex = 0;
 }
Exemplo n.º 26
0
        private void Images_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count > 0)
            {
                MainImage.LoadImage((e.AddedItems[0] as Photo).Path);

                MainImage.Reset();
            }
        }
Exemplo n.º 27
0
 /// <summary>
 /// QRCode.xaml 的视图模型
 /// </summary>
 public QRCodeViewModel()
 {
     //应用程序标题
     Title = "生成二维码工具";
     //设置软件图标
     MainAppLargeIcon = ImageHelper.ByteArrayToImageSource(MainImage.GetImageByteArray("AppLargeIcon"));
     //默认不使用LOGO
     BISExistenceLogo = false;
     //设置初始二维码LOGO
     QRCodeLogo = ImageHelper.ByteArrayToImageSource(MainImage.GetImageByteArray("QRCodeLogo"));
 }
Exemplo n.º 28
0
 /// <summary>
 /// DBConnection.xaml 的视图模型
 /// </summary>
 /// <param name="eventAggregator">Defines an interface to get instances of an event type.</param>
 /// <param name="strDataBaseName">数据库名称 SqlServer/Oracle/MySql/Access/SQLite</param>
 public DBConnectionViewModel(IEventAggregator eventAggregator, string strDataBaseName)
 {
     //委托Load方法
     LoadedCommand = new DelegateCommand <Window>(Window_Loaded);
     //应用程序标题
     Title = "连接数据库";
     //设置软件图标
     MainAppLargeIcon = ImageHelper.ByteArrayToImageSource(MainImage.GetImageByteArray("AppLargeIcon"));
     //赋值全局变量数据库名称
     this.strDataBaseName = strDataBaseName;
     //赋值全局变量消息机制
     this.eventAggregator = eventAggregator;
     //初始化控件
     if (strDataBaseName.Equals(TypeProcessing.DataBase.SqlServer.ToString()))
     {
         DisplaySqlServer = Visibility.Visible;
         DisplayOracle    = Visibility.Hidden;
         DisplayMySql     = Visibility.Hidden;
         DisplayAccess    = Visibility.Hidden;
         DisplaySQLite    = Visibility.Hidden;
     }
     else if (strDataBaseName.Equals(TypeProcessing.DataBase.Oracle.ToString()))
     {
         DisplaySqlServer = Visibility.Hidden;
         DisplayOracle    = Visibility.Visible;
         DisplayMySql     = Visibility.Hidden;
         DisplayAccess    = Visibility.Hidden;
         DisplaySQLite    = Visibility.Hidden;
     }
     else if (strDataBaseName.Equals(TypeProcessing.DataBase.MySql.ToString()))
     {
         DisplaySqlServer = Visibility.Hidden;
         DisplayOracle    = Visibility.Hidden;
         DisplayMySql     = Visibility.Visible;
         DisplayAccess    = Visibility.Hidden;
         DisplaySQLite    = Visibility.Hidden;
     }
     else if (strDataBaseName.Equals(TypeProcessing.DataBase.Access.ToString()))
     {
         DisplaySqlServer = Visibility.Hidden;
         DisplayOracle    = Visibility.Hidden;
         DisplayMySql     = Visibility.Hidden;
         DisplayAccess    = Visibility.Visible;
         DisplaySQLite    = Visibility.Hidden;
     }
     else if (strDataBaseName.Equals(TypeProcessing.DataBase.SQLite.ToString()))
     {
         DisplaySqlServer = Visibility.Hidden;
         DisplayOracle    = Visibility.Hidden;
         DisplayMySql     = Visibility.Hidden;
         DisplayAccess    = Visibility.Hidden;
         DisplaySQLite    = Visibility.Visible;
     }
 }
        void Window_Closing(object sender, CancelEventArgs e)
        {
            if (isReadyToClose)
            {
                return;
            }

            e.Cancel = true;
            var imageUnloadStoryboard = (Storyboard)MainImage.FindResource("ImageUnloadStoryboard");

            imageUnloadStoryboard.Begin(MainImage);
        }
Exemplo n.º 30
0
        private void ShareExecute()
        {
            using (var fileStream = _isoStore.CreateFile(SharedFileName))
            {
                MainImage.SaveJpeg(fileStream, ImageWidth, ImageHeight, 0, 100);

                var task = new ShareMediaTask {
                    FilePath = SharedFileName
                };
                task.Show();
            }
        }