Compatibility with BGI

There are two ways to use EasyX drawing libraries:

1. Refer to the easyx.h header file. The header file is a declaration of the EasyX drawing function, which can be called directly after reference.

2. Refer to the graphs.h header file. The header file is an extension of easyx.h to simulate additional BGI functions.

This article explains the difference between these two approaches and the BGI drawing library, and the specific reasons for this design. (Note: BGI is Borland's early drawing interface and is widely used in Turbo C and Borland C/C++ family of development tools)

Easyx.h applications

The functions declared in EasyX are very different from those in the Borland BGI drawing library for several reasons:

  • EasyX has simulated almost all BGI drawing functions. However, in the course of the simulation, some of the gaps in the BGI drawing library were found.
  • Many of BGI's data definitions are available in windows.h, except for different names. It's easy to confuse the two sets of names, after all, the BGI drawing library is a thing of the past. The EasyX library maximizes the reuse of the definitions in Windows.
  • There is a lack of regularity in the naming of functions in the BGI drawing library.
  • The BGI drawing library does not have a convenient set of help. Of course, you can see help in Turbo C, but the help file doesn't open directly under Windows, and many beginners don't have the habit of looking through Turbo C Help.
  • Borland has long stopped updating BGI, while EasyX continues to improve, so the differences between the two will grow.

If you have not used the BGI drawing library before, it is recommended to refer to the easyx.h header file.

Graphics.h applications

Graphics.h simulates more functions of BGI drawing library on the basis of easyx.h. See graphics.h added functions in the function description for details.

If you are trying to compile turbo C's drawing program, or refer to an old book, it is recommended to refer to the graphs.h header file. Most of the functions in graphs.h can be found in easyx.h, so you can also use the functions declared in easyx.h after referencing graphs.h.

However, due to the different mechanisms, if you need to port the drawing program of the original Turbo C, there are several things to note:

  • Color. The EasyX library supports true color, which is very different from TC.
  • GetImage/putImage, a group of functions that extend a lot from BGI.
  • Functions that set linear, fill types are slightly different from BGI.
  • Bit operation, BGI's functionality is limited, easyX library implements all bit operation.
  • Constant naming, EasyX Library takes the name close to Windows.
  • Other expansion functions, such as mouse, batch operation, and so on.