Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram.CreateImage() acting weird (Read 2881 times)
rafaello
YaBB Newbies
*
Offline



Posts: 16
Joined: Jun 23rd, 2009
Diagram.CreateImage() acting weird
Jun 30th, 2009 at 8:43am
Print Post  
Hello.

I have strange problem while saving diagram into a bitmap. Like i was told i use Diagram.CreateImage() method to get a BitmapSource object representing the diagram, then i use i.e. JpegBitmapEncoder to save the bitmap file.

First strange behavior ive encountered was like this:

- i have diagram zoomed to fit items, i export it into bitmap file and the result is my file contains my exported diagram in top left corner but its like 40% of whole image, the rest is black background

Second strange thing ive encountered was when i tried to export diagram into bitmap file after using diagram's ZoomIn method:

- after zooming in i would understood that diagram's CreateImage method gets BitmapSource object of only zoomed diagram's fragment (the visible part of it), but the created image contains much larger diagram's area than my zoomed part of it

I wonder where the source of problem is, is it the diagram's CreateImage method or maybe encoder?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.CreateImage() acting weird
Reply #1 - Jul 1st, 2009 at 8:48am
Print Post  
Hi,

CreateImage should not depend on the current zoom factor. This version fixes that:
https://mindfusion.eu/_beta/wpfdiag_scaleimage.zip

Now if you need to export a scaled image, used the CreateImage(scale) method, for example:

diagram.CreateImage(diagram.ZoomFactor);

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
rafaello
YaBB Newbies
*
Offline



Posts: 16
Joined: Jun 23rd, 2009
Re: Diagram.CreateImage() acting weird
Reply #2 - Jul 1st, 2009 at 1:37pm
Print Post  
Everything works fine now, very nice job guys  Wink

Thanks for help
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint