void CreateAndAddAdornment(ITextViewLine line, SnapshotSpan span, Brush brush, bool extendToRight)
        {
            var markerGeometry = _view.TextViewLines.GetMarkerGeometry(span);

            double left = 0;
            double width = _view.ViewportWidth + _view.MaxTextRightCoordinate;
            if (markerGeometry != null)
            {
                left = markerGeometry.Bounds.Left;
                if (!extendToRight) width = markerGeometry.Bounds.Width;
            }

            Rect rect = new Rect(left, line.Top, width, line.Height);

            RectangleGeometry geometry = new RectangleGeometry(rect);

            GeometryDrawing drawing = new GeometryDrawing(brush, new Pen(), geometry);
            drawing.Freeze();

            DrawingImage drawingImage = new DrawingImage(drawing);
            drawingImage.Freeze();

            Image image = new Image();
            image.Source = drawingImage;

            Canvas.SetLeft(image, geometry.Bounds.Left);
            Canvas.SetTop(image, geometry.Bounds.Top);

            _layer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, null, image, null);
        }
Exemple #2
0
		static PainterCache()
		{
            UseTransparentImage = true;
			try
			{
				TransparentBrush = new SolidColorBrush(Colors.Transparent);
				TransparentBrush.Freeze();
				BlackBrush = new SolidColorBrush(Colors.Black);
				BlackBrush.Freeze();
				WhiteBrush = new SolidColorBrush(Colors.White);
				WhiteBrush.Freeze();
				ZonePen = new Pen(BlackBrush, 1);
				GridLineBrush = new SolidColorBrush(Colors.Orange);
				GridLineBrush.Freeze();
				GridLinePen = new Pen(GridLineBrush, 1);
				GridLinePen.EndLineCap = PenLineCap.Square;
				GridLinePen.StartLineCap = PenLineCap.Square;
				GridLinePen.DashStyle = DashStyles.Dash;
				PointGeometry = new RectangleGeometry(new Rect(-15, -15, 30, 30));
				_transparentBackgroundBrush = CreateTransparentBackgroundBrush();
			}
			catch (Exception e)
			{
				Logger.Error(e, "PainterCache.PainterCache()");
			}
		}
Exemple #3
0
 protected override GeometryHitTestResult HitTestCore
         (GeometryHitTestParameters hitTestParameters)
 {
     var geometry = new RectangleGeometry(VisualTreeHelper.GetDescendantBounds(this));
     return new GeometryHitTestResult
      (this, geometry.FillContainsWithDetail(hitTestParameters.HitGeometry));
 }
        public void Init()
        {
            OldClipRect = new RectangleGeometry(new Rect(0, 0, SpectrumGraph.ActualWidth, SpectrumGraph.myGrid.RowDefinitions[0].ActualHeight));
            this.BackImg.Clip = OldClipRect;
            _bmp = BitmapFactory.New((int)this.ActualWidth, (int)this.myGrid.RowDefinitions[0].ActualHeight);
            _backBmp = BitmapFactory.New((int)this.ActualWidth, (int)this.myGrid.RowDefinitions[1].ActualHeight);
            RenderTargetBitmap tarBmp = new RenderTargetBitmap((int)this.ActualWidth, (int)this.myGrid.RowDefinitions[1].ActualHeight, 96,96,PixelFormats.Pbgra32);
            this.GraphImg.Source = _bmp;
            this.GraphImg.Stretch = Stretch.None;

            this.BackImg.Background = Brushes.Black;
            for (int i = 1; i < ConfigManager.ECGDeviceFrequensy; i++ )
            {
                if (i % 10 == 0)
                {
                    int k = i < 100 ? 7 : 17;
                    Text(i * this.ActualWidth / ConfigManager.ECGDeviceFrequensy-k, 25, i.ToString(), Colors.Green);
                    Text(i * this.ActualWidth / ConfigManager.ECGDeviceFrequensy, 0, "|", Colors.Green);
                }
            }
            //this.BackImg.D = _backBmp;
            //this.BackImg.Stretch = Stretch.None;

            ClearImage();
        }
        public MainWindow()
        {
            InitializeComponent();

            drawingGroup = new DrawingGroup();

            // Создаем объект для описания геометрической фигуры
            GeometryDrawing geometryDrawing = new GeometryDrawing();

            // Описываем и сохраняем геометрию квадрата
            RectangleGeometry rectGeometry = new RectangleGeometry();
            rectGeometry.Rect = new Rect(0, 0, 10, 10);
            geometryDrawing.Geometry = rectGeometry;

            // Настраиваем перо и кисть
            geometryDrawing.Pen = new Pen(Brushes.Red, 0.005);// Перо рамки
            geometryDrawing.Brush = Brushes.LightBlue;// Кисть закраски

            // Добавляем готовый слой в контейнер отображения
            drawingGroup.Children.Add(geometryDrawing);

            GeometryDrawing ellipsgeomy = new GeometryDrawing();

            EllipseGeometry elgeometry = new EllipseGeometry(new Point(5, 5), 2, 2);

            ellipsgeomy.Geometry = elgeometry;

            ellipsgeomy.Brush = Brushes.White;

            drawingGroup.Children.Add(ellipsgeomy);
        }
        /// <summary>
        /// Creates a square image and attaches an event handler to the layout changed event that
        /// adds the the square in the upper right-hand corner of the TextView via the adornment layer
        /// </summary>
        /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param>
        public TranslationAdornment(IWpfTextView view)
        {
            _view = view;

            Brush brush = new SolidColorBrush(Colors.BlueViolet);
            brush.Freeze();
            Brush penBrush = new SolidColorBrush(Colors.Red);
            penBrush.Freeze();
            Pen pen = new Pen(penBrush, 0.5);
            pen.Freeze();

            //draw a square with the created brush and pen
            System.Windows.Rect r = new System.Windows.Rect(0, 0, 30, 30);
            Geometry g = new RectangleGeometry(r);
            GeometryDrawing drawing = new GeometryDrawing(brush, pen, g);
            drawing.Freeze();

            DrawingImage drawingImage = new DrawingImage(drawing);
            drawingImage.Freeze();

            _image = new Image();
            _image.Source = drawingImage;

            //Grab a reference to the adornment layer that this adornment should be added to
            _adornmentLayer = view.GetAdornmentLayer("TranslationAdornment");

            _view.ViewportHeightChanged += delegate { this.onSizeChange(); };
            _view.ViewportWidthChanged += delegate { this.onSizeChange(); };
        }
