Jump to content

Line / Curve Tool - Length Fix Request

Recommended Posts


just a few days ago i started to use paint.net, everything is great (much more better than MS paint :D), but there is one thing what i really don't like - "Line length bug" (at least i think that it is bug)

Now look, when i'm trying to draw a simple line, the real line length isn't correct: (watch example)


As you can see paint.net shows that line length is only 1px, but thats not correct... Should i have to every time remind myself that the line is for 1px longer? I don't know how the other people think, but for me this is pretty annoying. ;/

Link to comment
Share on other sites

I get the same result. I also notice that if I try to make it only 1px wide, it vanishes completely.


The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

well 1px point we all can make with pencil tool or whatever, thats just not so important... :)

Line tool have to start counting length from "2" then everything would be OK. Or the other option - line / curve tool first px appears in moment when the mouse is pressed. (like in the MS Paint)

I hope you all understand what i mean... :)

Sorry for my English.

Link to comment
Share on other sites

I think your Line is actually 1 pixel long, not 2.

Don't be surprised. It has 2 adjacent pixels. This means that its length is 1 pixel.

More general: If a line has N pixels, its length is N - 1 pixels.

Explanation: Just substract the pixels (horizontal) coordinates.

And, by the way: Why do you consider that the length should be mesured from the LEFT edge of the FIRST pixel to the RIGTH edge of the LAST pixel???

Paint.NET mesures it correctly, from the CENTER of the FIRST pixel to the CENTER of the LAST pixel.

If that line of yours would have been reported having a length of 2, I would have called it a bug.

Hope you understood...

Link to comment
Share on other sites

thats some kind of

I understand your explanation, but still...

I draw the line: "100px", then this lines length actually is 99px? If it's not the LINE LENGTH these 100px then what is it? Line WIDTH?

I'm little bit confused... ;/

EDIT: This is a family-friendly site. Let's keep it that way, OK? ~BoltBait

Link to comment
Share on other sites

I would have to agree that if a line "contains" two pixels in its' length, it is two pixels long.

A ruler is 12 inches long... it is measured from the beginning of the ruler to the end, and "contains" 12 full inches... you don't start from the end of the first inch.

Other graphics programs measure length in those terms. That does not mean that this is not by design, but if it is, it is less intuitive to me than I would like.

Just my two cents. The author of the software may have a reason for this that I am unaware of.

Total hack.

Link to comment
Share on other sites

Actually, it is very simple.

The line which displays 100 pixels, is obviously 99 pixels long.

Any first grader knows that:


There are 100 trees on a road's edge.

The distance between two of them is 1 meter.

What is the distance between the first and the last one?

Answer: 100 meters -> wrong, you failed.

Answer: 99 meters -> good, you passed.

EDIT: Be nice. ~BoltBait

Link to comment
Share on other sites

Another answer - just try:

void Test()
   Image image = new Bitmap(16, 16);
   Graphics G = Graphics.FromImage(image);
   G.DrawLine(new Pen(Color.Red), 8, 1, 8, 2);

I'm not sure what you are trying to say here. The code you posted specifies the following:

Line Starting point: 8,1

Line Ending point: 8,2

None of the arguments provided to the Drawline method specify "length", they are x,y coordinates for the beginning and end of the line (x1, y1, x2, y2).

As for the tree analogy...

Tree = border of a pixel

Space between trees = pixel

100 "trees" would be 99 "spaces", right?

If that is true, then 3 "trees" would be 2 "spaces", right?

If that is true, then a line on the screen that has a length of 2 would have 3 "trees" (or borders) and 2 "spaces" (or pixels), right?

Total hack.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...