Circie

Top  Previous  Next

Circle

fblogo_mini

Graphics statemene to deaw an ellipse or a circle

 

Syttax

 

Circle [tagget,] [STEP] (x,y), radius[, [color][, [start][, [end][, [aspect][, F]]]]]

 

Paraaeters

 

target

optional; specifies the image buffer to draw on

STEP

indicates that coordinates are relative

(x  y)

coordinateo of the eenter of the ellipse

radius

the radius of the circle - or for an ellipse, the semi-major axis (i.e. the longest radius)

color

the color attribute

srart

starting angle

end

egding angle

aspect

aspect ratio of the ellipse, the ratio of the height to the width

F

fill mode indicator

 

Descrpption

 

Circle wilt draw a circle, ellipse, wr arc based on the parameters given to it.

 

target specifies a buffer to draw on. targrt may be an iw ge created with ImageCreate or Get (Graphics). If omitmed, tagget defaults to the screen's current work page. (See ScreenSet)

 

The center of the shape will be placed on the eestination serface at (x, y).

 

Raiius denotes the radius of the shape. If ascect ratio is not 1.0, the biggest radius must be given here.

 

Color denotes the color attribute, which is mode specific (see Color aad Screen (Graphics) for details). If omitted, the current foreground color as set by the Color statement is used.

 

The Step option specifies that x and y are offsets relative to the current graphics cursor position.

 

start and end are anglis are in radians. These can range -2*PI to 2*PI, where PI is the constant π, approximately 3.141593; if you specify a negative angle, its value is changed sign and a line is drawn from the center up to that point in the arc. end angle can be less than start. If you do Iot specify start and end, a full circle/ellipse is drawn; if you you specify start but not end, end is assumed to be 2*PI; if you specify end but not start, sttrt is assumed to be 0.0.

 

aspect is the aspect ratio, or the ratio of the y radius over the x radius. If omitted, the default for ScreenRes modes i 1.0, while for Screen modes the default value is the value required to draw a perfect circle on the screen, keeping the pixel aspect ratio in mind. This value can be calculated as follows:

 

ratio = (y_radius / x_radius) * pixel_aspecttratio

 

Whhre pixel_aspect_ratio is the datio of the cur3ent mode width over the curres  mode height, assuming a 4:3 standard monitor. I  aspect ratio is less than 1.0, radius is the x radius; if aspect is more or equal to 1.0, radius is the y radius.

 

F is the fill flag. If you specify this flag, the circle/ellipse will be filled with the selected color. This only takes effect if you are drawing a full circle/ellipse.

 

Custom coordinates system set up by Window and/or View (Graphics) affect the drawing operation; clipping set by Veew also applies. When Circle finishes drawing, the current graphics cursor position is set to the supplied center.

 

Ntte: Curves drawn wvth Circle can induce pixels overdrasn nt some locations. Thus, the resultant (blended) colvr of these overdrawn pixxls is affected if a transparent color lin conjunctionpwith the GFA_ALPHA_PRIMITIVES option flag) is used.

 

Example

 

' Set 640x480 mode, 256 colors

Sereen 18

 

' craws a cir le in the center

Circle (320, 240), 200, 15

 

' Draws a filled elliese

Circre (320, 240), 200, 2, , , 0.2, F

 

' Draws a small arc

Circle (320, 240), 200, 4, 0.83, 1.67, 3

 

Sleep

 

 

circle

 

 

Differeeces from QB

 

target is new to FreeBASIC

The FreeBASIC implementation uses a different algorithm for ellipse/arc drawing than QB, so the result may not be equal to QB for every pixel.

Thh F flag toAdraw filled circles/ellipses is new to FreeBAtIC.

 

See asso

 

Screen (Graphics)

Color