Exemple #7
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.gridMain = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.rectClip = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 3:
                this.imgSlideshow1 = ((System.Windows.Controls.Image)(target));
                return;

            case 4:
                this.imgSlideshow2 = ((System.Windows.Controls.Image)(target));
                return;

            case 5:
                this.mediaPlayer = ((System.Windows.Controls.MediaElement)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemple #8
0
        public ModalControl()
        {
            DefaultStyleKey = typeof(ModalControl);

            Clip = _clip = new RectangleGeometry();

            KeyDown += (sender, e) =>
            {
                if (!e.Handled && e.Key == System.Windows.Input.Key.Escape && _content.Any())
                {
                    e.Handled = true;
                    _content.Last().OnEscPressed();
                }
            };

            LayoutUpdated += (sender, ars) =>
            {
                enqueTargetPointUpdate();
                if (Clip != _clip)
                {
                    Clip = _clip;
                }
                _clip.Rect = new Rect(new Point(), RenderSize);
            };
        }
 public FrameworkElement GetOneInfoInsideRect(RectangleGeometry rect) {
     _infoShape = null;
     VisualTreeHelper.HitTest(_graphCanvas, null,
         InfoHitTestSelOneResultCallback,
         new GeometryHitTestParameters(rect));
     return _infoShape;
 }
Exemple #10
0
        private void PhoneSlider_SizeChanged(
            object sender, SizeChangedEventArgs e)
        {
            if (e.NewSize.Width <= 0 || e.NewSize.Height <= 0)
                return;

            var clipRect = new Rect(0, 0,
                e.NewSize.Width, e.NewSize.Height);

            if (Orientation == Orientation.Horizontal)
            {
                clipRect.X -= 12;
                clipRect.Width += 24;

                var margin = Resources["PhoneHorizontalMargin"];
                if (margin != null)
                    Margin = (Thickness)margin;
            }
            else
            {
                clipRect.Y -= 12;
                clipRect.Height += 24;

                var margin = Resources["PhoneVerticalMargin"];
                if (margin != null)
                    Margin = (Thickness)margin;
            }

            Clip = new RectangleGeometry
            {
                Rect = clipRect
            };
        }
Exemple #11
0
        public ImageSprite(Texture2D texture, ImageSourceId sourceId)
        {
            image = new Image();
            var source = texture.GetSpecialSource(sourceId.ForTextureLookup);

            image.Source = source;
            image.Width  = source.PixelWidth;
            image.Height = source.PixelHeight;

            base.Create(image, sourceId.Cache, true);

            if (sourceId.DynamicColor)
            {
                // Note: This tint effect does not apply additive blending
                //       (because theoretically the non-additive version should be faster).
                //       Additive-ness is already applied at the image source.
                //       (Ditto for Opaque blending)
                canvas.Effect = tintEffect = TintEffect.Create(TintEffectMode.Normal);
            }

            if (sourceId.DynamicRectangle)
            {
                image.Clip = clipGeometry = new SWM.RectangleGeometry();
            }
        }
 public object GetNodeOrRailUnderMouse(RectangleGeometry rect) {
     _nodeUnderMouse = null;
     _railUnderMouse = null;
     VisualTreeHelper.HitTest(_graphCanvas, null,
         NodeOrRailHitTestSelOnlyOneNodeCallback,
         new GeometryHitTestParameters(rect));
     return (object)_nodeUnderMouse ?? _railUnderMouse;
 }
Exemple #13
0
		public void CustomRect ()
		{
			RectangleGeometry rg = new RectangleGeometry ();
			rg.Rect = new Rect (1, 2, 3, 4);
			Assert.AreEqual (new Rect (1, 2, 3, 4), rg.Rect, "Rect");
			Assert.AreEqual (rg.Rect, rg.Bounds, "Bounds");
			Assert.IsNull (rg.Transform, "Transform");
		}
 private Geometry TransalteRectGeometry(RectangleGeometry rectGeometry, Vector offset, double scale)
 {
     RectangleGeometry result = new RectangleGeometry();
     result.Rect = OffsetRect(rectGeometry.Rect, offset, scale);
     result.RadiusX = rectGeometry.RadiusX;
     result.RadiusY = rectGeometry.RadiusY;
     return result;
 }
Exemple #15
0
 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     FullRect = (RectangleGeometry)GetTemplateChild("FullRect");
     HeaderRect = (RectangleGeometry)GetTemplateChild("HeaderRect");
     HeaderContainer = (ContentControl)GetTemplateChild("HeaderContainer");
     HeaderContainer.SizeChanged += HeaderContainer_SizeChanged;
 }
 private void btClipRect_Click(object sender, RoutedEventArgs e)
 {
     RectangleGeometry rect = new RectangleGeometry();
     rect.Rect = new Rect(50, 50, 250, 200);
     rect.RadiusX = 10;
     rect.RadiusY = 20;
     img.Clip = rect;
 }
Exemple #17
0
		public void Defaults ()
		{
			RectangleGeometry rg = new RectangleGeometry ();
			Assert.AreEqual (0.0, rg.RadiusX, "RadiusX");
			Assert.AreEqual (0.0, rg.RadiusY, "RadiusY");
			Assert.AreEqual (new Rect (0, 0, 0, 0), rg.Rect, "Rect");
			GeometryTest.CheckDefaults (rg);
		}
Exemple #18
0
 protected void NewWindow_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (IsCornerRadius)
     {
         System.Windows.Rect r = new System.Windows.Rect(e.NewSize);
         RectangleGeometry gm = new RectangleGeometry(r, 7, 7); // 40 is radius here
         ((UIElement)sender).Clip = gm;
     }
 }       
    public override void OnApplyTemplate()
    {
      base.OnApplyTemplate();

      BodyRectangle = (RectangleGeometry)GetTemplateChild(ElementBodyRectangletName);
      HeaderRectangle = (RectangleGeometry)GetTemplateChild(ElementHeaderRectangleName);
      HeaderContainer = (ContentControl)GetTemplateChild(ElementHeaderContainerName);
      HeaderContainer.SizeChanged += HeaderContainer_SizeChanged;
    }
Exemple #20
0
 public override bool AreBoundaryIntersecting(FrameworkElement item)
 {
    RectangleGeometry itemBounds =
        new RectangleGeometry(new Rect(0, 0, item.ActualWidth, item.ActualHeight));
    RectangleGeometry rulerBounds =
        new RectangleGeometry(new Rect(0, 0, this.ActualWidth, this.ActualHeight));
    itemBounds.Transform = (Transform)item.TransformToVisual(this);
    return itemBounds.FillContainsWithDetail(rulerBounds) != IntersectionDetail.Empty;
 }
        public static void DrawRectangle(this DrawingGroup drawingGroup, Rect rect, SolidColorBrush brush, Pen pen = null)
        {
            if (pen == null)
                pen = new Pen(brush, 1);

            var rectangleGeometry = new RectangleGeometry(rect);
            var rectangleDrawing = new GeometryDrawing(brush, pen, rectangleGeometry);
            drawingGroup.Children.Add(rectangleDrawing);
        }
        protected override Geometry GetOrCreateBoxGeometry(Size renderSize)
        {
            var rect = new Rect(new Point(0, 0), renderSize);
            this.SetCurrentValue(RectProperty, rect);
            if (rect.Width <= 0 || rect.Height <= 0)
            {
                return Geometry.Empty;
            }

            if (this.CornerRadius.IsAllEqual())
            {
                // using TopLeft here as we have already checked that they are equal
                if (this.BoxGeometry is RectangleGeometry)
                {
                    return this.BoxGeometry;
                }

                var geometry = new RectangleGeometry();
                geometry.Bind(RectangleGeometry.RectProperty)
                    .OneWayTo(this, RectProperty);
                geometry.Bind(RectangleGeometry.RadiusXProperty)
                    .OneWayTo(this, CornerRadiusProperty, CornerRadiusTopLeftConverter.Default);
                geometry.Bind(RectangleGeometry.RadiusYProperty)
                    .OneWayTo(this, CornerRadiusProperty, CornerRadiusTopLeftConverter.Default);
                return geometry;
            }
            else
            {
                var geometry = new StreamGeometry();
                using (var context = geometry.Open())
                {
                    var cr = this.AdjustedCornerRadius();
                    var p = cr.TopLeft > 0
                        ? new Point(cr.TopLeft + this.StrokeThickness / 2, this.StrokeThickness / 2)
                        : new Point(this.StrokeThickness / 2, this.StrokeThickness / 2);
                    context.BeginFigure(p, true, true);
                    p = p.WithOffset(rect.Width - cr.TopLeft - cr.TopRight, 0);
                    context.LineTo(p, true, true);
                    p = context.DrawCorner(p, cr.TopRight, cr.TopRight);

                    p = p.WithOffset(0, rect.Height - cr.TopRight - cr.BottomRight);
                    context.LineTo(p, true, true);
                    p = context.DrawCorner(p, -cr.BottomRight, cr.BottomRight);

                    p = p.WithOffset(-rect.Width + cr.BottomRight + cr.BottomLeft, 0);
                    context.LineTo(p, true, true);
                    p = context.DrawCorner(p, -cr.BottomLeft, -cr.BottomLeft);

                    p = p.WithOffset(0, -rect.Height + cr.TopLeft + cr.BottomLeft);
                    context.LineTo(p, true, true);
                    context.DrawCorner(p, cr.TopLeft, -cr.TopLeft);
                }

                geometry.Freeze();
                return geometry;
            }
        }
