Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic background image (Read 2927 times)
tmtton
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: May 9th, 2008
background image
May 21st, 2008 at 4:09pm
Print Post  
I use flowChart.setImage(anImage) to add a JPEG image to the flowchart background.

1) flowChart.clearAll() clears both the diagram and the background. I have to make the setImage call again to restore the background. Can the background image stay in-place on a clear?

2) flowChart.saveTo(filename) does not save the background image. So no background seen after a flowChart.loadFrom(filename). How do I store the background image along with the diagram?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: background image
Reply #1 - May 22nd, 2008 at 7:45am
Print Post  
1) It can't. For the time being, you will have to save the result of getImage, call clearAll, call setImage again.

2) Try with FlowChart.getSerializationOptions().setBackgroundImage(true);

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


I love YaBB 1G - SP1!

Posts: 39
Joined: May 9th, 2008
Re: background image
Reply #2 - May 23rd, 2008 at 8:25pm
Print Post  
When saving the diagram, we like to have a store-background-image as an option. In most cases, we just need to save the diagram. But in a few cases, we want to store the background with the diagram. Does JDiagram 2 support that?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: background image
Reply #3 - May 24th, 2008 at 9:06am
Print Post  
We have removed the SerializationOptions feature from JDiagram 2, and the BackgroundImage is always saved. You can still achieve what you need by clearing the image temporarily:

Code
Select All
public void saveDiagram(Diagram diagram, String fileName, boolean storeImage)
	throws FileNotFoundException, IOException
{
	if (storeImage)
	{
		// saveTo always saves the image
		diagram.saveTo(fileName);
	}
	else
	{
		// set the image temporarily to null
		Image image = diagram.getBackgroundImage();
		diagram.setBackgroundImage(null);

		diagram.saveTo(fileName);

		diagram.setBackgroundImage(image);
	}
}

public void loadDiagram(Diagram diagram, String fileName, boolean loadImage)
	throws FileNotFoundException, IOException
{
	if (loadImage)
	{
		// load the diagram with whatever image has been stored
		diagram.loadFrom(fileName);
	}
	else
	{
		Image image = diagram.getBackgroundImage();

		// this will also load the image
		diagram.loadFrom(fileName);

		// restore the previous image
		diagram.setBackgroundImage(image);
	}
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint