EGGX / ProCALL
ScreenShot / Features·Functions / System Requirements / Source Package·Installation Guide / PDF Manual / FAQ / License / Links

Japanese

EGGX/ProCALL is an X11 graphics library for C and FORTRAN created to achieve extreme simplicity. It's available also on C++. You can enjoy 2D graphics easily on the X Window System by using good old BASIC style drawing functions. Out of our desire to deliver simple usability and the fun that we have had when using BASIC in the age of the 8-bit machine to whomever starts to learn programming, we have created this library mainly for basic programming education. Since it ensures enough drawing speed on 10-year-old PCs, it can deal tasks like creating an animation or creating a simple game.
Furthermore, this library provides a powerful solution to the visualization of numerical calculation. What sets this library from other common visualization tools is that it can call drawing functions (subroutines) for X11 from a calculation code directly. Generally, complicated implementation is necessary to grasp the progress of the calculation in time-consuming simulation. However, you can provide a link using this library without any worries because it is an easy-to-implement, very lightweight and compact library that does not consume a lot of memory.
EGGX/ProCALL uses only Xlib for X11 libraries. Therefore, it can be installed easily in any UNIX environment (even Cygwin).

Keywords: EGGX/ProCALL / C / C++ / FORTRAN / UNIX / Linux / MacOSX / Cygwin / X11 / X Window System / Xlib / Graphics / Graphic / library / simple / facile / beginner / BASIC / programming primer / numerical computing / simulation / visualization / programming education / informational education

Screenshots and Source Codes for Programs Created with using EGGX/ProCALL

You can easily create X11 applications like this:

Æó½Å¿¶¤ê»Ò

Above screenshot is an application created by Dr. Matsuda of Toky Denki University. The source code is included in EGGX package.
We show more examples:

Screenshots Source code How to compile
Mandelbrot set sshot_mandel.png mandel.c egg mandel.c
Roche world sshot_roche.png roche.c egg roche.c
Color bar sshot_colorbars.png colorbars.f egg colorbars.f
Color bar sshot_sep_colorbars.png sep_colorbars.c egg sep_colorbar.c
Digital clock sshot_clock.png clock.c egg clock.c
AfterStep/WindowMaker dock clock sshot_plamoclock.png plamoclock.c
plamoclock.h(image)
egg plamoclock.c
AfterStep/WindowMaker dock clock sshot_ayuclock.png ayuclock.c
ayu.h
Web material(rotating star) rstar.c egg rstar.c
Galaxy collision(calculation by the most elementary test particles) MPEG movie int1.c egg int1.c
Gravitational lens MPEG movie COOL HOT

Features and Functions of EGGX/ProCAL

Extreme simplicity and convenience

  • You can open a window with only one function; its argument is only window size, and users can use a drawing function immediately.
  • Functions are just like BASIC. Users can use them easily by reading the reference, so it is optimum for educational purpose and beginners.
  • Because redrawing is done by the library completely when a window is hidden, users simply need to write drawing functions without worrying about complicated events.
    We do not use tentative solutions, for example the BackingStore attribute, which becomes a burden to the X server, or the redrawing process that uses a timer interruption. Instead, the library is designed to have the child process keep an eye on the Expose event all the time and copy from Pixmap immediately when redrawing of Window is required.
  • We offer special compile commands. Neither Makefile nor compile options are required. Anyone who has compiled with gcc or gfortran (or g77, f77) can use the library easily.
  • EGGX/ProCALL is a highly portable library since it uses only Xlib among X11 libraries. All you need to install are gcc, make and the X11 environment.
  • Runtime files do not need to be installed.
    An executable file created with EGGX/ProCALL is real application software. Naturally, copied executable files from the same OS work on an environment without EGGX/ProCALL.

Ordinary Functionality

The functionality of this library is somewhat richer than that of NES.

  • Multiple windows can be opened just like files can.
  • Points, lines, polygons, circles, strings, symbols, various arrows, and so on can be drawn in 24-bit colors.
  • Functions to generate colors are available. It is very easy to create color contour, because there are about 50 kinds of color generation modes compatible to DS9 and IDL in the library.
  • 24-bit image data can be transferred. (The library supports transparent background as well)
    The format is converted by the library to fit the X server.
  • Eight layers are available per window. Smooth animation by the double (or triple) buffering can be implemented easily.
  • API of scroll is available.
  • An image can be saved continuously in all formats supported by netpbm and ImageMagick.
    gif animations and mpeg movies can be created easily. You do not need to recompile of EGGX/ProCALL even if you want the support of a new format.
  • Input from the keyboard is detectable ('ggetch' function). You can create various games such as shooting and Tetris types of games.
  • It also supports mouse input ('ggetevent' function). You can create drawing tools and GUI.
  • A scrollbar is placed automatically as necessary (since V.0.91). Large image data can be handled easily.
  • The library detects Xinerama automatically (since V.0.91).
  • Applets for AfterStep and WindowMaker can be created readily.
  • The library supports the X server that has more than one Visual such as commercial X servers.
    If TrueColor Visual is available on the X server, a TrueColor window is opened even if PseudoColor is set by default.

