Exemple #1
0
        public void DrawPicture(Picture picture, double x, double y)
        {
            var rlc = new RasterLayerControl();

            DrawRasterLayerImage(picture.Image, rlc);
            RotateTransform rt = new RotateTransform(picture.Angle);

            rlc.RenderTransform = rt;
            canvas.Children.Add(rlc);
            Canvas.SetLeft(rlc, x);
            Canvas.SetTop(rlc, y);
        }
Exemple #2
0
        private void DrawRasterLayerImage(System.Drawing.Image image, RasterLayerControl rlc)
        {
            if (image == null)
            {
                return;
            }
            var bmp = image;

            using (var ms = new MemoryStream()) {
                bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                ms.Position = 0;

                var bi = new BitmapImage();
                bi.BeginInit();
                bi.CacheOption  = BitmapCacheOption.OnLoad;
                bi.StreamSource = ms;
                bi.EndInit();
                rlc.Image.Source = bi;
            }
        }