A Better Rendering Solution?
My current idea for a better renderer is to consolidate all the object
alignment to one generic class. It would:
- Group objects into boxes which would represent the horizontal line idea
used in my previous implementation. A combination of boxes can be used
to form tables, rectangles, etc.
- Align objects to any requested orientation. top / bottom / left / right /
top left / top right / bottom left / bottom right / center / middle ...
either for the current containing box or for the slide itself.
Examples would include an exponent or subscript, a title to a slide at
the top left of the display or the number of slides in the presentation
at the bottom left of the display.
- Detect when objects can no longer fit on a slide, which would trigger
a recursive call to create another slide with the remaining objects.
This would mean the presentation is always dynamic since the height of
the display can be changed by the user at any time, so slides must be
able to expand and shrink to and from one slide to multiple slides.
- Assign object padding depending on the current display dimensions.
For instance, if the display is 1600x1200, raise the padding to a high
value between 32-64 and shrink it when the display is 640x480. Make sure
to keep the calculations proportionate and consistent to keep objects
spaced evenly at all times.
- Allow objects to be attached to other objects. For instance, an
underline at the bottom of text.
- Allow the user to define exact (x, y) coordinates to display an object
and use a proper algorithm to assign the z index of objects. The most
likely step would be to display the last displayed item on top of the
earlier displayed item.
- ... and if I'm feeling really optimistic, instead of grouping objects
into boxes, why not polygons? It would make text alignment in vector
graphics such as circles easier.
The result of this class would be that a user defined display object would
simply have to pass in the
to draw and the alignment flag. The renderer would take care
of the rest.
The Lesson Learned
If I'm not up-to-speed on a technology, I shouldn't use my first prototype as
the final design of a system. Instead I should brainstorm with others because
it opens up the possibility of discovering more clean, simple solutions.