Version without external function :
Function fill_ellipse_1(xc as Integer, yc as Integer, a as Integer, b as Integer, Color as Integer)
/* e(x,y) = b^2*x^2 + a^2*y^2 - a^2*b^2 */
Local x as Integer
Local y as Integer
Local width as Integer
Local a2 as Integer
Local b2 as Integer
Local crit1 as Integer
Local crit2 as Integer
Local crit3 as Integer
Local t as Integer
Local dxt as Integer
Local dyt as Integer
Local d2xt as Integer
Local d2yt as Integer
x = 0
y = b
width = 1
a2 = a * a
b2 = b * b
crit1 = -(a2/4 + mod(a,2) + b2)
crit2 = -(b2/4 + mod(b,2) + a2)
crit3 = -(b2/4 + mod (b,2))
t = -a2 * y /* e(x+1/2,y-1/2) - (a^2+b^2)/4 */
dxt = 2 * b2 * x
dyt = -2 * a2 * y
d2xt = 2 * b2
d2yt = 2 * a2
While y>=0 and x <= a
If t + b2 * x <= crit1 or t + a2 * y <= crit3 /* e(x+1,y-1/2) <= 0 */ /* e(x+1/2,y) <= 0 */
//Incx()
x = x + 1
dxt = dxt + d2xt
t = t + dxt
width = width + 2
ElseIf t - a2*y > crit2 /* e(x+1/2,y-1) > 0 */
DrawLine (xc-x, yc-y,xc-x + width, yc-y,Color, Color)
If (y <> 0) Then DrawLine(xc-x, yc+y, xc-x+ width, yc+y, Color, Color)
//Incy()
y = y - 1
dyt = dyt + d2yt
t = t + dyt
Else
DrawLine (xc - x, yc - y, xc - x+ width, yc - y, Color, Color)
If (y <> 0) Then DrawLine(xc - x, yc + y, xc - x + width, yc + y, Color, Color)
// IncX
x = x + 1
dxt = dxt + d2xt
t = t + dxt
//Incy()
y = y - 1
dyt = dyt + d2yt
t = t + dyt
width = width + 2
EndIf
EndWhile
If b = 0 Then DrawLine (xc - a, yc, xc - a + 2 * a + 1, yc, Color, Color)
EndFunction