Skip to content

Commit 976e861

Browse files
authored
Merge branch 'v0.11' into fix-divide-by-zero
2 parents b22c070 + bbd57e6 commit 976e861

File tree

6 files changed

+38
-36
lines changed

6 files changed

+38
-36
lines changed

lib/scenic/color.ex

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ defmodule Scenic.Color do
156156
yellow_green: {0x9A, 0xCD, 0x32}
157157
}
158158

159+
@g :color_g
160+
@ga :color_ga
161+
@rgb :color_rgb
162+
@rgba :color_rgba
163+
@hsv :color_hsv
164+
@hsl :color_hsl
165+
159166
@moduledoc """
160167
APIs to create and work with colors.
161168
@@ -180,15 +187,15 @@ defmodule Scenic.Color do
180187
For HSL and HSV, h is a float between 0 and 360, while the s, v and l values
181188
are floats between 0 and 100.
182189
183-
| Format | Implicit | Explicit |
184-
|---------------|------------------------|-----------|
185-
| Named Color | *na* | See the Named Color Table |
186-
| Grayscale | `g` | `{:g, g}` |
187-
| Gray, Alpha | `{g, a}` | `{:g, {g, a}}` |
188-
| Red, Green, Blue | `{r, g, b}` | `{:rgb, {r, g, b}}` |
189-
| Red, Green, Blue, Alpha | `{r, g, b, a}` | `{:rgba, {r, g, b, a}}` |
190-
| Hue, Saturation, Value | *na* | `{:hsv, {h, s, v}}` |
191-
| Hue, Saturation, Lightness | *na* | `{:hsl, {h, s, l}}` |
190+
| Format | Implicit | Explicit |
191+
|----------------------------|----------------|-----------------------------|
192+
| Named Color | *na* | See the Named Color Table |
193+
| Grayscale | `g` | `{:#{@g}, g}` |
194+
| Gray, Alpha | `{g, a}` | `{:#{@ga}, {g, a}}` |
195+
| Red, Green, Blue | `{r, g, b}` | `{:#{@rgb}, {r, g, b}}` |
196+
| Red, Green, Blue, Alpha | `{r, g, b, a}` | `{:#{@rgba}, {r, g, b, a}}` |
197+
| Hue, Saturation, Value | *na* | `{:#{@hsv}, {h, s, v}}` |
198+
| Hue, Saturation, Lightness | *na* | `{:#{@hsl}, {h, s, l}}` |
192199
193200
194201
## Named Colors
@@ -204,19 +211,18 @@ defmodule Scenic.Color do
204211
205212
## Additional Named Colors
206213
207-
| Name | Value |
208-
|---------------|------------------------|
209-
| `:clear` | `{0x80, 0x80, 0x80, 0x00}` |
214+
| Name | Value |
215+
|---------------|-----------------------------|
216+
| `:clear` | `{0x80, 0x80, 0x80, 0x00}` |
210217
| `:transparent` | `{0x80, 0x80, 0x80, 0x00}` |
211218
212219
## Converting Between Color Formats
213220
214-
By using the functions `to_g`, `to_ga`, `to_rgb`, `to_rgb`, `to_hsl`, and `to_hsv`
215-
you can convert between any implicit or explicit color type to any explicit color type.
221+
By using the functions `to_g/1`, `to_ga/1`, `to_rgb/1`, `to_rgb/1`,
222+
`to_hsl/1`, and `to_hsv/1` you can convert between any implicit or explicit
223+
color type to any explicit color type.
216224
"""
217-
218-
# import IEx
219-
225+
220226
@g :color_g
221227
@ga :color_ga
222228
@rgb :color_rgb

lib/scenic/component.ex

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,8 @@ defmodule Scenic.Component do
210210
# --------------------------------------------------------
211211
defoverridable add_to_graph: 3
212212
end
213-
214-
# quote
215213
end
216214

217-
# defmacro
218-
219215
@filter_out [
220216
:cap,
221217
:fill,
@@ -240,7 +236,6 @@ defmodule Scenic.Component do
240236
# prepare the list of opts to send to a component as it is being started up
241237
# the main task is to remove styles that have already been consumed or don't make
242238
# sense, while leaving any opts/styles that are intended for the component itself.
243-
# also, add the viewport as an option.
244239
@doc false
245240
@spec filter_opts(opts :: Keyword.t()) :: Keyword.t()
246241
def filter_opts(opts) when is_list(opts) do

lib/scenic/graph.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ defmodule Scenic.Graph do
6868
that new primitives added to it are inserted into the new group instead of the
6969
root of the graph.
7070
71-
Finally, when the group is finished, a translation matrix and a `:text_align` style
72-
are added to it. These properties are _inherited_ by the primitives in the group.
71+
Finally, when the group is finished, a translation matrix and a `:text_align`
72+
style (see `Scenic.Primitive.Style.TextAlign`) are added to it. These
73+
properties are _inherited_ by the primitives in the group.
7374
7475
## Inheritance
7576

lib/scenic/primitive/style/text_align.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ defmodule Scenic.Primitive.Style.TextAlign do
1111
1212
```elixir
1313
graph
14-
|> text( "Some Text", text_align: :center_middle )
14+
|> text("Some Text", text_align: :center)
1515
```
1616
1717
### Data Format

lib/scenic/primitives.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,8 +1195,8 @@ defmodule Scenic.Primitives do
11951195
then draw it again without blur, slightly offset, you get a nice drop shadow
11961196
effect. The default is to draw with no blur.
11971197
* `:text_align` - Specify the alignment of the text you are drawing. You will
1198-
usually specify one of: `:left`, `:center`, or `:right`. You can also specify
1199-
vertical alignment. See `Scenic.Primitive.Style.TextAlign` for details.
1198+
usually specify one of: `:left`, `:center`, or `:right`. See
1199+
`Scenic.Primitive.Style.TextAlign` for details.
12001200
* `:text_height` - Specify the vertical spacing between rows of text.
12011201
12021202

lib/scenic/script.ex

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ defmodule Scenic.Script do
1919
2020
Simply put, Scenic.Script produces a list of static drawing commands that are
2121
sent, unmodified, to the drivers through the ViewPort. These scripts are
22-
generated for you when you use push_graph, or you can create them yourself
23-
by using this api.
22+
generated for you when you use `Scenic.Scene.push_graph/3`, or you can create
23+
them yourself by using this api.
2424
2525
If you use Scenic.Script directly, you can create more complicated and/or
2626
reusable graphics than you could by using Graphs alone.
@@ -31,17 +31,17 @@ defmodule Scenic.Script do
3131
that which changes frequently. When a graph is pushed to the ViewPort, the
3232
entire thing is compiled into a script, which is sent as a whole to the Drivers.
3333
34-
If that graph references a script tho, only the reference is sent, not the contents
35-
of the script. This means you can modify the graph frequently without sending
36-
the contents of the scripts.
34+
However if that graph references a script, only the reference to the script is
35+
sent, not the contents of the script. This means you can modify the graph
36+
frequently without sending the contents of the scripts.
3737
3838
The opposite is also true. You can generate and push the scripts frequently
3939
without causing the graphs that reference them to be recompiled or resent.
4040
41-
And example of this might be a graph that implements a chart of some sort.
42-
43-
The contents of the chart could be a script that is updated as new data comes
44-
in without needed all the chrome around it to be recompiled or sent.
41+
An example of this might be a graph that implements a chart of some sort. The
42+
contents of the chart could be a script that is updated as new data comes in
43+
without needing all the chrome around it to be recompiled or sent for every
44+
update.
4545
4646
## API Patterns
4747

0 commit comments

Comments
 (0)