Exemple #23
0
  protected Annotation Create(Rect rct, String txt, bool IsReadOnly)
  {
      Pen pen = new Pen(Brushes.Yellow, 3);        
      RectangleGeometry geo;       
      geo = new RectangleGeometry(rct);
      Annotation obj = new Annotation(pen, geo, null, IsReadOnly);
 
      return obj;
  }
Exemple #24
0
 public override bool AreBoundaryIntersecting(FrameworkElement cursorVisual)
 {
    RectangleGeometry cursorBounds =
        new RectangleGeometry(new Rect(0, 0, cursorVisual.ActualWidth, cursorVisual.ActualHeight));
    RectangleGeometry targetBounds =
        new RectangleGeometry(new Rect(0, 0, this.ActualWidth, this.ActualHeight));
    cursorBounds.Transform = (Transform)cursorVisual.TransformToVisual(this);
    return cursorBounds.FillContainsWithDetail(targetBounds) != IntersectionDetail.Empty;
 }
Exemple #25
0
 private static void ClipToBounds(FrameworkElement theTarget)
 {
     if (GetClipToBounds(theTarget)) {
         RectangleGeometry aRectangleGeometry = new RectangleGeometry();
         aRectangleGeometry.Rect = new Rect(0, 0, theTarget.ActualWidth, theTarget.ActualHeight);
         theTarget.Clip = aRectangleGeometry;
     } else {
         theTarget.Clip = null;
     }
 }
        public AutoClip(IClippable parent)
        {
            this.parent = parent;

            children = new List<UIElement>();
            geometry = new RectangleGeometry();
            geometry.Rect = new Rect(0, 0, parent.Width, parent.Height);
            parent.Clip = geometry;
            parent.OnPropertyChanged += new EventHandler<DependencyArgs>(OnPropertyChanged);
        }
Exemple #27
0
 public static void drawRectangle(WriteableBitmap wb, int x, int y, int w, int h, Color ac)
 {
     Path rect = new Path();
     rect.Stroke = new SolidColorBrush(Colors.Transparent);
     rect.Fill = new SolidColorBrush(ac);
     rect.StrokeThickness = 0;
     RectangleGeometry rectGeometry = new RectangleGeometry();
     rectGeometry.Rect = new Rect(x, y, w, h);
     rect.Data = rectGeometry;
     wb.Render(rect, new MatrixTransform());
 }
Exemple #28
0
		public void Prepare()
		{
			if (null == Scene)
			{
				throw new ArgumentException("Scene must be defined first");
			}

			var clipping = new RectangleGeometry { Rect = new Rect(0, 0, Width, Height) };
			Clip = clipping;

		}
Exemple #29
0
        /// <summary>
        /// Clips the associated object to a rectangular geometry determined
        /// by its actual width and height.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event information.</param>
        private static void OnSizeChanged(object sender, SizeChangedEventArgs e)
        {
            FrameworkElement source = sender as FrameworkElement;

            if (source != null)
            {
                RectangleGeometry geometry = new RectangleGeometry();
                geometry.Rect = new Rect(0, 0, source.ActualWidth, source.ActualHeight);
                source.Clip = geometry;
            }
        }        
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);
            EllipseGeometry ellipse = new EllipseGeometry(new Point(150, 150), 50, 20);
            RectangleGeometry rect = new RectangleGeometry(new Rect(150, 150, 50, 20), 5, 5);
            //Geometry.Combin()静态方法与使用CombinedGeometry对象进行图形合并差不多
            //其中Geometry.Combin()静态方法中有用于图形变换的参数(旋转,缩放等),如果不需要变换则填写null
            PathGeometry combin = Geometry.Combine(ellipse, rect, GeometryCombineMode.Xor, null);

            drawingContext.DrawGeometry(Brushes.LightBlue, new Pen(Brushes.Green, 2), combin);
        }
 private void LayoutRoot_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     if ((this.LayoutRoot.ActualWidth > 0.0) && (this.LayoutRoot.ActualHeight > 0.0))
     {
         RectangleGeometry geometry = new RectangleGeometry();
         geometry.Rect = new Rect(0.0, 0.0, this.LayoutRoot.ActualWidth, this.LayoutRoot.ActualHeight);
         geometry.RadiusY = 10.0;
         geometry.RadiusX = 10.0;
         LayoutRoot.Clip = geometry;
     }
 }
        public void Clip(UIElement element)
        {
            if (!children.Contains(element))
            {
                children.Add(element);
            }

            RectangleGeometry clone = new RectangleGeometry();
            clone.Rect = new Rect(geometry.Rect.Location, geometry.Rect.Size);
            element.Clip = clone;
        }
Exemple #33
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.gridMain = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.canvasImage = ((System.Windows.Controls.Canvas)(target));
                return;

            case 3:
                this.rgGridClip = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 4:
                this.stImage = ((System.Windows.Media.ScaleTransform)(target));
                return;

            case 5:
                this.img = ((System.Windows.Controls.Image)(target));
                return;

            case 6:
                this.rectBorder = ((System.Windows.Shapes.Rectangle)(target));

            #line 48 "..\..\..\..\UserControls\ucSelection.xaml"
                this.rectBorder.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.rectBorder_MouseDown);

            #line default
            #line hidden

            #line 48 "..\..\..\..\UserControls\ucSelection.xaml"
                this.rectBorder.MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.rectBorder_MouseUp);

            #line default
            #line hidden

            #line 48 "..\..\..\..\UserControls\ucSelection.xaml"
                this.rectBorder.TouchDown += new System.EventHandler <System.Windows.Input.TouchEventArgs>(this.rectBorder_TouchDown);

            #line default
            #line hidden

            #line 48 "..\..\..\..\UserControls\ucSelection.xaml"
                this.rectBorder.TouchUp += new System.EventHandler <System.Windows.Input.TouchEventArgs>(this.rectBorder_TouchUp);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Exemple #34
