View Source egd (egd v0.10.1)

egd - erlang graphical drawer

Summary

Functions

Creates a color reference.

Creates an image area and returns its reference.

Destroys the image.

Creates a filled ellipse object.

Creates a filled rectangle object.

Creates a line object from P1 to P2 in the image.

Creates a rectangle object.

Renders a binary from the primitives specified by egd_image(). The binary can either be a raw bitmap with rgb triplets or a binary in png format.

Saves the binary to file.

Creates a text object.

Types

color3/0

-type color3() :: {Red :: byte(), Green :: byte(), Blue :: byte()}.

color4/0

-type color4() :: {Red :: byte(), Green :: byte(), Blue :: byte(), Alpha :: byte()}.

color/0

-type color() :: color3() | color4() | colorName() | {colorName(), Alpha :: byte()}.

colorName/0

-type colorName() :: colorNameSimple() | colorNameExtended().

colorNameExtended/0

-type colorNameExtended() ::
          aliceblue | antiquewhite | aquamarine | azure | beige | bisque | blanchedalmond | blueviolet |
          brown | burlywood | cadetblue | chartreuse | chocolate | coral | cornflowerblue | cornsilk |
          crimson | cyan | darkblue | darkcyan | darkgoldenrod | darkgray | darkgreen | darkkhaki |
          darkmagenta | darkolivegreen | darkorange | darkorchid | darkred | darksalmon | darkseagreen |
          darkslateblue | darkslategray | darkturquoise | darkviolet | deeppink | deepskyblue |
          dimgray | dodgerblue | firebrick | floralwhite | forestgreen | fuchsia | gainsboro |
          ghostwhite | gold | goldenrod | greenyellow | honeydew | hotpink | indianred | indigo |
          ivory | khaki | lavender | lavenderblush | lawngreen | lemonchiffon | lightblue | lightcoral |
          lightcyan | lightgoldenrodyellow | lightgreen | lightgrey | lightpink | lightsalmon |
          lightseagreen | lightskyblue | lightslategray | lightsteelblue | lightyellow | limegreen |
          linen | magenta | mediumaquamarine | mediumblue | mediumorchid | mediumpurple |
          mediumseagreen | mediumslateblue | mediumspringgreen | mediumturquoise | mediumvioletred |
          midnightblue | mintcream | mistyrose | moccasin | navajowhite | oldlace | olivedrab | orange |
          orangered | orchid | palegoldenrod | palegreen | paleturquoise | palevioletred | papayawhip |
          peachpuff | peru | pink | plum | powderblue | rosybrown | royalblue | saddlebrown | salmon |
          sandybrown | seagreen | seashell | sienna | skyblue | slateblue | slategray | snow |
          springgreen | steelblue | tan | thistle | tomato | turquoise | violet | wheat | whitesmoke |
          yellowgreen.

HTML color extensions

colorNameSimple/0

-type colorNameSimple() ::
          aqua | black | blue | fuchia | gray | green | lime | maroon | navy | olive | purple | red |
          silver | teal | white | yellow.

HTML default colors

egd_image/0

-type egd_image() :: pid().

font/0

-type font() :: term().

Internal font representation returned by egd_font:load/1 or egd_font:load_binary/1

image_type/0

-type image_type() :: png | raw_bitmap | eps.

point/0

-type point() :: {X :: non_neg_integer(), Y :: non_neg_integer()}.

render_option/0

-type render_option() :: {render_engine, opaque} | {render_engine, alpha}.

Functions

color(Color)

-spec color(Color :: color()) -> color4().

Creates a color reference.

create(Width, Height)

-spec create(Width :: integer(), Height :: integer()) -> egd_image().

Creates an image area and returns its reference.

destroy(Image)

-spec destroy(Image :: egd_image()) -> ok.

Destroys the image.

filledEllipse(Image, Point1, Point2, Color)

-spec filledEllipse(Image :: egd_image(), Point1 :: point(), Point2 :: point(), Color :: color()) -> ok.

Creates a filled ellipse object.

filledRectangle(Image, Point1, Point2, Color)

-spec filledRectangle(Image :: egd_image(), Point1 :: point(), Point2 :: point(), Color :: color()) ->
                         ok.

Creates a filled rectangle object.

line(Image, Point1, Point2, Color)

-spec line(Image :: egd_image(), Point1 :: point(), Point2 :: point(), Color :: color()) -> ok.

Creates a line object from P1 to P2 in the image.

rectangle(Image, Point1, Point2, Color)

-spec rectangle(Image :: egd_image(), Point1 :: point(), Point2 :: point(), Color :: color()) -> ok.

Creates a rectangle object.

render(Image)

-spec render(Image :: egd_image()) -> binary().

Equivalent to render(Image, png, [{render_engine, opaque}]).

render(Image, Type)

-spec render(Image :: egd_image(), Type :: image_type()) -> binary().

Equivalent to render(Image, Type, [{render_engine, opaque}]).

render(Image, Type, Options)

-spec render(Image :: egd_image(), Type :: image_type(), Options :: [render_option()]) -> binary().

Renders a binary from the primitives specified by egd_image(). The binary can either be a raw bitmap with rgb triplets or a binary in png format.

save(RenderedImage, Filename)

-spec save(RenderedImage :: binary(), Filename :: string()) -> ok.

Saves the binary to file.

text(Image, Point, Font, Text, Color)

-spec text(Image :: egd_image(), Point :: point(), Font :: font(), Text :: string(), Color :: color()) ->
              ok.

Creates a text object.