Codebase overview
The entire codebase can be broadly split into two parts: The GUI and the Core.
GUI, PixiEditor
project
Our GUI is built with WPF.
All the visible parts (windows, dialogs, controls, overlays, etc.) are defined in .xaml files located in the Views directory.
The UI logic is defined in code behind files (.xaml.cs) and in view models (referring to ViewModel from the MVVM design pattern).
Some of the logic is separated into other classes, broadly called Models.
Core
PixiEditor's Core consists mainly of two projects: ChangeableDocument
and ChunkyImageLib
.
ChangeableDocument
ChangeableDocument is a project that takes care of storing all data of a single document. It also implements all operations that alter the document in any way, which are called Changes. Some examples are: creating a new layer, drawing something, or resizing the canvas. ChangeableDocument lets you undo and redo any of those operations one after another, implementing the usual undo/redo functions (Ctrl-Z/Ctrl-Y).
ChunkyImageLib
ChunkyImageLib is a library that provides an image class called ChunkyImage. It is used for the contents of the layers, i.e. when you draw something in the app, it gets drawn on a ChunkyImage, which is stored inside the currently selected layer.
This class is designed to render the drawing operations as fast as possible while also allowing you to quickly cancel them, restoring the image to the original state. This functionality is used to preview some operations before fully committing to drawing them. For instance, when you draw a rectangle, you first drag it around to decide where it should be, and the "dragging around" part is done by drawing it in some place, then cancelling, drawing in a different place, etc.