Page 1 of 1

Draw Rectangle unfilled C#

Posted: 2014-12-03T17:41:59-07:00
by devyekov
Sorry, here again

How to draw a rectangle unfilled on a image? Using wrapper

Regards

Re: Draw Rectangle unfilled C#

Posted: 2014-12-05T02:29:32-07:00
by dlemstra
I cannot help you with a complete example I can only use my phone at the moment. You should use the drawable classes and the Draw method of MagickImage. I hope this can help you for now. I will be behind a pc next week and then I can help you with a better example if you still need it.

Re: Draw Rectangle unfilled C#

Posted: 2014-12-05T11:48:50-07:00
by devyekov
I appreciate the attention, I expect to find before solution. Because otherwise I'll be here wondering upps jeje

I found the guide (http://imagemagick.org/Usage/draw/#primitives) but I still do not understand how to use it in the Wrapper.

Regards
Thanks

Re: Draw Rectangle unfilled C#

Posted: 2015-03-11T16:10:25-07:00
by devyekov
Hello

Can you help me with this issue that I could not solve?.
Use C# with Magick.NET-x86.dll

Regards
Thank You

Re: Draw Rectangle unfilled C#

Posted: 2015-03-12T04:53:35-07:00
by dlemstra
I completely forgot about this topic.

When you draw a circle it has two color. The stroke color (the line) and the fill color (part inside line). You can make it 'empty' if you set the fill color to transparent. Below is an example:

Code: Select all

using (MagickImage image = new MagickImage(new MagickColor("yellow"), 500, 500))
{
  DrawableStrokeColor strokeColor = new DrawableStrokeColor(new MagickColor("purple"));
  DrawableStrokeWidth stokeWidth = new DrawableStrokeWidth(5);
  DrawableFillColor fillColor = new DrawableFillColor(MagickColor.Transparent);
  DrawableCircle circle = new DrawableCircle(250, 250, 100, 100);

  image.Draw(strokeColor, stokeWidth, fillColor, circle);
  image.Write(@"C:\circl.png");
}

Re: Draw Rectangle unfilled C#

Posted: 2015-03-12T15:45:36-07:00
by devyekov
Thank you very much for your prompt response. I works great.

I have just a curiosity, not a mistake, but when the lines of a rectangle is generated, the lines are not uniform, on some occasions the line is not seen. (part of the line)

Regards
thx

Re: Draw Rectangle unfilled C#

Posted: 2015-03-12T22:45:01-07:00
by dlemstra
Can you post an example? I don't understand the question/issue. Are you using the latest version of Magick.NET?

Re: Draw Rectangle unfilled C#

Posted: 2015-03-13T10:21:38-07:00
by devyekov
Hi

To generate the image using the same method you gave me. Use Magick.NET-7.0.0.0007-Q16-x86-net20
How do I send a picture?

Regards
Thk

Re: Draw Rectangle unfilled C#

Posted: 2015-03-14T06:28:31-07:00
by dlemstra
You can post your image on something like dropbox and post a link here.

Re: Draw Rectangle unfilled C#

Posted: 2015-03-19T23:22:39-07:00
by devyekov
In the image on upper right corner, line becomes thinner. It is not a mistake, but why is not uniform?

What I observed is that this occurs with high resolution images.

https://www.dropbox.com/s/io6x7esk11aib ... o.jpg?dl=0

Thk
Regards

Re: Draw Rectangle unfilled C#

Posted: 2015-03-20T04:44:30-07:00
by dlemstra
Are you adding the rectangle before or after you resize the image?

Re: Draw Rectangle unfilled C#

Posted: 2015-03-20T09:48:01-07:00
by devyekov
Hi,

I make no resize before or after. Only apply the rectangle. I can't now load the original image, later I upload the image.

Code: Select all

MagickImage image = new MagickImage(strPathImage);
DrawableStrokeColor strokeColor = new DrawableStrokeColor(new MagickColor("white"));
DrawableStrokeWidth stokeWidth = new DrawableStrokeWidth(7);
DrawableFillColor fillColor = new DrawableFillColor(MagickColor.Transparent);
DrawableRectangle rec = new DrawableRectangle(new Rectangle(300, 300, image.Width - 600, image.Height - 600));
image.Draw(strokeColor, stokeWidth, fillColor, rec);
image.Write(strOutImagen);
Regards

Re: Draw Rectangle unfilled C#

Posted: 2015-03-23T22:01:39-07:00
by devyekov

Re: Draw Rectangle unfilled C#

Posted: 2015-04-06T06:53:46-07:00
by dlemstra
We were able to reproduce the issue and the next release of Magick.NET will include a fix for this. Thank you for all the great information that helped us find the bug.

Re: Draw Rectangle unfilled C#

Posted: 2015-04-06T11:19:18-07:00
by devyekov
Excellent, it was a pleasure. Thank to you guys.