Borland C++ reference

ellipse

raw OCR

Draws an elliptical arc. Inserts literal values directly into code.

Defined in header <dos.h>

Syntax

#ir\clude <graphics.h>
void far ellipse(int x, int y,intstangle,int endangle,int xradius,int yradius);
#include <dos.h>
void _ _emit    (argument,  ...);

  DOS    UNIX   Wi ndows ANSI C  C++ only
    ■              ■

   emit    is an inline function that lets you insert literalvalues directly
into object code as it is compiling. It isused to generate machine  language
instructions without  using inline assembly  language  or an assembler.

Generally  the arguments   of an   emit     call are single-byte machine
instructions. However,  because  of the capabilities of this function, more
complex  instructions, complete  with  references to C variables, can be
constructed.

Vou  should  only use this function if you are familiar with the machine
language  of the 80x86 processor  family. You  can use this function to place
arbitrary bytes in the instruction code of a function; if any of these bytes
are incorrect, the program  misbehaves   and can easily crash your  machine.
Borland  C++  does  not attempt to analyze  your calls for correctness in any
way.  If you encode instructions that change  machine   registers or memory,
Borland  C++  will not be aware  of it and might not properly  preserve
registers, as it would in many  cases with inline assembly  language  (for
example,  it recognizes the usage of SI and DI registers in inline
instructions). You are completely  on your  own  with  this function.
You  must  pass at least one argument  to    emit    ; any number  can be
given. The  arguments   to this function are not treated like any other
function  call arguments in the language.  An  argument  passed  to
   emit     will not be converted in any way.

There  are special restrictions on the form of the arguments  to    emit   .
Arguments    must be in the form  of expressions that can be used  to
initialize a static object.This means that integer and floating-point
constants  and the addresses  of static objects can be used. The values of
such  expressions are written to the object code at the point of the call,
exactly as if they were being used  to initialize data. The address of a
parameter  or auto variable, plus or minus  a constant offset, may  also be
used. For these arguments,   the offset of the variable from BP is stored.

The  number  of bytes placed  in the object code is determined from  the type
of the argument,  except in the following  cases:

 o If a signed integer constant (i.e. 0x90) appears that fitswithin the range
   of 0 to 255, itis treated asifitwere a character.
 D If the address of an auto or parameter variable is used, a byte is written
  if the offset of the variable from BP is between -128 and  127; otherwise,
  a word  is written.

Simple  bytes are written as follows:

   _ _einit_ _{0x90);

If you want  a word  written, but the value you are passing  is under 255,
simply  cast it to unsigned as follows:

      emit   (0xB8, (unsigned)17);

or

      emit   (0xB8, 17u)
Two-  or four-byte address  values can be  forced by casting an address  to
void near  * or void far *, respectively.

None.

Portability

DOSUNIXWindowsANSI CC++ only
■

Remarks

ellipse draws an elliptical arc in the current drawing color with its center at {x,y) and the horizontal and vertical axes given by xradius and yradius, respectively. The ellipse travels from stangle to endangle. If stangle equals 0 and endangle equals 360, the call to ellipse draws a complete ellipse.

The angle for ellipse is reckoned counterclockwise, with 0 degrees at 3 o'clock, 90 degrees at 12 o'clock, and so on.

fe^

The linestyle parameter does not affect arcs, circles, ellipses, or pie slices. Only the thickness parameter is used.

Return value

None.

See also

Example

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
   /* request autodetection */
   int gdriver = DETECT, gmode, errorcode;
   int midx, midy;
   int stangle = 0, endangle = 360;
   int xradius = 100, yradius = 50;
   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "");

   /* read result of initialization */
   errorcode = graphresult ();
   if (errorcode 1= grOk) {  /* an error occurred  */
      printf("Graphics error: %s\n", grapherrormsg (errorcode)
      printf("Press any key to halt:");
   getchO ;
   exit(l);                /* terminate with an error code */

midx = getmaxx () / 2;
midy = getmaxy () / 2;
setcolor (getmaxcolor());

/* draw ellipse */
ellipse (midx, midy, stangle, endangle, xradius, yradius);

/* clean up */
getchO;
closegraph();
return 0;
#include <dos.h>

int main(void)
{
/* emit code that generates a print screen via  int 5 */
   _emit_(0xcd,0x05);   /* INT 05h */
   return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.