コード例 #1
0
 public HudRenderer(DrawingGroup drawGroup, DrawingImage drawImage, int width, int height)
 {
     drawingGroup = drawGroup;
     drawingImage = drawImage;
     displayHeight = height;
     displayWidth = width;
 }
コード例 #2
0
        /// <summary>
        /// Within the given line add the scarlet box behind the a
        /// </summary>
        private void CreateVisuals(ITextViewLine line)
        {
            //grab a reference to the lines in the current TextView 
            IWpfTextViewLineCollection textViewLines = _view.TextViewLines;
            int start = line.Start;
            int end = line.End;

            //Loop through each character, and place a box around any a 
            for (int i = start; (i < end); ++i)
            {
                if (_view.TextSnapshot[i] == 'a')
                {
                    SnapshotSpan span = new SnapshotSpan(_view.TextSnapshot, Span.FromBounds(i, i + 1));
                    Geometry g = textViewLines.GetMarkerGeometry(span);
                    if (g != null)
                    {
                        GeometryDrawing drawing = new GeometryDrawing(_brush, _pen, g);
                        drawing.Freeze();

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

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

                        //Align the image with the top of the bounds of the text geometry
                        Canvas.SetLeft(image, g.Bounds.Left);
                        Canvas.SetTop(image, g.Bounds.Top);

                        _layer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, null, image, null);
                    }
                }
            }
        }
コード例 #3
0
 private void Display_Loaded(object sender, RoutedEventArgs e)
 {
     drawingGroup = new DrawingGroup();
     var imageSource = new DrawingImage(drawingGroup);
     Display.Source = imageSource;
     Redraw();
 }
コード例 #4
0
        private void textBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
        {
            BitmapImage bmImage = new BitmapImage();
            // textBox.PreviewKeyDown += EnterClicked;
            if (image != null)
            {

                bmImage = new BitmapImage(new Uri(hh));


                var visual = new DrawingVisual();

                using (DrawingContext drawingContext = visual.RenderOpen())
                {
                    string objTextBox = textBox.Text;
                    drawingContext.DrawImage(bmImage, new Rect(0, 0, bmImage.Width, bmImage.Height));
                    drawingContext.DrawText(
                        new FormattedText(objTextBox, CultureInfo.InvariantCulture, FlowDirection.LeftToRight,
                            new Typeface(comboBox.Text), Convert.ToInt32(comboBox1.SelectedItem), Brushes.Black), new Point(0, 250));

                }

                var imagei = new DrawingImage(visual.Drawing);

                image.Source = imagei;

            }
        }
コード例 #5
0
ファイル: BaseMef.cs プロジェクト: jefflequeux/DarkangeUtils
        public void AddDecorationError(BasePropertyDeclarationSyntax _property, string textFull, string toolTipText, FixErrorCallback errorCallback)
        {
            var lineSpan = tree.GetLineSpan(_property.Span, usePreprocessorDirectives: false);
            int lineNumber = lineSpan.StartLinePosition.Line;
            var line = _textView.TextSnapshot.GetLineFromLineNumber(lineNumber);
            var textViewLine = _textView.GetTextViewLineContainingBufferPosition(line.Start);
            int startSpace = textFull.Length - textFull.TrimStart().Length;
            int endSpace = textFull.Length - textFull.TrimEnd().Length;

            SnapshotSpan span = new SnapshotSpan(_textView.TextSnapshot, Span.FromBounds(line.Start.Position + startSpace, line.End.Position - endSpace));
            Geometry g = _textView.TextViewLines.GetMarkerGeometry(span);
            if (g != null)
            {
                rects.Add(g.Bounds);

                GeometryDrawing drawing = new GeometryDrawing(_brush, _pen, g);
                drawing.Freeze();

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

                Image image = new Image();
                image.Source = drawingImage;
                //image.Visibility = Visibility.Hidden;

                Canvas.SetLeft(image, g.Bounds.Left);
                Canvas.SetTop(image, g.Bounds.Top);
                _layer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, null, image, (t, ui) =>
                {
                    rects.Remove(g.Bounds);
                });

                DrawIcon(span, g.Bounds.Left - 30, g.Bounds.Top, toolTipText, errorCallback);
            }
        }
