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



Last Go to last post Unread Go to first unread post
#1 Posted : Monday, March 13, 2006 5:35:54 AM(UTC)

Groups: Registered
Posts: 7

I am writing an application that allows the user to select a region(s)
to zoom to. I am recording those regions and providing a mechanism for
selecting which of the regions they would like to zoom to. When the
region is set, I am not automatically zooming to the region, but
instead I am attempting to hightlight the region. I am setting the
InteractiveMode to 'region' and capturing the interactive region the
user selects. I hooked into the InteractiveModeEnded event to determine
when the region selection is complete. What I would like to do upon
completion of the selection is highlight the region that was just
selected and to do that I am using the FillRegion method setting the
color to a semi-transparent color. I see this happen but then my
hightlight disappears and all I see are the marching ants that
designate the selected region. To try to work around this problem, I
launch another thread in my InteractiveModeEnded event and put that
thread to sleep for some time, and then when I fill the region it works. This can't be the recommeded way of doing this!

I have a similar problem if I try to redisplay the saved regions. I
call AddRectangleToRegion() to create a region on my image and again
call FillRegion() to attempt to hightlight the region. Again, I see it flash with my hightlight and then the dissappear.

Any suggestions on how to properly accomplish highlighting the region would be appreciated.

I am using version 14.5 of the .NET assemblies.

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 : Monday, March 13, 2006 11:44:34 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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


I checked the same issue on the latest LEADTOOLS .Net DLLs (, but didn't notice the same problem.
When calling the IRasterImage.FillRegion method, the region filed correctly with no problems.

I am attaching a sample VBNet project that shows how to use regions in LEADTOOLS .Net, and how to call the IRasterImage.FillRegion.

Please recheck the same issue using the attached project (with the latest LEADTOOLS .Net patches) and let me know what will happen with you.

Maen Badwan
LEADTOOLS Technical Support
File Attachment(s):
VBNet_WorkingWithRegions.zip (10kb) downloaded 39 time(s).
#3 Posted : Tuesday, March 14, 2006 9:41:57 AM(UTC)

Groups: Registered
Posts: 7

Thank you for the quick response.

I downloaded the latest patch off the support site and tried my project
again. It appears to be working as I would expect. I believe that part
of my problem was how I was obtaining a Graphics object. I was using
the graphics object of the viewer control and not the Image; so it
makes sense to me that I was drawing onto the control surface which would be covered up by the image.

Now I have a couple of additional questions:

1.) When I don't want to show the region any more, I clear the region
using the MakeRegionEmpty(). But the highlight that I did using the
FillRegion remains. How can I undo the fill? I cloned the image before
starting and just reset the Image to the saved clone, but that can be a big chunk of memory I would think.

2.) When I initially display the image I am using RasterPaintProperties
to display a gray scale image. We tend to work with large size images
that don't look very good when the fit the viewer. When I use the
FillRegion() method it appears I lose my RasterPaintProperties. Is
there any way to redisplay the image with the gray scale and the region highlighted?

I have included a small application that is attempting to perform the 3 action I desire:
1.) Select an image an highlight the region
2.) Clear the region and the highlight
3.) Redisplay the last selected region and highlight.

The application is developed using Visual Studio 2003 and version 1.1
of the framework. Sorry for the size, but it has the image that have been using for testing.
File Attachment(s):
RegionDisplay.zip (1,572kb) downloaded 40 time(s).
#4 Posted : Thursday, March 16, 2006 4:33:45 AM(UTC)


Groups: Guests
Posts: 3,022

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

1) Saving a copy of the image is the only solution to this. 
However, you do not need to clone the whole image; just clone the
region (before filling it) and use the CombineCommand class to
copy/paste it over the highlighted region.  This will reduce the
memory required considerably.  I am attaching a modified version
of your sample that shows this.  My modifications are between "//Bashar" and "//Bashar End" tags.

2) This seems to be caused by calling CreateGdiPlusGraphics.  I do
not know if this is correct behavior nor was I able to find a
workaround for it.  I submitted it as a question to
development.  I will post back when I get an update from them.  FYR, I submitted this issue with this Ref#: 4386AMN.


#5 Posted : Thursday, March 16, 2006 5:10:54 AM(UTC)


Groups: Guests
Posts: 3,022

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

I've just received an update regarding point (2).  This is normal
behavior because whenever you make a change to an image in .NET, the
framework changes it to 32 bit.  And since ScaleToGray works for
1-bit images only, it will not affect the new 32-bit image.  This conversion occurs in the .NET framework itself, not in our toolkit.

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.161 seconds.