CGLIB—a constraint-based graphics library



CGLIB is a high-level graphics library for B-Prolog, a constraint logic programming system. The library provides primitives for creating and manipulating graphical objects and a set of constraints including not-overlap, grid, table and tree constraints that facilitate the specification of the layouts of objects. The library adopts a construct called action rules which is available in B-Prolog for creating agents and programming interactions among agents or between agents and the user. The library is a fully working system implemented in B-Prolog, Java and C. It can be used in many areas such as drawing editors, interactive user interfaces, document authoring, animation, information visualization, intelligent agents and games. The high-level abstraction of the library and the use of constraints and action rules in the specification of layouts and behaviors can significantly enhance the productivity of the development of graphics. We demonstrate through several examples the effectiveness of the library as a tool for developing graphics-rich and interactive user interfaces. Copyright © 2003 John Wiley & Sons, Ltd.