|
Shade btw two arc's |
| Posted by icm63 on Jan-01-2026 09:08 |
|
I know how to shade btw two lines drawn from an array (like two moving averages).
Like
c.addInterLineLayer(layer0.getLine(), layer1.getLine(), &H80ff0000, &H80008800)
But how can one shade btw two arcs (DrawArea.arc) ?
Say two semi circles, one small, one large?
Any ideas? |
Re: Shade btw two arc's |
| Posted by Peter Kwan on Jan-02-2026 22:24 |
|
Hi icm63,
There is no built in function to shade between two graphical arcs (drawn with DrawArea.arc).
If you can draw the two arcs as two curves in a spline layer, then you can shade in between using addInterLineLayer. You can draw an arc by tracing out the points along the arc (such as one point per 5 degrees on the arc). This should approximate the arc quite well.
Best Regards
Peter Kwan |
Re: Shade btw two arc's |
| Posted by icm63 on Jan-03-2026 01:22 |
|
| see attached an idea?
|
Re: Shade btw two arc's |
| Posted by Peter Kwan on Jan-03-2026 19:36 |
|
Hi icm63,
Using flood fill is one possible way, but it is a purely raster graphics concept and is not supported by vector graphics system. For example, if would not work with SVG or with native PDF graphics.
For your case, it should be easy to just trace out the polygon and fill it (see code below). Another method is to draw it as a donut chart, with only one slice visible and all the other slices transparent, and then merge the donut chart onto your chart using DrawArea.merge.
' Code to trace out the polygon and fill it
Dim cx As Integer = 200 'Center X
Dim cy As Integer = 180 'Center Y
Dim r1 As Integer = 130 'Arc 1 Radius
Dim r2 As Integer = 90 'Arc 2 Radius
Dim a1 As Double = 0 'Start Angle
Dim a2 As Double = 100 'End Angle
Dim segmentCount As Integer = 50 'Segment count
'Arc 1 segment
Dim coors As New List(Of Integer)
For i As Integer = 0 To segmentCount
Dim angle As Double = a1 + (a2 - a1) * i / segmentCount * Math.PI / 180
coors.Add(cx + r1 * Math.Sin(angle))
coors.Add(cy - r1 * Math.Cos(angle))
Next
'Arc 2 segment
For i As Integer = segmentCount To 0 Step -1
Dim angle As Double = a1 + (a2 - a1) * i / segmentCount * Math.PI / 180
coors.Add(cx + r2 * Math.Sin(angle))
coors.Add(cy - r2 * Math.Cos(angle))
Next
'Fill the polygon
Dim d As DrawArea = c.getDrawArea()
d.polyShape(coors.ToArray(), Chart.Transparent, &HFF9900)
'The arc themselves
d.arc(cx, cy, r1, r1, a1, a2, &HFF0000)
d.arc(cx, cy, r2, r2, a1, a2, &HFF0000)
Best Regards
Peter Kwan
|
Re: Shade btw two arc's |
| Posted by icm63 on Jan-04-2026 04:32 |
|
| thanks |
|