ThumbnailXpress 6 for .NET - User Guide > How To > Pass Image Data between Accusoft Components |
Traditionally, transferring image data between Accusoft components has required passing the image data in a DIB format. But, beginning with the release of ImagXpress 11, we are adding new methods throughout our products which allow you to easily copy or transfer image data between different Accusoft objects with just a single method call.
Regardless of its product or component assembly, any Accusoft image class which supports easily sending its image data to another Accusoft object will implement two methods: CopyTo(object destination) and TransferTo(object destination). And any Accusoft image class which supports easily receiving this image data (that is, being the destination object) will be noted in its class documentation.
A CopyTo method makes a complete copy of the image data. When called, both the source and destination objects will contain their own separate copies of identical image data. A TransferTo method, on the other hand, completely transfers the image data from one object to another. When finished, the source object will no longer contain image data; the image will be owned by the destination object.
Within the ImagXpress suite of components, there are four classes which support sending their image data via CopyTo and TransferTo methods:
And within the ImagXpress suite of components, there is only one class which supports receiving image data: the ImagXpress ImageX class.
Other Accusoft products may contain additional classes which can send and receive image data.
Here's an excerpt from a simple WinForms application. The main form contains a single ThumbnailXpress instance named thumbnailXpress1. When the form loads, a single thumbnail is added to the ThumbnailXpress control from an image file named "flower.jpg". After the thumbnail has been loaded, its image data is then copied to an ImagXpress ImageX object and saved to disk as "flower-thumbnail.bmp".
C# Example |
Copy Code
|
---|---|
using System; using System.Windows.Forms; using Accusoft.ImagXpressSdk; namespace WinFormsExample { public partial class ExampleForm : Form { public ExampleForm() { InitializeComponent(); } void ExampleForm_Load(object sender, EventArgs e) { thumbnailXpress1.ItemComplete += new Accusoft.ThumbnailXpressSdk.ThumbnailXpressEvents.ItemCompleteEventHandler(thumbnailXpress1_ItemComplete); //Asynchronously load an image into the ThumbnailXpress component when the button is clicked thumbnailXpress1.Items.AddItemsFromFile("flower.jpg", 0, false); } void thumbnailXpress1_ItemComplete(object sender, Accusoft.ThumbnailXpressSdk.ItemCompleteEventArgs e) { //When the image has been thumbnailed, copy it to ImagXpress and save it to disk using (ImagXpress ix = new ImagXpress()) using (ImageX image = new ImageX(ix)) { thumbnailXpress1.Items[0].CopyTo(image); image.Save("flower-thumbnail.bmp"); } } } } |