internal static PrinterLayer GetImagePrinterLayer(double width, double height, double centerX, double centerY) { ImageElementViewModel imageEntity = new ImageElementViewModel(); GeoImage geoImage = null; geoImage = new GeoImage(new MemoryStream(imageEntity.SelectedImage)); ImagePrinterLayer imagePrinterLayer = new ImagePrinterLayer(geoImage, 0, 0, PrintingUnit.Inch) { DrawingExceptionMode = DrawingExceptionMode.DrawException }; imagePrinterLayer.LoadFromViewModel(imageEntity); var imgWidth = imagePrinterLayer.Image.Width; var imgHeight = imagePrinterLayer.Image.Height; imagePrinterLayer.Open(); imagePrinterLayer.SetPosition(width, height, centerX, centerY, PrintingUnit.Inch); return(imagePrinterLayer); }
public static void LoadFromViewModel(this ImagePrinterLayer imagePrinterLayer, ImageElementViewModel imageElementEntity) { //GeoImage image = new GeoImage(imageElementEntity.SelectedImage); //imagePrinterLayer.Image = image; if (imageElementEntity.BackgroundStyle != null) { imagePrinterLayer.BackgroundMask = imageElementEntity.BackgroundStyle; } imagePrinterLayer.ResizeMode = imageElementEntity.ResizeMode; imagePrinterLayer.DragMode = imageElementEntity.DragMode; }