コード例 #6
0
ファイル: MainWindow.xaml.cs プロジェクト: hh54188/King
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (KinectSensor.KinectSensors.Count > 0)
            {
                this.sensor = KinectSensor.KinectSensors[0];

                if (!this.sensor.IsRunning)
                {
                    this.sensor.DepthStream.Range = DepthRange.Near;
                    this.sensor.DepthFrameReady += sensor_DepthFrameReady;
                    this.sensor.DepthStream.Enable();

                    
                    this.sensor.SkeletonStream.EnableTrackingInNearRange = true;
                    this.sensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
                    this.sensor.SkeletonFrameReady += sensor_SkeletonFrameReady;
                    this.sensor.SkeletonStream.Enable();

                    this.sensor.Start();
                }

                this.drawingGroup = new DrawingGroup();
                this.imageSource = new DrawingImage(this.drawingGroup);
                this.SkeletonController.Source = this.imageSource;
            }
        }
コード例 #7
0
        /// <summary>
        /// The ghost gate to be drawn and added to the Sketch. The ghost gates are tracked in
        /// Edit Menu in currGhosts. It delegates when to draw and undraw these. The Ghosts have
        /// the shape that is associated with it so that it can update Orientation.
        ///
        /// Also the name Ghost gate is super cool
        /// </summary>
        /// <param name="shape"></param>
        /// <param name="SketchPanel"></param>
        public GhostGate(Sketch.Shape shape, ref SketchPanelLib.SketchPanel SketchPanel, ref GateDrawing.GateDrawing gateDrawer)
        {
            //initialize everything
            startPoint = new System.Windows.Point();
            endPoint   = new System.Windows.Point();

            subscribed = false;

            if (!Domain.LogicDomain.IsGate(shape.Type))
            {
                return;
            }

            myShape = shape;

            // Make the desired image
            GeometryDrawing ghostGate = gateDrawer.DrawGate(myShape.Type, myShape.Bounds, false, true, myShape.Orientation);

            System.Windows.Media.DrawingImage drawingImage = new System.Windows.Media.DrawingImage(ghostGate);
            relabelImage        = new System.Windows.Controls.Image();
            relabelImage.Source = drawingImage;

            sketchPanel = SketchPanel;

            drawingAdvice = createDrawingAdvice(ref gateDrawer);

            //Actual adding of the image
            InkCanvas.SetLeft(relabelImage, myShape.Bounds.Left);
            InkCanvas.SetTop(relabelImage, myShape.Bounds.Top);

            sketchPanel.InkCanvas.Children.Add(relabelImage);
            sketchPanel.InkCanvas.Children.Add(drawingAdvice);
        }
コード例 #8
0
        /// <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(); };
        }
コード例 #9
0
        public static FrameworkElement LoadSvg(string filename)
        {
            var settings = new WpfDrawingSettings();

            settings.IncludeRuntime = true;
            var renderer = new WpfDrawingRenderer(settings);

            renderer.LinkVisitor       = new LinkVisitor();
            renderer.ImageVisitor      = new EmbeddedImageVisitor();
            renderer.FontFamilyVisitor = new FontFamilyVisitor();
            var svgWindow = new WpfSvgWindow(4096, 4096, renderer);

            svgWindow.LoadDocument(filename);
            svgWindow.Resize((int)svgWindow.Document.RootElement.Width.BaseVal.Value, (int)svgWindow.Document.RootElement.Height.BaseVal.Value);
            renderer.InvalidRect = SvgRectF.Empty;
            renderer.Render(svgWindow.Document as SvgDocument);
            var drawing = new System.Windows.Media.DrawingImage();

            drawing.Drawing = renderer.Drawing;
            var image = new System.Windows.Controls.Image();

            image.Source = drawing;
            image.Width  = renderer.Window.InnerWidth;
            image.Height = renderer.Window.InnerHeight;
            return(image);
        }
コード例 #10
0
ファイル: KinectBodyView.cs プロジェクト: praveenv4k/indriya
        /// <summary>
        /// Initializes a new instance of the KinectBodyView class
        /// </summary>
        /// <param name="kinectSensor">Active instance of the KinectSensor</param>
        public KinectBodyView(KinectSensor kinectSensor)
        {
            if (kinectSensor == null)
            {
                throw new ArgumentNullException("kinectSensor");
            }

            // get the coordinate mapper
            _coordinateMapper = kinectSensor.CoordinateMapper;

            // get the depth (display) extents
            FrameDescription frameDescription = kinectSensor.DepthFrameSource.FrameDescription;

            // get size of joint space
            _displayWidth = frameDescription.Width;
            _displayHeight = frameDescription.Height;



            // Create the drawing group we'll use for drawing
            _drawingGroup = new DrawingGroup();

            // Create an image source that we can use in our image control
            _imageSource = new DrawingImage(_drawingGroup);
        }
