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 differences between these two approaches and the BGI drawing library, and the specific reasons for this design. (Note: BGI was Borland's early drawing interface and is widely used in turbo C and Borland C/C?s series 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 since stopped updating BGI, and EasyX is constantly improving, and the difference between the two is growing.

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

Graphics.h applications

graphs.h, based on easyx.h, more simulates the functions of the BGI drawing library. See new functions in graphics.h in reference。

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 a drawing program for the original Turbo C, you need to be aware of the following:

  • Color. The EasyX library supports true color, which is very different from TC.
  • Getimage / putimage, this set of functions is a lot of expansion over BGI.
  • Set a function of linear, fill type, 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.