Goto main content

gd_arc

Draw an arc.

GD_ARC

NAME

gd_arc - Draw an arc.

SYNOPSIS

gd_arc(gd:variable, start_angle:integer, end_angle:integer, cx:integer, cy:integer, width:integer, height:integer, gdArc:true, gdChord: true, gdNoFill:true, gdEdged: true, filled:true|false, color:"string", thickness:integer, coloridx:integer);

PARAMETERS

gd
Variable must hold a return value from gd_new
cx,cy
Center point of arc.
width, height
Width and height of arc.
color
A color in the format #000000 or #255,255,255
coloridx
A color index get from gd_get_color.
start_angle
Start angle in degree.
end_angle
End angle in degree.
thickness
Thickness of line in pixel. Default is 4.
closed
Close the polygon if not closed. Default is true.
filled
Fill the polygon. Default is false.
gdArc
gdChord just connects the starting and ending angles with a straight line, while gdArc produces a rounded edge.
gdChord
gdChord just connects the starting and ending angles with a straight line, while gdArc produces a rounded edge.
gdNoFill
gdNoFill indicates that the arc or chord should be outlined, not filled
gdEdged
gdEdged, used together with gdNoFill, indicates that the beginning and ending angles should be connected to the center; this is a good way to outline (rather than fill) a pie slice.

MODULES

To use this module, you must specify the following in /usr/local/website/site.conf:

Module gd {
        Library : "/usr/local/lib/libsngd.so"
        Init : "sngd_init"
}

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

res=<{
        %include "/includes/gd.sn";
        remove("/html/images/print.jpg");
        im=gd_new(width:1000,height:1000,bgcolor:Gray,truecolor:true);
        red = gd_get_color(gd:im, color:Red);
        cyan = gd_get_color(gd:im, color:Cyan);
        white = gd_get_color(gd:im, color:White);
        gd_arc(gd:im, cx:500,cy:500, width:100, color:Blue, height:100, start_angle:0, end_angle:180);
        gd_arc(gd:im, cx:700,cy:700, width:100, color:Blue, height:100, start_angle:0, end_angle:180, filled:true, gdChord:true);
        gd_write(gd:im,format:"jpg",filename:"/html/images/print.jpg",quality:100);

SEE ALSO

AUTHOR

Written by Pierre Laplante, <laplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.