Skip to content

Adding rendering for elements

Andrew Tran edited this page Sep 12, 2017 · 1 revision

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.

  1. 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.

  2. 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).

Class Structure

  1. 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.

  2. 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.

Clone this wiki locally