コード例 #11
0
        void CreateAndAddAdornment(ITextViewLine line, SnapshotSpan span, Brush brush, bool extendToRight)
        {
            var markerGeometry = _view.TextViewLines.GetMarkerGeometry(span);

            double left = markerGeometry.Bounds.Left;
            double width = extendToRight ? _view.ViewportWidth + _view.MaxTextRightCoordinate : 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);
        }
コード例 #12
0
 public ProjectorViewWindow()
 {
     InitializeComponent();
     drawingGroup = new DrawingGroup();
     var imageSource = new DrawingImage(drawingGroup);
     Display.Source = imageSource;
 }
コード例 #13
0
        public void Init()
        {
            DrawingGroup dg = new DrawingGroup();
            ImageDrawing id = new ImageDrawing(UnderlayImage, new Rect(0, 0, UnderlayImage.PixelWidth, UnderlayImage.PixelHeight));
            dg.Children.Add(id);

            pointsGeometryGroup = new GeometryGroup();
            linesGeometryGroup = new GeometryGroup();
            middlePointGeoGrp = new GeometryGroup();
            if (points != null)
            {
                SetPointsGeometry();
            }

            GeometryDrawing gd = new GeometryDrawing(Brushes.Blue, null, pointsGeometryGroup);
            dg.Children.Add(gd);

            GeometryDrawing gd2 = new GeometryDrawing(null, new Pen(Brushes.LightGreen,3), linesGeometryGroup);
            dg.Children.Add(gd2);

            GeometryDrawing gd1 = new GeometryDrawing(Brushes.Red, null, middlePointGeoGrp);
            dg.Children.Add(gd1);

            Brush b = new SolidColorBrush(Colors.Red);
            b.Opacity = 0.5;
            mousePointGeometryDrwaing = new GeometryDrawing(b, null, null);
            dg.Children.Add(mousePointGeometryDrwaing);

            DrawingImage di = new DrawingImage(dg);
            this.Source = di;

            chosenPoint = -1;
        }
コード例 #14
0
ファイル: MainWindow.xaml.cs プロジェクト: noa99kee/K4W2-Book
 public MainWindow()
 {
     drawingGroup = new DrawingGroup();
     imageSource = new DrawingImage( drawingGroup );
     this.DataContext = this;
     InitializeComponent();
 }
コード例 #15
0
ファイル: MaterialConverter.cs プロジェクト: Altaxo/Altaxo
		public static ImageSource GetImageSourceFromAxoColor(AxoColor axoColor, int width, int height)
		{
			var innerRect = new Rect(0, 0, width, height);
			var geometryDrawing = new GeometryDrawing() { Geometry = new RectangleGeometry(innerRect) };
			geometryDrawing.Brush = new SolidColorBrush(GuiHelper.ToWpf(axoColor));
			DrawingImage geometryImage = new DrawingImage(geometryDrawing);
			geometryImage.Freeze(); // Freeze the DrawingImage for performance benefits.
			return geometryImage;
		}
コード例 #16
0
ファイル: Manager.cs プロジェクト: TNOCS/csTouch
        private Manager()
        {
            #region Creates Loading Threads

            _loaderThreadForThumbnails = new Thread(LoaderThreadThumbnails)
            {
                IsBackground = true,
                Priority = ThreadPriority.BelowNormal
            };
            _loaderThreadForThumbnails.Start();

            _loaderThreadForNormalSize = new Thread(LoaderThreadNormalSize)
            {
                IsBackground = true,
                Priority = ThreadPriority.BelowNormal
            };
            _loaderThreadForNormalSize.Start();

            #endregion

            Application.Current.Exit += Current_Exit;

            #region Loading Images from Resources

            var resourceDictionary = new ResourceDictionary
            {
                Source = new Uri("csCommon;component/Resources/Styles/Resources.xaml", UriKind.Relative)
            };
            _loadingImage = resourceDictionary["ImageLoading"] as DrawingImage;
            _loadingImage.Freeze();
            _errorThumbnail = resourceDictionary["ImageError"] as DrawingImage;
            _errorThumbnail.Freeze();

            #endregion

            # region Create Loading Animation

            ScaleTransform scaleTransform = new ScaleTransform(0.5, 0.5);
            SkewTransform skewTransform = new SkewTransform(0, 0);
            RotateTransform rotateTransform = new RotateTransform(0);
            TranslateTransform translateTransform = new TranslateTransform(0, 0);

            TransformGroup group = new TransformGroup();
            group.Children.Add(scaleTransform);
            group.Children.Add(skewTransform);
            group.Children.Add(rotateTransform);
            group.Children.Add(translateTransform);

            DoubleAnimation doubleAnimation = new DoubleAnimation(0, 359, new TimeSpan(0, 0, 0, 1));
            doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;

            rotateTransform.BeginAnimation(RotateTransform.AngleProperty, doubleAnimation);

            _loadingAnimationTransform = group;

            #endregion
        }