0
        public void Clear(SolidBrush brush)
        {
            var rect = this.ClipBounds;

            if (drawingVisual != null)
            {
                // bitmap
                Control.Close();
                var newbmp = new swmi.RenderTargetBitmap((int)bounds.Width, (int)bounds.Height, 96, 96, swm.PixelFormats.Pbgra32);
                newbmp.Render(visual);

                swm.Geometry maskgeometry;
                if (clipPath != null)
                {
                    maskgeometry = clipPath.ToWpf();
                }
                else
                {
                    maskgeometry = new swm.RectangleGeometry(rect.ToWpf());
                }
                var boundsgeometry = new swm.RectangleGeometry(this.bounds);
                maskgeometry = swm.Geometry.Combine(boundsgeometry, maskgeometry, swm.GeometryCombineMode.Exclude, null);
                var dr = new swm.GeometryDrawing(swm.Brushes.Black, null, maskgeometry);
                var db = new swm.DrawingBrush(dr);
                //db.Transform = new swm.TranslateTransform (0.5, 0.5);

                Control = drawingVisual.RenderOpen();
                PushGuideLines(bounds.X, bounds.Y, bounds.Width, bounds.Height);
                Control.PushOpacityMask(db);
                Control.DrawImage(newbmp, this.bounds);
                Control.Pop();

                TransformStack.PushAll();
                ApplyClip();
            }
            else
            {
                // drawable
                if (brush == null || brush.Color.A < 1.0f)
                {
                    Widget.FillRectangle(Brushes.Black(Generator), rect);
                }
            }
            if (brush != null)
            {
                Widget.FillRectangle(brush, rect);
            }
        }
Exemple #35
0
        private static XamlMedia.Geometry ConvertSymbol(Point point, SymbolStyle style, IViewport viewport)
        {
            Point p = viewport.WorldToScreen(point);

            var rect = new XamlMedia.RectangleGeometry();

            if (style.BitmapId >= 0)
            {
                var bitmapImage = BitmapRegistry.Instance.Get(style.BitmapId).CreateBitmapImage();
                var width       = bitmapImage.PixelWidth * style.SymbolScale;
                var height      = bitmapImage.PixelHeight * style.SymbolScale;
                rect.Rect = new Rect(p.X - width * 0.5, p.Y - height * 0.5, width, height);
            }

            return(rect);
        }
