CurveShape : InnerWidth?

Im playing with Object2D again after a while away.
It seems that if I draw a line, all I can get is a one pixel inner, unless I am missing something.
If I set border width to 0, and fillcolor to red, I get a one pixel wide red line
If I set the scale to 2, 3, 10, I get longer one pixel wide lines.

I can get thick lines if I change the border width, but what I really want is a 5 pixel wide line with a 1 pixel black border.
I can’t see how thats done from the docs: can anyone help?

In FigureShape ?

BorderWidth seems to be the value to change (try 10).

yes, it is !

Dim fx as New FigureShape fx.AddLine 0, 100, 50, 0 fx.AddLine 50, 0, -50, 0 fx.BorderWidth =10 // Line is 10 pixels fx.Border = 100 // opaque border fx.BorderColor = &cFF0000 // red border fx.FillColor = &cFFFF00 // yellow interior g.DrawObject fx, 100,100

Placed in the Paint event of a Canvas.

Thanks for the reply Emile.
No, not figure shape.

I want to draw a line, and have been using Curveshape for that.
Straight lines first, perhaps curved lines with control points later.

Imagine using standard graphics DrawLIne method but getting an outlined thick line

are you trying to make a red line 5 pixels wide with a 1 pixel wide black border (ie. total 7 pixels wide)?

You would have to use a figureshape to do that… and in reality it would be a RECTANGLE with a black border, and red interior, rotated in such a manner as to meet the desired end points.

Adjusting the scale is ZOOMING in or out so everything would get bigger (thicker) as you zoomed in (including your border)… .to maintain the border at 1 pixel… you would have to create a new figureshape with the coordinates modified, instead of using the scale feature.

Thanks Dave.
Ive come to that conclusion myself now, even though I remain astonished that this is the case.
It makes it difficult to be sure of placement though.
If I need a line that is at 17 degrees, where with a curve shape I can state the start and end points, with a figure shape I need to calculate the midpoint of a rectangle that bounds the ends of the lines.
Quite a bit of faff to reproduce ‘line from HERE to THERE’, but I’m getting there.

Thankfully a quick test shows that I can start with an empty Group, populate it with 1000 randomly placed and colored figure shapes, and invalidate a canvas to display it, in less time than I can blink.
So my initial worries about calculation times are probably unfounded, offset by the rapid display of Object2D items.

Maybe take a look at the PixMapShape class? It allows for rotating by a specific amount so it may be of use to you.

Dave’s right. I am going to have to use a rectangle, rotated.
Pixmapshape won’t do it.

length of my line is the hypotenuse formed of a right angle triangle that connects x1,y1 and x2,y2
l = sqrt((right-left) ^2 + (bottom-top) ^2)
The centre point is obvious: left + (right-left) /2 , top + (bottom-top)/2
But trying to get the rotation is a bit nasty.

I think I need to use asin … anyone know that math already?


Figureshape rotates about the first point
RoundRectShape rotates about the centre, like pixmapshape.