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, July 1, 2009 3:06:06 AM(UTC)
martin.pastor

Groups: Registered
Posts: 19


Dear Friends,

I am using Leadtools v16.0 and MS Visual Studio 2005 in order to load and display an image. When the image is displayed, I want to plot some straight lines on it. According to the examples, I am using
“ri = codecs.Load(path);
RasterImageViewer riv = new RasterImageViewer();
riv.Image = new RasterImage(ri);
using (RasterImageGdiPlusGraphicsContainer container = riv.Image.CreateGdiPlusGraphics())
{using (Pen pen = new Pen(Color.FromArgb(alpha, Color.Red), w))
{
Point p1 = new Point(x1, y1);
Point p2 = new Point(x2, y2);

container.Graphics.DrawLine(pen, pp1, pp2);
}
}”
The main problem occurs because of the displayed images are in 8-bits gray scale and are about 200 Mpx. When the images are turn into a GDI, it changes from 8-bits to 32-bits, I computer has enough memory.

My question is, is there another way to plot a line on image?

Thanks in advanced,

Martín
 

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, July 2, 2009 6:41:39 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Martin,

1. Do you want to make the line part of the image's pixel data or do you want to draw it on the viewer control?
2. How long is the line? If it will only be on a small part of the image (not from one corner to opposite corner), it is better not to create a GDI container for the whole image. Instead, create a smaller image, draw the line on that image, then combine the 2 images.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Friday, July 3, 2009 4:08:41 AM(UTC)
martin.pastor

Groups: Registered
Posts: 19


Dear Maen,
I only want to draw it on the viewer control. This line is on an large part of the image, from one side to the opposite side. Is there another way that the GDI?
Thanks.
 
#4 Posted : Saturday, July 4, 2009 10:58:36 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

If you want to draw the line on the viewer (not directly on the image), you can use the following code:
+------+
Pen pen = new Pen(Color.FromArgb(alpha, Color.Red), w);
Point p1 = new Point(x1, y1);
Point p2 = new Point(x2, y2);
rasterImageViewer1.CreateGraphics().DrawLine(pen, pp1, pp2);
+------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#5 Posted : Wednesday, July 15, 2009 4:34:48 AM(UTC)
martin.pastor

Groups: Registered
Posts: 19


Dear Maen,

The first of all, I am out of the office for 10 days. So, sorry for my late. I have try, but the line is drawn for a very short time and then it disappears. How can I maintain the line? Anyway, maybe I could draw the line in ther rasterImage modiffing it, showing it. How can I do?

Thanks in advanced.

Martin
 
#6 Posted : Wednesday, July 15, 2009 5:02:21 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

To keep the line after drawing it, you need to draw it directly on the image.
After drawing the line, you can convert the image to 8-bit by using the ColorResolutionCommand Class.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#7 Posted : Thursday, July 16, 2009 2:27:11 AM(UTC)
martin.pastor

Groups: Registered
Posts: 19


Dear Maen,

Thank you for your advices. I don't know how to paint a line with Leadtools. Is there some method or I must paint pixels by pixel?

Thanks in advanced.

Martin
 
#8 Posted : Thursday, July 16, 2009 4:18:00 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

You can use RasterImage.CreateGdiPlusGraphics().Graphics.DrawLine method. In this case, if the image is changed to 24-bit or 32-bit, you can convert it to 8-bit by using the ColorResolutionCommand class or GrayscaleCommand Class.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#9 Posted : Friday, July 17, 2009 3:17:20 AM(UTC)
martin.pastor

Groups: Registered
Posts: 19


Ok,

Thank you very much
 
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.078 seconds.