KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q44523: Ellipse Not Bounded Correctly

Article: Q44523
Product(s): See article
Version(s): 5.00 5.10
Operating System(s): MS-DOS
Keyword(s): ENDUSER | S_QuickC | mspl13_c
Last Modified: 26-MAY-1989

The _ellipse function does not behave as defined. The Microsoft QuickC
and Optimizing C 5.x run-time library reference manuals state that
"the bounding rectangle [is] defined by the logical points (x1,y1) and
(x2,y2)." However, the bound specified by y2 may be two pixels distant
from the lowest point reached by the ellipse.

This behavior can be demonstrated in any video mode, but not all
possible bounding points will produce this behavior.

This "off by two" behavior is especially troublesome when floodfilling
a region bounded by the ellipse and a line on y2. The floodfill will
bleed out of what should be an enclosed region. The following program
demonstrates this situation:

#include <graph.h>

void main (void)
{
  int x1=0, y1=0, x2=639, y2=349;

  _setvideomode (_ERESCOLOR);

  /* Draw the boundary. */
  _setcolor  (15);
  _rectangle (_GBORDER, x1, y1, x2, y2);
  _ellipse   (_GBORDER, x1, y1, x2, y2);

  /* Define _floodfill attributes. */
  _moveto    (x1+1, y2-1);
  _setcolor  (12);

  /* This should not 'bleed' to the right region. */
  _floodfill (x1+1, y2-1, 15);
}

Microsoft is researching this problem and will post new information as
it becomes available.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.