Spans (see Alph) are used in Fenfire as the basis of text- and image-based media. An important primitive in the Fenfire platform is showing the image contained in a span. However, to do this efficiently and in accordance with the focus+context principle, we need to load and unload levels of detail of images flexibly.
Libvob provides the basic architectural features for this: (XXX link to memorypool design) competing degradable allocations from a pool of memory, and mipzip files and classes that allow easy loading/unloading of mipmap levels.
What is left for Fenfire to provide is the infrastructure to go from spans to vobs and as easily as possible from the vobs to the usage information to be given to the memory pool.
There are several details which will make life difficult:
The interfaces SpanImageFactory and SpanImageVob in the package org.fenfire.spanimages are the
Apart from the option of creating different SpanImageFactory objects with different properties for e.g. page backgrounds, this is all the other classes need to see.
The implementations are in org.fenfire.spanimages.gl (once an AWT implementation is made, it will be in the package org.fenfire.spanimages.fuzzybear).
It is reasonable to expect different treatment of ImageSpan and PageImageSpan objects: for PageImageSpan objects, we will often want libpaper backgrounds and text-enhancing transformations.
The MuxSpanImageFactory object delegates calls to one factory for PageImageSpan objects and to the other for plain ImageSpan objects.
The caching is taken care by another step added to the chain:
The CachingSpanImageFactory will first check its cache and only if it does not find the object cached will it recreate it.
The twin classes PageScrollBlockImager and ImageScrollBlockImager take care of mapping spans to OpenGL textures (mipzips).
An important architectural feature is that the classes are not static: this allows us to, e.g, plug in filters for the images of PageImageSpan.
The class used by the repositories to represent the single images is SingleImage.
The libPaper paper abstraction is useful for rendering sections of the images, with various settings. The input should be the TexGen matrix for the paper texture, and the GL texture object.
We may want to change this interface to include the scale of the characters on the paper at some point to allow better text enhancement.
Now we come to the raison d'etre of this architecture: centralized handling of the feedback from vobscene rendering. The TexAccum class in Libvob is able to accumulate the approximate number of pixels rendered at each mipmap level of each texture. This is collected by the SingleImage .
Because the MemoryPartitioner approach is a bit hard for us to interface with here (the quality - calling time stuff is not optimal for us) we have our own partitioner.
The PoolManager keeps a set of active textures.