コード例 #17
0
        /// <summary></summary>
        /// <param name="kinectConnector"></param>
        public KinectBodyDrawer(KinectConnector kinectConnector)
        {
            this.kinectConnector = kinectConnector;

            drawingGroup = new DrawingGroup();
            ImageSource = new DrawingImage(drawingGroup);

            kinectConnector.BodyUpdated += (_, e) => Draw(e.Body);
        }
コード例 #18
0
        private Image CreateImageToHighlightLine(Geometry geometry, LineResultMarker marker)
        {
            GeometryDrawing backgroundGeometry = new GeometryDrawing(marker.Fill, marker.Outline, geometry);
            backgroundGeometry.Freeze();

            DrawingImage backgroundDrawning = new DrawingImage(backgroundGeometry);
            backgroundDrawning.Freeze();

            return new Image {Source = backgroundDrawning};
        }
コード例 #19
0
ファイル: MousematType.cs プロジェクト: SpoinkyNL/Artemis
        public ImageSource DrawThumbnail(LayerModel layer)
        {
            var thumbnailRect = new Rect(0, 0, 18, 18);
            var visual = new DrawingVisual();
            using (var c = visual.RenderOpen())
                c.DrawImage(ImageUtilities.BitmapToBitmapImage(Resources.mousemat), thumbnailRect);

            var image = new DrawingImage(visual.Drawing);
            return image;
        }
コード例 #20
0
ファイル: BodyCamera.cs プロジェクト: wuyuntao/Mokap
        public BodyCamera(Image image, int width, int height)
        {
            this.width = width;
            this.height = height;

            drawingGroup = new DrawingGroup();
            drawingImage = new DrawingImage(drawingGroup);

            image.Source = drawingImage;
        }
コード例 #21
0
 public void ShowMidPoint()
 {
     DrawingGroup dg = new DrawingGroup();
     ImageDrawing id = new ImageDrawing(UnderlayImage, new Rect(0, 0, UnderlayImage.PixelWidth, UnderlayImage.PixelHeight));
     dg.Children.Add(id);
     GeometryDrawing gd1 = new GeometryDrawing(Brushes.Red, null, middlePointGeoGrp);
     dg.Children.Add(gd1);
     DrawingImage di = new DrawingImage(dg);
     this.Source = di;
 }
コード例 #22
0
        /// <summary>
        /// Freezes and then creates an image object from a GeometryGroup.
        /// </summary>
        /// <param name="brush">The fill brush for the group.</param>
        /// <param name="pen">The Border pen for the group.</param>
        /// <param name="group">The group to create an image from.</param>
        /// <returns>An image object that can be added to the canvas.</returns>
        public static Image CreateImage(this  GeometryGroup group, Brush brush, Pen pen)
        {
            group.Freeze();

            var drawing = new GeometryDrawing(brush, pen, group);
            drawing.Freeze();

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

            return new Image { Source = drawingImage };
        }
