aboutsummaryrefslogtreecommitdiffstats
path: root/lib/percept/src/egd.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/percept/src/egd.erl')
-rw-r--r--lib/percept/src/egd.erl38
1 files changed, 14 insertions, 24 deletions
diff --git a/lib/percept/src/egd.erl b/lib/percept/src/egd.erl
index b5160640af..fe52da71f1 100644
--- a/lib/percept/src/egd.erl
+++ b/lib/percept/src/egd.erl
@@ -70,8 +70,7 @@ create(Width,Height) ->
-spec destroy(Image :: egd_image()) -> ok.
destroy(Image) ->
- cast(Image, destroy),
- ok.
+ cast(Image, destroy).
%% @spec render(egd_image()) -> binary()
@@ -109,8 +108,7 @@ render(Image, Type, Options) ->
%% mainly.
information(Pid) ->
- cast(Pid, information),
- ok.
+ cast(Pid, information).
%% @spec line(egd_image(), point(), point(), color()) -> ok
%% @doc Creates a line object from P1 to P2 in the image.
@@ -122,8 +120,7 @@ information(Pid) ->
Color :: color()) -> 'ok'.
line(Image, P1, P2, Color) ->
- cast(Image, {line, P1, P2, Color}),
- ok.
+ cast(Image, {line, P1, P2, Color}).
%% @spec color( Value | Name ) -> color()
%% where
@@ -148,74 +145,67 @@ color(_Image, Color) ->
%% @doc Creates a text object.
text(Image, P, Font, Text, Color) ->
- cast(Image, {text, P, Font, Text, Color}),
- ok.
+ cast(Image, {text, P, Font, Text, Color}).
%% @spec rectangle(egd_image(), point(), point(), color()) -> ok
%% @doc Creates a rectangle object.
rectangle(Image, P1, P2, Color) ->
- cast(Image, {rectangle, P1, P2, Color}),
- ok.
+ cast(Image, {rectangle, P1, P2, Color}).
%% @spec filledRectangle(egd_image(), point(), point(), color()) -> ok
%% @doc Creates a filled rectangle object.
filledRectangle(Image, P1, P2, Color) ->
- cast(Image, {filled_rectangle, P1, P2, Color}),
- ok.
+ cast(Image, {filled_rectangle, P1, P2, Color}).
%% @spec filledEllipse(egd_image(), point(), point(), color()) -> ok
%% @doc Creates a filled ellipse object.
filledEllipse(Image, P1, P2, Color) ->
- cast(Image, {filled_ellipse, P1, P2, Color}),
- ok.
+ cast(Image, {filled_ellipse, P1, P2, Color}).
%% @spec filledTriangle(egd_image(), point(), point(), point(), color()) -> ok
%% @hidden
%% @doc Creates a filled triangle object.
filledTriangle(Image, P1, P2, P3, Color) ->
- cast(Image, {filled_triangle, P1, P2, P3, Color}),
- ok.
+ cast(Image, {filled_triangle, P1, P2, P3, Color}).
%% @spec polygon(egd_image(), [point()], color()) -> ok
%% @hidden
%% @doc Creates a filled filled polygon object.
polygon(Image, Pts, Color) ->
- cast(Image, {polygon, Pts, Color}),
- ok.
+ cast(Image, {polygon, Pts, Color}).
%% @spec arc(egd_image(), point(), point(), color()) -> ok
%% @hidden
%% @doc Creates an arc with radius of bbx corner.
arc(Image, P1, P2, Color) ->
- cast(Image, {arc, P1, P2, Color}),
- ok.
+ cast(Image, {arc, P1, P2, Color}).
%% @spec arc(egd_image(), point(), point(), integer(), color()) -> ok
%% @hidden
%% @doc Creates an arc.
arc(Image, P1, P2, D, Color) ->
- cast(Image, {arc, P1, P2, D, Color}),
- ok.
+ cast(Image, {arc, P1, P2, D, Color}).
%% @spec save(binary(), string()) -> ok
%% @doc Saves the binary to file.
save(Binary, Filename) when is_binary(Binary) ->
- file:write_file(Filename, Binary),
+ ok = file:write_file(Filename, Binary),
ok.
% ---------------------------------
% Aux functions
% ---------------------------------
cast(Pid, Command) ->
- Pid ! {egd, self(), Command}.
+ Pid ! {egd, self(), Command},
+ ok.
call(Pid, Command) ->
Pid ! {egd, self(), Command},