HTP Medium And High Level Combination
Combination Concepts
The medium and high level can work together and create much richer applications that vary between each HTP. The relationship between both levels depends on the flag WidgetWeight in each HTP.
Programming with Mixed Levels
Programming with mixed levels can be very simple. Refer to the following example as reference.
Example
The following example shows an application that tests all combinations of amplitudes and frequencies as illustrated in a graph. The full code can be found in the large set of applications provided with the toolkit (refer to main page). We use an image to represent the height mapping for intensity values, and then we use the medium level to change the weight and the frequency values of an oscillation behavior associated to a particular HTP. In addition, the updating of the medium level behaviors is done through the use of events. In all, this very simple application makes use of most aspects of the API.
- public partial class Oscillations : SurfaceWindow
- {
- HTPManager manager = HTPManager.Instance;
- string filePath = System.IO.Directory.GetCurrentDirectory() + "\\";
- OscillationBehavior oscillation;
- /// <summary>
- /// Default constructor.
- /// </summary>
- public Oscillations()
- {
- InitializeComponent();
- // Add handlers for Application activation events
- AddActivationHandlers();
- // Register Window
- this.manager.RegisterWindow(this, this.grid);
- // Add new HTP Image
- this.manager.RegisterWidget(image);
- // Add two behaviors, one for the oscillations and another one that will limit the height range
- image.AddHeightMapping(behavior, behavior.IntensityMapping);
- HTP h = manager.GetHTP(0xEF);
- h.AddHeightBehavior(this.oscillation);
- }
- void h_HTPDown(object sender, HTPEventArgs e)
- {
- this.oscillation.Frequency = e.CenterPoint.X / 1024;
- e.CurrentHTP.WidgetWeight = e.CenterPoint.Y / 768;
- }