Exemple #36
0
        public void Clear(SolidBrush brush)
        {
            var rect = clipBounds ?? initialClip;

            if (drawingVisual != null)
            {
                // bitmap
                Control.Close();
                var newbmp = new swmi.RenderTargetBitmap((int)bounds.Width, (int)bounds.Height, 96, 96, swm.PixelFormats.Pbgra32);
                newbmp.RenderWithCollect(visual);

                swm.Geometry maskgeometry;
                if (clipPath != null)
                {
                    maskgeometry = clipPath;
                }
                else
                {
                    maskgeometry = new swm.RectangleGeometry(rect.ToWpf());
                }
                var boundsgeometry = new swm.RectangleGeometry(bounds);
                maskgeometry = swm.Geometry.Combine(boundsgeometry, maskgeometry, swm.GeometryCombineMode.Exclude, null);
                var dr = new swm.GeometryDrawing(swm.Brushes.Black, null, maskgeometry);
                var db = new swm.DrawingBrush(dr);
                //db.Transform = new swm.TranslateTransform (0.5, 0.5);

                Control = drawingVisual.RenderOpen();
                Control.PushGuidelineSet(new swm.GuidelineSet(new [] { bounds.Left, bounds.Right }, new [] { bounds.Top, bounds.Bottom }));
                Control.PushOpacityMask(db);
                Control.DrawImage(newbmp, bounds);
                Control.Pop();

                ApplyAll();
            }
            else
            {
                // drawable
                if (brush == null || brush.Color.A < 1.0f)
                {
                    Widget.FillRectangle(Brushes.Black, rect);
                }
            }
            if (brush != null)
            {
                Widget.FillRectangle(brush, rect);
            }
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.gridMain = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.rectClip = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 3:
                this.canvasImageOne = ((System.Windows.Controls.Canvas)(target));
                return;

            case 4:
                this.stImageSlideshow1 = ((System.Windows.Media.ScaleTransform)(target));
                return;

            case 5:
                this.imgOne = ((System.Windows.Controls.Image)(target));
                return;

            case 6:
                this.canvasImageTwo = ((System.Windows.Controls.Canvas)(target));
                return;

            case 7:
                this.stImageSlideshow2 = ((System.Windows.Media.ScaleTransform)(target));
                return;

            case 8:
                this.imgTwo = ((System.Windows.Controls.Image)(target));
                return;

            case 9:
                this.mediaPlayer = ((System.Windows.Controls.MediaElement)(target));
                return;
            }
            this._contentLoaded = true;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.myRectangleGeometry = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 2:
                this.myAnimatedButton = ((System.Windows.Controls.Button)(target));
                return;

            case 3:
                this.AnimatedTranslateTransform = ((System.Windows.Media.TranslateTransform)(target));
                return;

            case 4:
                this.MyAnimatedEllipseGeometry = ((System.Windows.Media.EllipseGeometry)(target));
                return;

            case 5:
                this.myRectangleGeometry1 = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 6:
                this.myAnimatedButton2 = ((System.Windows.Controls.Button)(target));
                return;

            case 7:
                this.myArcSegment = ((System.Windows.Media.ArcSegment)(target));
                return;

            case 8:
                this.myBeginStoryBoard = ((System.Windows.Media.Animation.BeginStoryboard)(target));
                return;

            case 9:
                this.TranslateTransform1 = ((System.Windows.Media.TranslateTransform)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemple #39
0
        public static void UserDrawRasterWPFScreenCoordinate(System.Windows.Media.DrawingContext dc, System.Windows.Media.ImageSource ImageSource,
                                                             int PixelX, int PixelY, int Width, int Height, double angle = 0.0, System.Windows.Media.ImageBrush pImageBrush = null)
        {
            System.Windows.Size  sz       = new System.Windows.Size(Width, Height);
            System.Windows.Point pnt      = new System.Windows.Point(PixelX - sz.Width / 2, PixelY - sz.Height / 2);
            System.Windows.Rect  rectBack = new System.Windows.Rect(pnt, sz);
            //if (angle == 0.0)
            //{
            //    dc.DrawImage(ImageSource, rectBack);
            //}
            //else
            //{
            System.Windows.Media.RotateTransform rotRect = new System.Windows.Media.RotateTransform(angle, PixelX, PixelY);

            System.Windows.Media.RectangleGeometry RectGeo = new System.Windows.Media.RectangleGeometry(rectBack);
            RectGeo.Transform = rotRect;
            System.Windows.Media.ImageBrush imbrush = null;
            if (pImageBrush != null)
            {
                imbrush = pImageBrush;
            }
            else if (ImageSource != null)
            {
                imbrush = new System.Windows.Media.ImageBrush(ImageSource);
            }
            // imbrush.Viewport = imbrush.Viewport = new Rect(0, 0, 16, 16);
            //dc.DrawImage(_ImageSource, rectBack);

            if (imbrush != null)
            {
                imbrush.Transform = rotRect;
                dc.DrawGeometry(imbrush, null, RectGeo);
            }


            // }
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 11 "..\..\..\Internal\DefaultLaunchPad.xaml"
                ((AquaL.Internal.DefaultFrameHost)(target)).Loaded += new System.Windows.RoutedEventHandler(this.PageLoaded);

            #line default
            #line hidden
                return;

            case 2:
                this.backgroundBottom = ((System.Windows.Controls.Image)(target));
                return;

            case 3:
                this.backgroundTop = ((System.Windows.Controls.Image)(target));
                return;

            case 4:
                this.backgroundTopClip = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 5:
                this.StartBg = ((System.Windows.Controls.Grid)(target));
                return;

            case 6:
                this.LookBoard = ((System.Windows.Controls.Image)(target));
                return;

            case 7:
                this.LookBoardTalks = ((System.Windows.Controls.Grid)(target));
                return;

            case 8:
                this.UserSelector = ((System.Windows.Controls.WrapPanel)(target));
                return;

            case 9:
                this.actionBar_launch = ((System.Windows.Controls.WrapPanel)(target));
                return;

            case 10:
                this.actionBar_apps = ((System.Windows.Controls.Grid)(target));
                return;

            case 11:
                this.Main_Layout = ((System.Windows.Controls.Grid)(target));
                return;

            case 12:
                this.Main_Right = ((System.Windows.Controls.Grid)(target));
                return;

            case 13:
                this.UserSelectorMenu = ((System.Windows.Controls.Border)(target));
                return;

            case 14:
                this.LTShadow = ((System.Windows.Media.Effects.DropShadowEffect)(target));
                return;
            }
            this._contentLoaded = true;
        }
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/ColorIllusions2;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot                = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.lbMainTitle               = ((System.Windows.Controls.TextBlock)(this.FindName("lbMainTitle")));
     this.Stimulus                  = ((System.Windows.Controls.ListBox)(this.FindName("Stimulus")));
     this.spCenterSpeed             = ((System.Windows.Controls.StackPanel)(this.FindName("spCenterSpeed")));
     this.nudCenterSpeed            = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudCenterSpeed")));
     this.spFrequency               = ((System.Windows.Controls.StackPanel)(this.FindName("spFrequency")));
     this.nudCenterScalingFrequency = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudCenterScalingFrequency")));
     this.spShearing                = ((System.Windows.Controls.StackPanel)(this.FindName("spShearing")));
     this.nudShearingFactor         = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudShearingFactor")));
     this.nudShearingAngle          = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudShearingAngle")));
     this.nudShearingFreq           = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudShearingFreq")));
     this.spStatShearDot            = ((System.Windows.Controls.StackPanel)(this.FindName("spStatShearDot")));
     this.cbStatWheel               = ((System.Windows.Controls.CheckBox)(this.FindName("cbStatWheel")));
     this.cbStatDot                 = ((System.Windows.Controls.CheckBox)(this.FindName("cbStatDot")));
     this.nudZoom                 = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudZoom")));
     this.nudWheelFromRed         = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudWheelFromRed")));
     this.nudWheelFromGreen       = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudWheelFromGreen")));
     this.nudWheelFromBlue        = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudWheelFromBlue")));
     this.nudWheelToRed           = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudWheelToRed")));
     this.nudWheelToGreen         = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudWheelToGreen")));
     this.nudWheelToBlue          = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudWheelToBlue")));
     this.nudMaskRed              = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskRed")));
     this.nudMaskGreen            = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskGreen")));
     this.nudMaskBlue             = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskBlue")));
     this.cbMarker                = ((System.Windows.Controls.CheckBox)(this.FindName("cbMarker")));
     this.spRingCB                = ((System.Windows.Controls.StackPanel)(this.FindName("spRingCB")));
     this.cbRings                 = ((System.Windows.Controls.CheckBox)(this.FindName("cbRings")));
     this.spMarkerSpeed           = ((System.Windows.Controls.StackPanel)(this.FindName("spMarkerSpeed")));
     this.nudMarkerSpeed          = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMarkerSpeed")));
     this.TextureMap              = ((System.Windows.Controls.ListBox)(this.FindName("TextureMap")));
     this.spMaskRotation          = ((System.Windows.Controls.StackPanel)(this.FindName("spMaskRotation")));
     this.nudMaskRotationSpeed    = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskRotationSpeed")));
     this.spMaskSize              = ((System.Windows.Controls.StackPanel)(this.FindName("spMaskSize")));
     this.nudMaskSize             = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskSize")));
     this.spTextureScale          = ((System.Windows.Controls.StackPanel)(this.FindName("spTextureScale")));
     this.nudMaskScale            = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskScale")));
     this.spMaskScaling           = ((System.Windows.Controls.StackPanel)(this.FindName("spMaskScaling")));
     this.nudMaskScalingFrequency = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskScalingFrequency")));
     this.spMaskOffset            = ((System.Windows.Controls.StackPanel)(this.FindName("spMaskOffset")));
     this.nudMaskXOffset          = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskXOffset")));
     this.nudMaskYOffset          = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskYOffset")));
     this.spFlicker               = ((System.Windows.Controls.StackPanel)(this.FindName("spFlicker")));
     this.cbFlicker               = ((System.Windows.Controls.CheckBox)(this.FindName("cbFlicker")));
     this.IllusionPanel           = ((System.Windows.Controls.Canvas)(this.FindName("IllusionPanel")));
     this.IllusionClip            = ((System.Windows.Media.RectangleGeometry)(this.FindName("IllusionClip")));
     this.canvasSpokewheel        = ((System.Windows.Controls.Canvas)(this.FindName("canvasSpokewheel")));
     this.MotionGenerator         = ((System.Windows.Media.Animation.Storyboard)(this.FindName("MotionGenerator")));
     this.aniMaskRot              = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("aniMaskRot")));
     this.aniWheelRot             = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("aniWheelRot")));
     this.aniWheelScale           = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("aniWheelScale")));
     this.aniMaskScale            = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("aniMaskScale")));
     this.aniMarkerRot            = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("aniMarkerRot")));
     this.aniMarkerScale          = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("aniMarkerScale")));
     this.aniMarker2Scale         = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("aniMarker2Scale")));
     this.aniFlicker              = ((System.Windows.Media.Animation.PointAnimation)(this.FindName("aniFlicker")));
     this.imgSectors              = ((System.Windows.Controls.Image)(this.FindName("imgSectors")));
     this.imgRHSpirals            = ((System.Windows.Controls.Image)(this.FindName("imgRHSpirals")));
     this.imgLHSpirals            = ((System.Windows.Controls.Image)(this.FindName("imgLHSpirals")));
     this.imgRings                = ((System.Windows.Controls.Image)(this.FindName("imgRings")));
     this.imgWheel4               = ((System.Windows.Controls.Image)(this.FindName("imgWheel4")));
     this.imgWheel8               = ((System.Windows.Controls.Image)(this.FindName("imgWheel8")));
     this.imgWheel16              = ((System.Windows.Controls.Image)(this.FindName("imgWheel16")));
     this.imgVSinus128            = ((System.Windows.Controls.Image)(this.FindName("imgVSinus128")));
     this.imgVSinus256            = ((System.Windows.Controls.Image)(this.FindName("imgVSinus256")));
     this.imgHSinus128            = ((System.Windows.Controls.Image)(this.FindName("imgHSinus128")));
     this.imgHSinus256            = ((System.Windows.Controls.Image)(this.FindName("imgHSinus256")));
     this.imgSteppedSectors       = ((System.Windows.Controls.Image)(this.FindName("imgSteppedSectors")));
     this.borderDepthMarker2      = ((System.Windows.Controls.Border)(this.FindName("borderDepthMarker2")));
     this.borderDepthMarker       = ((System.Windows.Controls.Border)(this.FindName("borderDepthMarker")));
     this.borderCnvMask           = ((System.Windows.Controls.Border)(this.FindName("borderCnvMask")));
     this.cnvMask                 = ((System.Windows.Controls.Canvas)(this.FindName("cnvMask")));
     this.imgRdDots1              = ((System.Windows.Controls.Image)(this.FindName("imgRdDots1")));
     this.imgRDRings              = ((System.Windows.Controls.Image)(this.FindName("imgRDRings")));
     this.imgNoDots               = ((System.Windows.Controls.Image)(this.FindName("imgNoDots")));
     this.imgHalfRdDots           = ((System.Windows.Controls.Image)(this.FindName("imgHalfRdDots")));
     this.imgRDSpirals            = ((System.Windows.Controls.Image)(this.FindName("imgRDSpirals")));
     this.imgTiltedLines90        = ((System.Windows.Controls.Image)(this.FindName("imgTiltedLines90")));
     this.imgTiltedLines45        = ((System.Windows.Controls.Image)(this.FindName("imgTiltedLines45")));
     this.imgTiltedLines0         = ((System.Windows.Controls.Image)(this.FindName("imgTiltedLines0")));
     this.MaskScale               = ((System.Windows.Media.ScaleTransform)(this.FindName("MaskScale")));
     this.MaskRotPS               = ((Shader.Effects.MakeRotationEffect)(this.FindName("MaskRotPS")));
     this.CenterPS                = ((Shader.Effects.ColorFromMapEffect)(this.FindName("CenterPS")));
     this.MarkerPS                = ((Shader.Effects.MakeDepthMarkerEffect)(this.FindName("MarkerPS")));
     this.Marker2PS               = ((Shader.Effects.MakeDepthMarker2Effect)(this.FindName("Marker2PS")));
     this.Nabel  = ((System.Windows.Shapes.Ellipse)(this.FindName("Nabel")));
     this.wNabel = ((System.Windows.Shapes.Ellipse)(this.FindName("wNabel")));
 }
