4
4
#
5
5
6
6
defmodule Scenic.Primitive.Arc do
7
- @ moduledoc false
7
+ @ moduledoc """
8
+ Draw an arc on the screen.
9
+
10
+ An arc is a segment that traces part of the outline of a circle. If you are
11
+ looking for something shaped like a piece of pie, then you want a segment.
12
+
13
+ Arcs are often drawn on top of a segment to get an affect where a piece of pie
14
+ is filled in, but only the curvy edge is stroked.
15
+
16
+ Note that you can fill an arc, but that will result in a shape that looks
17
+ like a potato wedge.
18
+
19
+ ## Data
20
+
21
+ `{radius, start, finish}`
22
+
23
+ The data for an arc is a three-tuple.
24
+ * `radius` - the radius of the arc
25
+ * `start` - the starting angle in radians
26
+ * `finish` - end ending angle in radians
27
+
28
+ ## Styles
29
+
30
+ This primitive recognizes the following styles
31
+ * `hidden` - show or hide the primitive
32
+ * `fill` - fill in the area of the primitive
33
+ * `stroke` - stroke the outline of the primitive. In this case, only the curvy part.
34
+ """
8
35
9
36
use Scenic.Primitive
10
37
alias Scenic.Primitive.Sector
@@ -16,6 +43,7 @@ defmodule Scenic.Primitive.Arc do
16
43
# data verification and serialization
17
44
18
45
# --------------------------------------------------------
46
+ @ doc false
19
47
def info ( data ) ,
20
48
do: """
21
49
#{ IO.ANSI . red ( ) } #{ __MODULE__ } data must be: {radius, start, finish}
@@ -24,6 +52,7 @@ defmodule Scenic.Primitive.Arc do
24
52
"""
25
53
26
54
# --------------------------------------------------------
55
+ @ doc false
27
56
def verify ( data ) do
28
57
normalize ( data )
29
58
{ :ok , data }
@@ -32,12 +61,16 @@ defmodule Scenic.Primitive.Arc do
32
61
end
33
62
34
63
# --------------------------------------------------------
64
+ @ doc false
35
65
@ spec normalize ( { number ( ) , number ( ) , number ( ) } ) :: { number ( ) , number ( ) , number ( ) }
36
66
def normalize ( { radius , start , finish } = data )
37
67
when is_number ( start ) and is_number ( finish ) and is_number ( radius ) ,
38
68
do: data
39
69
40
70
# ============================================================================
71
+ @ doc """
72
+ Returns a list of styles recognized by this primitive.
73
+ """
41
74
@ spec valid_styles ( ) :: [ :fill | :hidden | :stroke ]
42
75
def valid_styles ( ) , do: @ styles
43
76
0 commit comments