Lomse library. API documentation  0.30.0
Application specific Drawer objects

The Drawer object

As Lomse aims to be platform independent, it does not use any platform specific graphics interface. Instead it uses an abstract interface class, Drawer, and implements a specific derived class, BitmapDrawer, that renders on a bitmap. This solution allows any user application to implement its own drawer classes and do all drawing natively without having to use the BitmapDrawer class implemented by Lomse.

Drawer is an abstract base class for any drawer object, with an interface that mimics SVG commands. The drawer is responsible for transforming drawing commands into something understandable by the underlying rendering engine (e.g.: a bitmap, SVG file, paths, etc.), to display the sheet music.

The Drawer class is equivalent to the drawing interfaces present the operating systems' graphics libraries, for example macOS' “Quartz”, Linux X Window System's “Xlib/XCB” or the Microsoft Windows API “Device Context” (DC) that is part of the “Graphics Device Interface” (GDI).

Using application specific drawers

During Lomse development this possibility was never tested and, currently, any user Drawer object will find some limitations:

  • For displaying visual effects during playback current implementation assumes that a BitmapDrawer is used, and so, any other Drawer object will not be invoked to render the visual effects.
  • HalfPageView view object, oriented to playback, is designed to use bitmaps. Therefore this class will not work with other Drawer objects not using bitmaps without some fixes.

The changes needed to fix current limitations are not many, but it is necessary to have a real test case that helps to drive the refactoring and to understand and generalize the needs, so that we can take decisions about the final Drawer interface and other necessary changes. A simple test case could be to create an SvgDrawer class, because the interface of Drawer class mimics SVG commands and, so it should be trivial to generate an HTML text page with the SVG commands to render the score. But there are more urgent tasks to do for improving the Lomse library, so the task of fixing all issues for fully enable user specific drawers will be delayed, probably until someone with an specific test case would like to help doing the tests and participating in the Drawer API discussions. Please open an issue if you would like to collaborate in this task. Thank you!