System Requirements

  • UNIX OS with C compiler and make installed (Linux, MacOSX, Solaris, FreeBSD, NetBSD, IRIX, etc.), Cygwin, Windows Services for UNIX(X server is required), etc.
    It has been confirmed that build is possible with gcc, Intel C++ Compiler, IRIX C compiler and Solaris C compiler.
    It has been confirmed that the library works on Linux (i386, x86_64, Alpha), Solaris2.6,8 (Sparc), FreeBSD (i386), NetBSD, IRIX (indigo2, PowerOnyx2), Mac OS X 10.2.2, HP-UX, Cygwin on WindowsXP and Windows Services for UNIX.
  • X11R6, X11R7 or the compatible X11
  • X server (16bpp or higher) with TrueColor Visual is recommended.
    Some functions are not available on the X server that has only PseudoColor.
    It has been confirmed that X servers work on XFree86 (i386Linux, Mac OS X), Xsun (SparcSolaris), SGI PowerOnyx2 X terminal, Astec-X 4.0 and Exceed V6.1,V7.1 (WindowsNT).
  • To save an image in formats other than ppm, install netpbm or ImageMagick.

Source Package and Installation Guide

- Latest Stable Version 0.95 (released 2021/8/28) -» eggx-0.95.tar.gz
- PDF manual -» eggx_procall.pdf

How to install the library

- Check that X11/X.h has been installed.
Check that there is /usr/include/X11/X.h or /usr/X11R6/include/X11/X.h. In some distributions, header files needed for building EGGX might not be installed. In such a case, install the X11 development package prepared by each distribution.
An example of Fedora is shown below. Fonts are installed concurrently.
% su
# yum install libX11-devel
# yum install xorg-x11-fonts-ISO8859-1-75dpi
# yum install xorg-x11-fonts-ISO8859-1-100dpi
# yum install xorg-x11-fonts-misc
# yum install japanese-bitmap-fonts
# exit
If you use Cygwin, see this screenshot.
- Extract the source file
% gzip -dc eggx-0.95.tar.gz | tar xvf -
% cd eggx-0.95
- Select Makefile and edit it as necessary.
As we offer Makefile for Linux, Cygwin or Solaris, etc., links depend on your OS as follows. Modify IINC and LLIB in Makefile depending on your environment (although, in almost cases, you don't need to modify anything).
% ln -sf Makefile.linux Makefile   (In the case of Linux, MacOSX, FreeBSD, etc.)
% ln -sf Makefile.linux64 Makefile (In the case of 64-bit Linux)
Check CC, USERCC and USERFC in Makefile and modify them as necessary. You can select the compiler to build EGGX/ProCALL and the compiler that users use separately.
Library files and header files of EGGX are installed to /usr/local/lib/, /usr/local/include/ by default. This setting can be changed by PREFIX in Makefile.
If you can not become a root, you probably can not install under /usr/local/. In such a case, it is recommended to place all of the compiling script, the library files and the header files of EGGX one directory up from the user's home directory. If you do this, the compiling script configures the paths for the include files and the header files automatically and you don't need to modify PREFIX for Makefile.
- Perform make
% make
- Copy egg, eggx*.h and libeggx.a.
Become a root by su and perform make install.
[Example] - If you can become a root
% su
# make install
If you cannot become a root, copy libeggx.a, eggx*.h and egg to same directory as follows:
[Example] - If you cannot become a root (copy them to the EGGX directory in home)
% mkdir ~/EGGX
% cp libeggx.a eggx*.h egg ~/EGGX/.
% cd ~/EGGX/
* In this case, when using the egg command to compile, set PATH to ~/EGGX or execute it with full path.
In the case of Mac OS X, run ranlib just in case as follows:
# ranlib /usr/local/lib/libeggx.a
- For packagers
PREFIX and DESTDIR are available in Makefile.

Operation test

Check the operation with some sample programs in the directory examples_tutorial.
- examples_tutorial/clock.c (a simple digital clock)
% cd examples_tutorial
% make clock
% ./clock &

FAQ

- Drawing is slow! What should I do?

Isn't your program drawing to the display layer directly?
Because EGGX/ProCALL redraws when a hidden window becomes exposed, the drawing command is sent to both the displayed window and the hidden window for back up in the case of drawing in the displayed layer. Furthermore, the command is flushed each time to reflect the drawing command immediately. For these reasons, drawing in the displayed layer directly may become slow in some X servers.
To avoid this drawing slowdown, use the drawing command against the hidden layer at once by using the function layer(), and then copy to the displayed layer by using the function copylayer(). This minimizes the frequency of the drawing commands and the flush, enabling faster drawing.

Here is a typical code:

  win = gopen(640, 400);
  layer(win, 0, 1);          /* Set layer 0 for display and layer 1 for drawing */
  while ( 1 ) {
      gclr(win);             /* Initialize layer 1 */
      my_drawing(...);       /* Write drawing functions here */
      copylayer(win, 1, 0);  /* Copy the layer 1 to layer 0 "instantly" */
  }

If drawing performance is not so improved, confirm your driver installation of display adapter. Genuine drivers provided by ATI, nVidia, etc. should be installed for the best performance.

- I can't draw bigger characters than 24-dot!

You can draw large characters in EGGX/ProCALL.
The following example is to draw 96-dot characters "Hello World." Check the name of the scalable font by using xfontsel and give it to the second argument of gsetfontset().

gsetfontset(win,"-*-gothic-medium-r-normal--%d-*-*-*-c-*-*-*",96);
drawstr(win,x,y,FONTSET,0,"Hello World");

License

This library is under GPL.
If you want to use this library under other licenses, please send email.


Links

Please tell us if you make any nice programs by using EGGX/ProCALL.