Abstract classes ImGearARTCustomDrawingController (WinForms version) / ImGearARTCustomPresentationController (WPF version) define a base interface for any user defined custom mark controller. The user implements a custom mark controller by deriving from one of these base classes. Custom mark controller class resides in the user application.
Custom mark controller draws a custom mark (Draw method) and determines if a given mark is over the mark (HitTest method).
There are two base custom mark controllers defined in ImageGear: the ImGearARTCustomDrawingController and ImGearARTCustomPresentationController, for WinForms-based and WPF-based projects, respectively. They have a similar purpose and API, but slightly differ in parameters, which are specific to rendering engine.
ImageGear ART component provides the ImGearARTDrawingState (WinForms version) / ImGearARTPresentationState (WPF version) helper classes that are used to pass some information significant for mark drawing and hit testing into the user’s code. The user can neither create objects of these classes nor implement classes derived. The only places where valid objects of these classes exist are custom controller’s Draw and custom controller’s HitTest methods.
These objects, generated and passed by ART drawing subsystem, contain:
- Canvas/Graphics in which the mark must be rendered or hit tested.
- IsSelected Boolean property – defines if the mark is selected currently (if yes, user may want to draw some selection marks, border or highlight).
- Some methods to convert points from mark’s coordinate to device and backwards.
Custom Mark Controller Registration
The custom mark controller must be registered in ART with static methods:
ImGearARTCustomPresentationController.RegisterCustomController (for WPF version) or ImGearARTCustomDrawingController.RegisterCustomController (for Winforms version).