コード例 #23
0
ファイル: MainWindow.xaml.cs プロジェクト: RoboTricks/kinect
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {

            //Create a Drawing Group that will be used for Drawing 
            this.drawingGroup = new DrawingGroup();

            //Create an image Source that will display our skeleton
            this.imageSource = new DrawingImage(this.drawingGroup);

            //Display the Image in our Image control
            Image.Source = imageSource;

            try
            {
                //Check if the Sensor is Connected
                if (sensor.Status == KinectStatus.Connected)
                {
                    //Start the Sensor
                    sensor.Start();
                    //Tell Kinect Sensor to use the Default Mode(Human Skeleton Standing) || Seated(Human Skeleton Sitting Down)
                    sensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Default;
                    //Subscribe to te  Sensor's SkeletonFrameready event to track the joins and create the joins to display on our image control
                    sensor.SkeletonFrameReady += sensor_SkeletonFrameReady;
                    //nice message with Colors to alert you if your sensor is working or not
                    Message.Text = "  Kinect Ready";
                    Message.Background = new SolidColorBrush(Colors.Green);
                    Message.Foreground = new SolidColorBrush(Colors.White);

                    // Turn on the skeleton stream to receive skeleton frames
                    this.sensor.SkeletonStream.Enable();
                }
                else if (sensor.Status == KinectStatus.Disconnected)
                {
                    //nice message with Colors to alert you if your sensor is working or not
                    Message.Text = " Kinect Sensor is not Connected";
                    Message.Background = new SolidColorBrush(Colors.Orange);
                    Message.Foreground = new SolidColorBrush(Colors.Black);

                }
                else if (sensor.Status == KinectStatus.NotPowered)
                {
                    //nice message with Colors to alert you if your sensor is working or not
                    Message.Text = " Kinect Sensor is not Powered";
                    Message.Background = new SolidColorBrush(Colors.Red);
                    Message.Foreground = new SolidColorBrush(Colors.Black);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

            }
        }
コード例 #24
0
ファイル: Image.cs プロジェクト: pentlandfirth/PongForKinect
        public PongImage()
        {
            this.SizeChanged += new SizeChangedEventHandler(PongImage_SizeChanged);
            drawingGroup = new DrawingGroup();
            Source = new DrawingImage(drawingGroup);
            Game = new Game(this);
            Game.Kinect.OnFrame += new EventHandler(Kinect_OnFrame);

            fpsTimeStamp = DateTime.Now;
            fpsCounter = 0;

            Draw();
        }
コード例 #25
0
		public ImagePartViewModel(LayoutPartImageProperties properties)
		{
			if (properties != null)
			{
				Stretch = properties.Stretch;
				if (properties.SourceUID != Guid.Empty)
				{
					if (properties.IsVectorImage)
						ImageSource = new DrawingImage(ServiceFactoryBase.ContentService.GetDrawing(properties.SourceUID));
					else
						ImageSource = ServiceFactoryBase.ContentService.GetBitmapContent(properties.SourceUID);
				}
			}
		}
コード例 #26
0
        public SnappedHumanRenderer()
        {
            drawingGroup = new DrawingGroup();
            imageSource = new DrawingImage(drawingGroup);
            humanSnapper = new HumanSnapper();
            aCNetworkEntity = new ACNetworkEntity("193.6.10.10", 16115); //new ACNetworkEntity("127.0.0.1", 11000);

            //humanSnapper.HumansSnapped += humanSnapper_HumansSnapped;

            //timer = new System.Timers.Timer(100);
            //// Hook up the Elapsed event for the timer.
            //timer.Elapsed += ACoordinateSendingUdpEvent;
            //timer.AutoReset = true;
            //timer.Enabled = true;
        }
コード例 #27
0
ファイル: MainWindow.xaml.cs プロジェクト: fvioz/Kinect
        public void InitializeKinect()
        {
            this.drawingGroup = new DrawingGroup();
            this.imageSource = new DrawingImage(this.drawingGroup);

            foreach (var potencialSensor in KinectSensor.KinectSensors) {
                if (potencialSensor.Status == KinectStatus.Connected) {
                    this.sensor = potencialSensor;
                    break;
                }
            }

            InitializeScan();
            InitializeSpeech();
        }
コード例 #28
0
        private void AddMarker(SnapshotSpan span, Geometry markerGeometry, FormatInfo formatInfo)
        {
            GeometryDrawing drawing = new GeometryDrawing(formatInfo.Background, formatInfo.Outline, markerGeometry);
            drawing.Freeze();

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

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

            // Align the image with the top of the bounds of the text geometry
            Canvas.SetLeft(image, markerGeometry.Bounds.Left);
            Canvas.SetTop(image, markerGeometry.Bounds.Top);

            adornmentLayer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, null, image, null);
        }
