Ipelib

The Ipe library documentation

The Ipe library ("Ipelib") provides the geometric primitives and implements all the geometric objects that appear in Ipe. Many tasks related to modifying an Ipe document are actually performed by Ipelib. For instance, the ipetoipe program consists of only a few calls to Ipelib.

Ipelib can easily be used by C++ programs to read, write, and modify Ipe documents. Compiling Ipelib is easy, it requires only the standard C++ library (including the STL), and the zlib compression library. Nearly all symbols in Ipelib are in the ipe namespace, those that aren't start with the letters "Ipe".

Before using Ipelib in your own program, make sure to initialize the library by calling ipe::Platform::initLib().

Many of the Ipelib classes are also made available as Lua objects. Programming in Lua describes the Lua bindings to Ipelib, to ipeui, and to the Ipe program itself. The Ipe program itself is mostly written in Lua and uses these Lua bindings.

On Unix, all filenames passed to Ipelib are assumed to be in the local system's encoding. On Windows, all filenames passed to Ipelib are assumed to be UTF-8. All Lua strings are assumed to be UTF-8 (filenames are converted by the ipelua bindings).

Ipelets explains how to write ipelets, that is, extensions to Ipe. Ipelets are either written in Lua or in C++ (using a small Lua wrapper to describe the ipelet). C++ ipelets have to be linked with Ipelib to access and modify Ipe objects.

The classes documented here are implemented in five different libraries:

- libipe is the core Ipelib library. It implements geometric primitives, Ipe objects, and the Ipe document. However, it doesn't know anything about drawing to the screen or about the Lua bindings.
- libipecairo implements the Ipe cairo module. It provides drawing of Ipe objects using the Cairo library.
- libipelua implements the Lua bindings for Ipelib. If installed properly, it can be loaded dynamically from Lua using `require`. It is also used by ipescript.
- libipecanvas implements the Ipe canvas module. It provides a widget for displaying and editing Ipe objects.
- libipeui implements Lua bindings for user interfaces. This library does not depend on any other Ipe component, and can be used for other Lua projects.

Here is an annotated list of the modules:

- Ipe Base : Some basic datatypes: ipe::String, ipe::Buffer, ipe::Stream, ipe::Fixed
- Ipe Geometry : Geometric types and linear algebra: ipe::Vector, ipe::Matrix, ipe::Line, ipe::Segment, ipe::Arc, ipe::Bezier, ipe::Shape.
- Ipe Attributes : Attributes such as ipe::Color, ipe::Kind, ipe::Attribute
- Ipe Objects : The five ipe::Object types: ipe::Group, ipe::Path, ipe::Text, ipe::Image, and ipe::Reference
- Ipe Document : The Ipe document: ipe::Document, ipe::Page, and ipe::StyleSheet
- Ipe Utilities : Some utility classes: ipe::ImlParser, ipe::BitmapFinder, etc.
- The Ipelet interface : The ipe::Ipelet interface
- Ipe Cairo interface : Classes to draw Ipe objects on a Cairo surface: ipe::CairoPainter, ipe::Fonts, ipe::Face
- Ipe canvas : A widget ipe::Canvas to display Ipe objects, and tools for this canvas: ipe::PanTool, ipe::SelectTool, ipe::TransformTool.

Finally, here is list of the pages describing Lua bindings:

- Lua bindings for geometric objects Lua bindings for basic geometric objects
- Lua bindings for objects and attributes Lua bindings for Ipe objects
- Lua bindings for Document, Page, and StyleSheet Lua bindings for documents, pages, and stylesheets
- Lua bindings for dialogs and menus Lua bindings for dialogs, menus, etc.
- Lua bindings for Ipe Lua bindings for the Ipe program itself.