# Graphical state

Content stream is a sequence of operations which alter graphical state. We need to obtain some information after each of these operations and xpdf code is no suitable for this sort of things. If appropriate functions are defined and the object is changed a bit, it could be used to display the content stream. It can be easily extended by adding appropriate operations when

Xpdf code is very difficult to extend here because it is adjusted just for displaying purposes. Again it has almost zero fault tolerance which was improved by adding some constraints into xpdf code.

Functions altering the graphical state were heavily inspired by xpdf code. Most of the code is just copied from xpdf.

## Obtaining information after every operator

Each pdf operator has its function which alters the graphical state appropriately. The mechanism used by stateupdater is simple but very flexible. It gets a simple iterator which it uses to iterate through all operators. After performing a function assigned to the operator a functor with all needed information avaliable is called.

StateUpdater class

StateUpdater class

### Setting operator bounding boxes

Kernel supplies a special functor to the stateupdater, which gets called after every operation with infromation about the rectangle the operator used. The functor sets this rectangle as the bounding box of the operator.