コード例 #29
0
        private Manager()
        {
            #region Create Loading Threads
            for (int i = 0; i < MaxThreads; i++)
            {
                Thread loaderThread = new Thread(LoaderWork)
                {
                    IsBackground = true,
                    Priority = ThreadPriority.BelowNormal,
                    Name = $"ImageLoaderThread{i + 1}"
                };
                loaderThread.Start();
            }
            #endregion

            #region Load Images from Resources
            ResourceDictionary resourceDictionary = new ResourceDictionary();
            resourceDictionary.Source = new Uri("ImageLoader;component/Resources.xaml", UriKind.Relative);
            _loadingImage = resourceDictionary["ImageLoading"] as DrawingImage;
            _loadingImage?.Freeze();
            _errorThumbnail = resourceDictionary["ImageError"] as DrawingImage;
            _errorThumbnail?.Freeze();
            #endregion

            # region Create Loading Animation
            ScaleTransform scaleTransform = new ScaleTransform(0.5, 0.5);
            SkewTransform skewTransform = new SkewTransform(0, 0);
            RotateTransform rotateTransform = new RotateTransform(0);
            TranslateTransform translateTransform = new TranslateTransform(0, 0);

            TransformGroup group = new TransformGroup();
            group.Children.Add(scaleTransform);
            group.Children.Add(skewTransform);
            group.Children.Add(rotateTransform);
            group.Children.Add(translateTransform);

            DoubleAnimation doubleAnimation = new DoubleAnimation(0, 359, new TimeSpan(0, 0, 0, 1))
            {
                RepeatBehavior = RepeatBehavior.Forever
            };

            rotateTransform.BeginAnimation(RotateTransform.AngleProperty, doubleAnimation);

            _loadingAnimationTransform = group;
            #endregion
        }
コード例 #30
0
ファイル: KeyboardType.cs プロジェクト: SpoinkyNL/Artemis
        public ImageSource DrawThumbnail(LayerModel layer)
        {
            var thumbnailRect = new Rect(0, 0, 18, 18);
            var visual = new DrawingVisual();
            using (var c = visual.RenderOpen())
            {
                if (layer.Properties.Brush != null)
                {
                    c.DrawRectangle(layer.Properties.Brush,
                        new Pen(new SolidColorBrush(Colors.White), 1),
                        thumbnailRect);
                }
            }

            var image = new DrawingImage(visual.Drawing);
            return image;
        }
コード例 #31
0
        public TrajectoryView(Image img)
        {
            // Create the drawing group we'll use for drawing
            this.m_drawingGroup = new DrawingGroup();

            // Create an image source that we can use in our image control
            this.m_imageSource = new DrawingImage(this.m_drawingGroup);

            // Display the drawing using our image control
            img.Source = this.m_imageSource;

            m_drawboard = img;
            m_renderHeight = img.Height;
            m_renderWidth = img.Width;

            Console.WriteLine(m_renderWidth + " ", m_renderHeight);
        }
コード例 #32
0
ファイル: Squelette.cs プロジェクト: antoinedelia/Alpha-Avina
        public void Load()
        {
            connexion_kinect = Connexion.getInstance();
            sensor = connexion_kinect.Sensor;

            if (sensor == null)
            {
                MessageBox.Show("Kinect non connecté");
                return;
            }

            this.drawingGroup = new DrawingGroup();

            // Create an image source that we can use in our image control
            this.imageSource = new DrawingImage(this.drawingGroup);
            this.sensor.SkeletonFrameReady += this.SensorSkeletonFrameReady;
        }
コード例 #33
0
        private void WithoutRuleDataMode()
        {
            if (!messageBoxIsShow)
            {
                var result = MessageBox.Show("需要一个规则文件或者规则文件不受支持。\n是否手动选择文件?\n(否只会显示当前最后一次选择的图片。)", "错误", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (result == MessageBoxResult.Yes)
                {
                    this.SelectRulePath();
                }
                messageBoxIsShow = true;
                return;
            }
            if (SelectItemTmp == null)
            {
                return;
            }
            BitmapImage image = new BitmapImage(new Uri(this.SelectItemTmp.SelectedItem.ToString()));

            ImageBoxSource = new System.Windows.Media.DrawingImage()
            {
                Drawing = new ImageDrawing(image, new Rect(0, 0, image.PixelWidth, image.PixelHeight))
            };
        }