-
Notifications
You must be signed in to change notification settings - Fork 185
Adding rendering for elements
This section will detail how the system goes from RenderToSvg() in the toolkit to the actual rendering of the images from MEI.
-
In /src/toolkit.cpp, RenderToSvg() calls upon view_page.cpp to DrawCurrentPage(). The function also sets up all the proper settings and device contexts in order to prepare the rendering of the page.
-
The view_page.cpp class starts at DrawCurrentPage() and will cycle through the following functions in order to go through the entirety of the data structure. (Note this is not complete and only so you can get an idea of how the class works).
-
DrawLayerElement() is found in view_element.cpp which is where the main logic of rendering a majority of the MEI elements actually happens. In the function, the element is checked against element types [See this page on how to add elements], and sent to the respective drawing function.
-
Each draw function has its own logic on how the rendering works. Some use SMuFL svgs, some use other basic drawing functions (found in view_graph.cpp), and many use information from the element itself or the page/system.
Using this system, you can make render any new element you desire. I would suggest looking over many of the pre-existing drawing functions in view_element.cpp to get an idea of the structure that you should be following to create these rendering functions.