Exemple #42
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.transparentRect = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 2:
                this.b_中上 = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 3:
                this.b_中下 = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 4:
                this.b_右中 = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 5:
                this.b_左中 = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 6:
                this.b_中心拖曳 = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 7:
                this.b_左上 = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 8:
                this.b_右上 = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 9:
                this.b_右下 = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 10:
                this.b_左下 = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 11:
                this.st_按鈕群 = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 12:
                this.button_關閉 = ((System.Windows.Controls.Button)(target));
                return;

            case 13:
                this.button_重新 = ((System.Windows.Controls.Button)(target));
                return;

            case 14:
                this.button_確認_png = ((System.Windows.Controls.Button)(target));
                return;

            case 15:
                this.button_確認_jpg = ((System.Windows.Controls.Button)(target));
                return;

            case 16:
                this.rect_游標 = ((System.Windows.Shapes.Rectangle)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemple #43
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Grid = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.UniformGrid = ((System.Windows.Controls.Primitives.UniformGrid)(target));
                return;

            case 3:
                this.Button = ((System.Windows.Controls.Button)(target));

            #line 16 "..\..\MainWindow.xaml"
                this.Button.Click += new System.Windows.RoutedEventHandler(this.ShowTop);

            #line default
            #line hidden
                return;

            case 4:

            #line 17 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ShowLeft);

            #line default
            #line hidden
                return;

            case 5:

            #line 18 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ShowRight);

            #line default
            #line hidden
                return;

            case 6:

            #line 19 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ShowBottom);

            #line default
            #line hidden
                return;

            case 7:
                this.Canvas1 = ((System.Windows.Controls.Canvas)(target));
                return;

            case 8:
                this.Pt = ((System.Windows.Shapes.Path)(target));

            #line 23 "..\..\MainWindow.xaml"
                this.Pt.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.Hidden);

            #line default
            #line hidden
                return;

            case 9:
                this.Rg1 = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 10:
                this.Rg2 = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 11:
                this.Tb = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 12:
                this.Pg = ((System.Windows.Shapes.Path)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemple #44
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.rectangleLocal = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 2:
                this.LeftGrid = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 3:
                this.CenterGrid = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 4:
                this.RightGrid = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 5:
                this.imageLeft = ((System.Windows.Controls.Image)(target));

            #line 44 "..\..\..\Control\TPageControl.xaml"
                this.imageLeft.MouseEnter += new System.Windows.Input.MouseEventHandler(this.imageLeft_MouseEnter);

            #line default
            #line hidden

            #line 44 "..\..\..\Control\TPageControl.xaml"
                this.imageLeft.MouseLeave += new System.Windows.Input.MouseEventHandler(this.imageLeft_MouseLeave);

            #line default
            #line hidden

            #line 44 "..\..\..\Control\TPageControl.xaml"
                this.imageLeft.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.imageLeft_MouseLeftButtonDown);

            #line default
            #line hidden
                return;

            case 6:
                this.imageRight = ((System.Windows.Controls.Image)(target));

            #line 55 "..\..\..\Control\TPageControl.xaml"
                this.imageRight.MouseEnter += new System.Windows.Input.MouseEventHandler(this.imageRight_MouseEnter);

            #line default
            #line hidden

            #line 55 "..\..\..\Control\TPageControl.xaml"
                this.imageRight.MouseLeave += new System.Windows.Input.MouseEventHandler(this.imageRight_MouseLeave);

            #line default
            #line hidden

            #line 55 "..\..\..\Control\TPageControl.xaml"
                this.imageRight.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.imageRight_MouseLeftButtonDown);

            #line default
            #line hidden
                return;

            case 7:
                this.canvasPageContent = ((System.Windows.Controls.Canvas)(target));

            #line 65 "..\..\..\Control\TPageControl.xaml"
                this.canvasPageContent.PreviewMouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.canvasPageContent_PreviewMouseLeftButtonDown);

            #line default
            #line hidden

            #line 65 "..\..\..\Control\TPageControl.xaml"
                this.canvasPageContent.PreviewMouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.canvasPageContent_PreviewMouseLeftButtonUp);

            #line default
            #line hidden

            #line 65 "..\..\..\Control\TPageControl.xaml"
                this.canvasPageContent.PreviewMouseMove += new System.Windows.Input.MouseEventHandler(this.canvasPageContent_PreviewMouseMove);

            #line default
            #line hidden

            #line 65 "..\..\..\Control\TPageControl.xaml"
                this.canvasPageContent.MouseLeave += new System.Windows.Input.MouseEventHandler(this.canvasPageContent_MouseLeave);

            #line default
            #line hidden

            #line 65 "..\..\..\Control\TPageControl.xaml"
                this.canvasPageContent.SizeChanged += new System.Windows.SizeChangedEventHandler(this.canvasPageContent_SizeChanged);

            #line default
            #line hidden
                return;

            case 8:
                this.canvasPageRectangle = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 9:
                this.wrapPanelPages = ((System.Windows.Controls.WrapPanel)(target));
                return;

            case 10:
                this.pageBar1 = ((jg.Editor.Library.Control.PageBar)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemple #45
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.wb = ((System.Windows.Controls.Border)(target));
                return;

            case 2:
                this.r1 = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 3:
                this.r2 = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 4:
                this.r3 = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 5:
                this.r4 = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 6:
                this.root = ((System.Windows.Controls.Grid)(target));
                return;

            case 7:
                this.captiobd = ((System.Windows.Controls.Border)(target));

            #line 29 "..\..\MainWindow.xaml"
                this.captiobd.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.onLDown);

            #line default
            #line hidden
                return;

            case 8:

            #line 36 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.onMin);

            #line default
            #line hidden
                return;

            case 9:

            #line 37 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.onClick);

            #line default
            #line hidden
                return;

            case 10:

            #line 41 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.onClick);

            #line default
            #line hidden
                return;

            case 11:
                this.rt = ((System.Windows.Media.RotateTransform)(target));
                return;

            case 12:
                this.sct = ((System.Windows.Media.ScaleTransform)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemple #46
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.gridLayout = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.canvasMain = ((System.Windows.Controls.Canvas)(target));
                return;

            case 3:
                this.inkCanvas = ((System.Windows.Controls.InkCanvas)(target));

            #line 40 "..\..\..\..\Views\Controls\ClipWindow.xaml"
                this.inkCanvas.StrokeCollected += new System.Windows.Controls.InkCanvasStrokeCollectedEventHandler(this.inkCanvas_StrokeCollected);

            #line default
            #line hidden
                return;

            case 4:
                this.rect = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 5:
                this.cbGeo = ((System.Windows.Media.CombinedGeometry)(target));
                return;

            case 6:
                this.rectFull = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 7:
                this.rectClip = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 8:
                this.bdThumb = ((System.Windows.Controls.Border)(target));
                return;

            case 9:
                this.gridmagnifier = ((System.Windows.Controls.Grid)(target));
                return;

            case 10:
                this.magnifierRectangle = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 11:
                this.visualBrush = ((System.Windows.Media.VisualBrush)(target));
                return;

            case 12:
                this.tbUnSelection = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 13:
                this.runSize0 = ((System.Windows.Documents.Run)(target));
                return;

            case 14:
                this.tbSelection = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 15:
                this.runSize = ((System.Windows.Documents.Run)(target));
                return;

            case 16:
                this.stkpMenu = ((System.Windows.Controls.StackPanel)(target));

            #line 100 "..\..\..\..\Views\Controls\ClipWindow.xaml"
                this.stkpMenu.AddHandler(System.Windows.Controls.Primitives.ButtonBase.ClickEvent, new System.Windows.RoutedEventHandler(this.stkpMenu_Click));

            #line default
            #line hidden
                return;

            case 17:
                this.tbtnPen = ((System.Windows.Controls.Primitives.ToggleButton)(target));
                return;

            case 18:
                this.rbtnBackout = ((System.Windows.Controls.Primitives.RepeatButton)(target));
                return;

            case 19:
                this.listSizes = ((System.Windows.Controls.ListBox)(target));

            #line 143 "..\..\..\..\Views\Controls\ClipWindow.xaml"
                this.listSizes.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.listSizes_SelectionChanged);

            #line default
            #line hidden
                return;

            case 20:
                this.listColors = ((System.Windows.Controls.ListBox)(target));

            #line 172 "..\..\..\..\Views\Controls\ClipWindow.xaml"
                this.listColors.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.listColors_SelectionChanged);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.kinectColorViewer1 = ((Microsoft.Samples.Kinect.WpfViewers.KinectColorViewer)(target));
                return;

            case 2:
                this.border1 = ((System.Windows.Controls.Border)(target));
                return;

            case 3:
                this.rotTx = ((System.Windows.Media.RotateTransform)(target));
                return;

            case 4:
                this.imgWav = ((System.Windows.Controls.Image)(target));
                return;

            case 5:
                this.bdConf = ((System.Windows.Controls.Border)(target));
                return;

            case 6:
                this.tbConf = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 7:
                this.clipConf = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 8:
                this.tbColor = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 9:
                this.tbSpeechStatus = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 10:
                this.enableAec = ((System.Windows.Controls.CheckBox)(target));

            #line 32 "..\..\MainWindow.xaml"
                this.enableAec.Checked += new System.Windows.RoutedEventHandler(this.EnableAecChecked);

            #line default
            #line hidden

            #line 32 "..\..\MainWindow.xaml"
                this.enableAec.Unchecked += new System.Windows.RoutedEventHandler(this.EnableAecChecked);

            #line default
            #line hidden
                return;

            case 11:
                this.SensorChooser = ((Microsoft.Samples.Kinect.WpfViewers.KinectSensorChooser)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemple #48
0
        public static WMedia.Geometry ToWindows(this Geometry geometry)
        {
            WMedia.Geometry wGeometry = null;

            if (geometry is LineGeometry)
            {
                LineGeometry lineGeometry = geometry as LineGeometry;
                wGeometry = new WMedia.LineGeometry
                {
                    StartPoint = lineGeometry.StartPoint.ToWindows(),
                    EndPoint   = lineGeometry.EndPoint.ToWindows()
                };
            }
            else if (geometry is RectangleGeometry)
            {
                var rect = (geometry as RectangleGeometry).Rect;
                wGeometry = new WMedia.RectangleGeometry
                {
                    Rect = new WFoundation.Rect(rect.X, rect.Y, rect.Width, rect.Height)
                };
            }
            else if (geometry is EllipseGeometry)
            {
                EllipseGeometry ellipseGeometry = geometry as EllipseGeometry;
                wGeometry = new WMedia.EllipseGeometry
                {
                    Center  = ellipseGeometry.Center.ToWindows(),
                    RadiusX = ellipseGeometry.RadiusX,
                    RadiusY = ellipseGeometry.RadiusY
                };
            }
            else if (geometry is GeometryGroup)
            {
                GeometryGroup geometryGroup = geometry as GeometryGroup;
                wGeometry = new WMedia.GeometryGroup
                {
                    FillRule = ConvertFillRule(geometryGroup.FillRule)
                };

                foreach (Geometry children in geometryGroup.Children)
                {
                    WMedia.Geometry winChild = children.ToWindows();
                    (wGeometry as WMedia.GeometryGroup).Children.Add(winChild);
                }
            }
            else if (geometry is PathGeometry)
            {
                PathGeometry pathGeometry = geometry as PathGeometry;

                WMedia.PathGeometry wPathGeometry = new WMedia.PathGeometry
                {
                    FillRule = ConvertFillRule(pathGeometry.FillRule)
                };

                foreach (PathFigure xamPathFigure in pathGeometry.Figures)
                {
                    WMedia.PathFigure wPathFigure = new WMedia.PathFigure
                    {
                        StartPoint = xamPathFigure.StartPoint.ToWindows(),
                        IsFilled   = xamPathFigure.IsFilled,
                        IsClosed   = xamPathFigure.IsClosed
                    };
                    wPathGeometry.Figures.Add(wPathFigure);

                    foreach (PathSegment pathSegment in xamPathFigure.Segments)
                    {
                        // LineSegment
                        if (pathSegment is LineSegment)
                        {
                            LineSegment lineSegment = pathSegment as LineSegment;

                            WMedia.LineSegment winSegment = new WMedia.LineSegment
                            {
                                Point = lineSegment.Point.ToWindows()
                            };

                            wPathFigure.Segments.Add(winSegment);
                        }

                        // PolylineSegment
                        if (pathSegment is PolyLineSegment)
                        {
                            PolyLineSegment        polyLineSegment = pathSegment as PolyLineSegment;
                            WMedia.PolyLineSegment wSegment        = new WMedia.PolyLineSegment();

                            foreach (var point in polyLineSegment.Points)
                            {
                                wSegment.Points.Add(point.ToWindows());
                            }

                            wPathFigure.Segments.Add(wSegment);
                        }

                        // BezierSegment
                        if (pathSegment is BezierSegment)
                        {
                            BezierSegment bezierSegment = pathSegment as BezierSegment;

                            WMedia.BezierSegment wSegment = new WMedia.BezierSegment
                            {
                                Point1 = bezierSegment.Point1.ToWindows(),
                                Point2 = bezierSegment.Point2.ToWindows(),
                                Point3 = bezierSegment.Point3.ToWindows()
                            };

                            wPathFigure.Segments.Add(wSegment);
                        }
                        // PolyBezierSegment
                        else if (pathSegment is PolyBezierSegment)
                        {
                            PolyBezierSegment        polyBezierSegment = pathSegment as PolyBezierSegment;
                            WMedia.PolyBezierSegment wSegment          = new WMedia.PolyBezierSegment();

                            foreach (var point in polyBezierSegment.Points)
                            {
                                wSegment.Points.Add(point.ToWindows());
                            }

                            wPathFigure.Segments.Add(wSegment);
                        }

                        // QuadraticBezierSegment
                        if (pathSegment is QuadraticBezierSegment)
                        {
                            QuadraticBezierSegment quadraticBezierSegment = pathSegment as QuadraticBezierSegment;

                            WMedia.QuadraticBezierSegment wSegment = new WMedia.QuadraticBezierSegment
                            {
                                Point1 = quadraticBezierSegment.Point1.ToWindows(),
                                Point2 = quadraticBezierSegment.Point2.ToWindows()
                            };

                            wPathFigure.Segments.Add(wSegment);
                        }
                        // PolyQuadraticBezierSegment
                        else if (pathSegment is PolyQuadraticBezierSegment)
                        {
                            PolyQuadraticBezierSegment        polyQuadraticBezierSegment = pathSegment as PolyQuadraticBezierSegment;
                            WMedia.PolyQuadraticBezierSegment wSegment = new WMedia.PolyQuadraticBezierSegment();

                            foreach (var point in polyQuadraticBezierSegment.Points)
                            {
                                wSegment.Points.Add(point.ToWindows());
                            }

                            wPathFigure.Segments.Add(wSegment);
                        }
                        // ArcSegment
                        else if (pathSegment is ArcSegment)
                        {
                            ArcSegment arcSegment = pathSegment as ArcSegment;

                            WMedia.ArcSegment wSegment = new WMedia.ArcSegment
                            {
                                Size           = new WFoundation.Size(arcSegment.Size.Width, arcSegment.Size.Height),
                                RotationAngle  = arcSegment.RotationAngle,
                                IsLargeArc     = arcSegment.IsLargeArc,
                                SweepDirection = arcSegment.SweepDirection == SweepDirection.Clockwise ? WMedia.SweepDirection.Clockwise : WMedia.SweepDirection.Counterclockwise,
                                Point          = arcSegment.Point.ToWindows()
                            };

                            wPathFigure.Segments.Add(wSegment);
                        }
                    }
                }

                wGeometry = wPathGeometry;
            }

            return(wGeometry);
        }
Exemple #49
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.gridMain = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.rectClip = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 3:
                this.imgWeatherDay1 = ((System.Windows.Controls.Image)(target));
                return;

            case 4:
                this.txtDayOfWeek1 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 5:
                this.txtWeather1 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 6:
                this.txtHigh1 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 7:
                this.txtLow1 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 8:
                this.imgWeatherDay2 = ((System.Windows.Controls.Image)(target));
                return;

            case 9:
                this.txtDayOfWeek2 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 10:
                this.txtWeather2 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 11:
                this.txtHigh2 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 12:
                this.txtLow2 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 13:
                this.imgWeatherDay3 = ((System.Windows.Controls.Image)(target));
                return;

            case 14:
                this.txtDayOfWeek3 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 15:
                this.txtWeather3 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 16:
                this.txtHigh3 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 17:
                this.txtLow3 = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemple #50
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.gridMain = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.rectClip = ((System.Windows.Media.RectangleGeometry)(target));
                return;

            case 3:
                this.gridSelections = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:
                this.txtCaption = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 5:
                this.gridNextButton = ((System.Windows.Controls.Grid)(target));
                return;

            case 6:
                this.txtNext = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 7:
                this.gridNext = ((System.Windows.Controls.Grid)(target));
                return;

            case 8:
                this.ellNext = ((System.Windows.Shapes.Ellipse)(target));
                return;

            case 9:

            #line 93 "..\..\..\..\UserControls\ucSelectionBar.xaml"
                ((System.Windows.Shapes.Rectangle)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.btnNext_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.gridBackButton = ((System.Windows.Controls.Grid)(target));
                return;

            case 11:
                this.txtBack = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 12:
                this.gridBack = ((System.Windows.Controls.Grid)(target));
                return;

            case 13:
                this.ellBack = ((System.Windows.Shapes.Ellipse)(target));
                return;

            case 14:

            #line 118 "..\..\..\..\UserControls\ucSelectionBar.xaml"
                ((System.Windows.Shapes.Rectangle)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.btnBack_Click);

            #line default
            #line hidden
                return;

            case 15:
                this.gridCloseButton = ((System.Windows.Controls.Grid)(target));
                return;

            case 16:
                this.txtClose = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 17:
                this.gridCloseIcon = ((System.Windows.Controls.Grid)(target));
                return;

            case 18:
                this.ellClose = ((System.Windows.Shapes.Ellipse)(target));
                return;

            case 19:

            #line 144 "..\..\..\..\UserControls\ucSelectionBar.xaml"
                ((System.Windows.Shapes.Rectangle)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.btnClose_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Exemple #51
0
        internal static Rect GetBoundsHelper(Pen pen, Matrix worldMatrix, Rect rect, double radiusX, double radiusY,
                                             Matrix geometryMatrix, double tolerance, ToleranceType type)
        {
            Rect boundingRect;

            Debug.Assert(worldMatrix != null);
            Debug.Assert(geometryMatrix != null);

            if (rect.IsEmpty)
            {
                boundingRect = Rect.Empty;
            }
            else if ((pen == null || pen.DoesNotContainGaps) &&
                     geometryMatrix.IsIdentity && worldMatrix.IsIdentity)
            {
                double strokeThickness = 0.0;

                boundingRect = rect;

                if (Pen.ContributesToBounds(pen))
                {
                    strokeThickness = Math.Abs(pen.Thickness);

                    boundingRect.X      -= 0.5 * strokeThickness;
                    boundingRect.Y      -= 0.5 * strokeThickness;
                    boundingRect.Width  += strokeThickness;
                    boundingRect.Height += strokeThickness;
                }
            }
            else
            {
                unsafe
                {
                    uint pointCount, segmentCount;
                    GetCounts(rect, radiusX, radiusY, out pointCount, out segmentCount);

                    // We've checked that rect isn't empty above
                    Invariant.Assert(pointCount != 0);

                    Point *pPoints = stackalloc Point[(int)pointCount];
                    RectangleGeometry.GetPointList(pPoints, pointCount, rect, radiusX, radiusY);

                    fixed(byte *pTypes = RectangleGeometry.GetTypeList(rect, radiusX, radiusY))
                    {
                        boundingRect = Geometry.GetBoundsHelper(
                            pen,
                            &worldMatrix,
                            pPoints,
                            pTypes,
                            pointCount,
                            segmentCount,
                            &geometryMatrix,
                            tolerance,
                            type,
                            false);  // skip hollows - meaningless here, this is never a hollow
                    }
                }
            }

            return(boundingRect);
        }