This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, April 10, 2008 11:51:29 PM(UTC)
Groups: Registered
Posts: 12
Dear Leadtools specialists :-)
If I got an active region (or a non active drawing.region object) in my RasterImage, is there a possibilty to draw ONLY the border of the region? I mean something like the FillRegion method, but without filling. I just want a drawed border of the region (freehand, polygon, etc...).
I hope you understood me.
#2
Posted
:
Sunday, April 13, 2008 4:04:03 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Does the RasterImage.FrameRegion method draw the frame
you need? If not, please explain the difference between what you want and what
this method does.
#3
Posted
:
Thursday, April 17, 2008 12:18:31 AM(UTC)
Groups: Registered
Posts: 12
Can you maybe show me a little example for the use of "RasterImage.FrameRegion"? Would be very nice....
#4
Posted
:
Sunday, April 20, 2008 4:01:11 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
What LEADTOOLS version (14, 14.5, 15) do you have?
What is the programming language that you are using?
#5
Posted
:
Wednesday, April 23, 2008 9:52:44 PM(UTC)
Groups: Registered
Posts: 12
I'm using the newest evaluation version (15) of Leadtools and write in VB.net.
Thanks for any hints...
#6
Posted
:
Thursday, April 24, 2008 9:03:52 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
If
you create a region in the raster image viewer, it will automatically create an
outline for the region. Here is a little example:
//------------------------
rasterImageViewer1.Image
= new RasterImage(RasterMemoryFlags.Conventional, 800, 600, 24, RasterByteOrder.Bgr,
RasterViewPerspective.TopLeft, null, IntPtr.Zero, 0);
rasterImageViewer1.Image.AddEllipseToRegion(null,
new Rectangle( 80, 90, 300, 220), RasterRegionCombineMode.Set);
//------------------------
#7
Posted
:
Thursday, April 24, 2008 9:31:56 PM(UTC)
Groups: Registered
Posts: 12
Thank you, but this is not what I mean. My goal woul'd be to draw a line of the outlined region which stays displayed, also if I select another region. Maybe there is a method for this purpose?
#8
Posted
:
Sunday, April 27, 2008 5:14:42 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
What
do you mean by "stays displayed"? Do you want it to be part of the
pixel data? In other words, do you want to 'burn' such an outline on the image
itself, so that when you save the image and load it into any other viewer, the
region outline becomes part of the image?
Also, what do you mean by "also if I select
another region"? Can you please explain to me what is the behavior that you need.
#9
Posted
:
Monday, April 28, 2008 1:27:14 AM(UTC)
Groups: Registered
Posts: 12
Exactly, "burn" describes exactly what I mean.
#10
Posted
:
Tuesday, April 29, 2008 12:13:17 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Please
try the code below and tell me if you face any problems:
//-------------------
rasterImageViewer2.Image
= rasterImageViewer1.Image.Clone();
rasterImageViewer2.Image.MakeRegionEmpty();
RasterImageGdiPlusGraphicsContainer
container = rasterImageViewer2.Image.CreateGdiPlusGraphics();
Graphics
g = container.Graphics;
rasterImageViewer1.Image.FrameRegion(g,
null, index);
MessageBox.Show(index.ToString());
codecs.Save(rasterImageViewer2.Image, @"c:\Temp\Region1.cmp",
RasterImageFormat.Cmp, 24);
//-------------------
#11
Posted
:
Tuesday, May 6, 2008 4:08:54 AM(UTC)
Groups: Registered
Posts: 12
Thank you! This is more or less what I need. Is it maybe possible the set the color, and the style of the resulting line when we "burn" the region on the image. It's important for us, that we can differ the real, active region between the "burned" one.
Once, while experimenting, I found a method (but I do not remember the name anymore) which draw (or "burned") a red line out of the region an filled this new rectangle (or ellipse, depends on the kind of the region), with a transparent-red color. This without the filling, would be what I search.
Maybe you got some other hints? But thank you anyway for the help!
#12
Posted
:
Wednesday, May 7, 2008 6:00:16 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
You
can try to define a new region based on the current region. The new region will
consist of a thin border at the boundaries of the old region, and when you have
it, you fill it with red or any color you want.
To
obtain this thin border region from the original region, do the following:
1.
Take a copy of the original region using RasterImage.GetRegionData
2.
Enlarge (or shrink) the original region using the ResizeRegionCommand Class
3.
Combine the old region with the resized region using the RasterImage.AddDataToRegion Method and the RasterRegionCombineMode.Xor
flag.
After that, simply use the FillCommand Class to change
the pixel colors inside the new thin region.
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.