Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, August 22, 2007 2:47:11 AM(UTC)
alwayssmiling

Groups: Registered
Posts: 27


Hi,

Using codecs iam loading two images into two different raster image objects. In these one image is of type "tif" and other is "jpg". Now i had only one raster image viewer object. In my application toggle button is there if the user clicks on this then, i need to change between the images.

Initially im assigning the tiff image to the viewer.image property. Then after clicking on toggle button im changing the viewer.image to the second image. Upto here its showing fine.Then for the next button click, im trying to assign first image to the viewer. But at this point, the first image is getting null. Is there any restrictions for the raster image viewer to show only one image. can't i change the rasterimageviewrers image dynamically.


 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, August 23, 2007 12:16:27 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Hello,

What is the exact LEADTOOLS version (v14.5, v15, etc.) that you use?

Please provide me with a code snippet that shows how exactly do you declare the raster image objects, assign images to them and then change the viewer.image property to show different images.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Monday, August 27, 2007 1:45:14 AM(UTC)
alwayssmiling

Groups: Registered
Posts: 27


Hi,

Iam using Leadtools V15. Im creating two seperate images instances like,

rasterimage1 = codecs.load("image1 path");
rasterimage2 = codecs.load("image2 path");
raterimageviewer.image = rasterimage1;

So when the user clicks on the button,

if(presentImage = firstImage)
rasterimageviewer.image = rasterimage2;
else
rasterimageviewer.image = rasterimage1;

Initially im assigning an image to the viewer. Then depending the button click im assigning next image. When i try to assign the second image the first image is becoming null. This is the problem that im facing.

Thank u for ur reply.............

 
#4 Posted : Monday, August 27, 2007 6:32:31 AM(UTC)

BoydP  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Hello,

When you change a rasterImageViewer.Image, the current image
displayed is automatically disposed by the rasterImageViewer object.
 To change this default behavior set the
rasterImageViewer.AutoDisposeImages property to false. However, with this approach you must be sure to dispose of
raster images in your application when they are no longer needed.

Another
approach to fix this problem is to change the lines of code where you assign the rasterImageViewer.Image property like this:

if(presentImage = firstImage)
rasterimageviewer.image = rasterimage2.Clone();
else
rasterimageviewer.image = rasterimage1.Clone();

Notice
the addition of the Clone() method on the raster images.  This will
create a copy of the image to be assigned to the rasterImageViewer,
preventing the image from being invalid when you attempt to toggle the images.
 
#5 Posted : Thursday, August 30, 2007 12:33:34 AM(UTC)
alwayssmiling

Groups: Registered
Posts: 27


Hi,

Thank u for ur reply. I hope that it will help me.
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.072 seconds.