egd(3) - Linux man page

Module

egd - Library egd is an interface for the gd library.

Description

Library egd is an interface for the gd library. Currently only a subset of gd's functions are implemented. The egd module should be considered experimental and behaviour may change in future releases.

Data Types

color():

Color reference. Do not assume anything about the refrence data structure. It may change in future releases.

font() = tiny | small | medium | large | giant:

Font atoms.

image():

Image reference. Do not assume anything about the refrence data structure. It may change in future releases.

point() = {integer(), integer()}:

Point tuple with X and Y coordinates.

Exports

arc(Image::image(), Center::point(), Width::integer(), Height::integer(), Start::integer(), End::integer(), Color::color()) -> ok

Draws an arc with centerpoint in Center, width Width and height Height. Start and End are degrees (not radians) of the arc.

color(Image::image(), RGB) -> Color

Types
RGB = white | black | red | blue | green | {byte(), byte(), byte()}
Color = color() | {error, {invalid_color, RGB}}

Returns a color reference.

color(Image::image(), R::byte(), G::byte(), B::byte()) -> color()

Returns a color reference.

create(Width::integer(), Height::integer()) -> image()

Creates an images with specified dimensions. The color palette is in truecolor.

destroy(Image::image()) -> ok | error

Destroys specified image.

fill(Image::image(), Center::point(), Color::color()) -> ok

Fills an enclosed area with Center as starting point.

filledArc(Image::image(), Center::point(), Width::integer(), Height::integer(), Start::integer(), End::integer(), Color::color(), Options) -> ok

Types
Options = [Option]
Option = arc | chord | no_fill | edged

Draws a filled arc with centerpoint in (Cx, Cy), width Width and height Height. Start and End are degrees (not radians) of the arc.

filledEllipse(Image::image(), Center::point(), Width::integer(), Height::integer(), Color::color()) -> ok

Draws a filled ellipse with color Color and center point at (Cx, Cy) using specified dimensions.

filledPolygon(Image::image(), Points::[point()], Color::color()) -> ok

Draws a filled polygon in the image with color Color. The last point and first points forms the polygon closure.

filledRectangle(Image::image(), Start::point(), End::point(), Color::color()) -> ok

Draws a filled rectangle within the specified coordinates.

fontSize(Image::image(), Font::font()) -> {Width, Height}

Types
Widht = integer()
Height = integer()

Returns the width and height of the font in pixel units.

image(Image::image(), Type) -> binary()

Types
Type = gif | png | jpeg | {jpeg, Quality}
Quality = integer()

Returns a binary containing the image data.

line(Image::image(), Start::point(), End::point(), Color::color()) -> ok

Draws a line from (X1,Y1) to (X2,Y2) in the image with color Color.

pixel(Image::image(), Point::point(), Color::color()) -> ok

Sets a pixel in the image with color Color.

polygon(Image::image(), Points::[points()], Color::color()) -> ok

Draws a polygon in the image with color Color. The last point and first points forms the polygon closure.

rectangle(Image::image(), Start::point(), End::point(), Color::color()) -> ok

Draws a rectangle within the specified coordinates.

resample(Image::image(), Width::integer(), Height::integer()) -> ok

Resizes the image to the new dimensions specified by Width and Height.

rotate(Image::image(), Angle::integer()) -> ok

Rotates the image Angle degrees (not radians).

save(ImageBinary::binary(), Filename::string()) -> {ok, Filename} | {error, Reason}

Saves the binary of the image to a file.

text(Image::image(), Font::font(), Point::point(), String::string(), Color::color()) -> ok

Draws a horizontal text strip using specified font and color.

textUp(Image::image(), Font::font(), Point::point(), String::string(), Color::color()) -> ok

Draws a vertical text strip using specified font and color.