1 | ///
|
---|
2 | /// This file is part of ILNumerics Community Edition.
|
---|
3 | ///
|
---|
4 | /// ILNumerics Community Edition - high performance computing for applications.
|
---|
5 | /// Copyright (C) 2006 - 2012 Haymo Kutschbach, http://ilnumerics.net
|
---|
6 | ///
|
---|
7 | /// ILNumerics Community Edition is free software: you can redistribute it and/or modify
|
---|
8 | /// it under the terms of the GNU General Public License version 3 as published by
|
---|
9 | /// the Free Software Foundation.
|
---|
10 | ///
|
---|
11 | /// ILNumerics Community Edition is distributed in the hope that it will be useful,
|
---|
12 | /// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | /// GNU General Public License for more details.
|
---|
15 | ///
|
---|
16 | /// You should have received a copy of the GNU General Public License
|
---|
17 | /// along with ILNumerics Community Edition. See the file License.txt in the root
|
---|
18 | /// of your distribution package. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | ///
|
---|
20 | /// In addition this software uses the following components and/or licenses:
|
---|
21 | ///
|
---|
22 | /// =================================================================================
|
---|
23 | /// The Open Toolkit Library License
|
---|
24 | ///
|
---|
25 | /// Copyright (c) 2006 - 2009 the Open Toolkit library.
|
---|
26 | ///
|
---|
27 | /// Permission is hereby granted, free of charge, to any person obtaining a copy
|
---|
28 | /// of this software and associated documentation files (the "Software"), to deal
|
---|
29 | /// in the Software without restriction, including without limitation the rights to
|
---|
30 | /// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
---|
31 | /// the Software, and to permit persons to whom the Software is furnished to do
|
---|
32 | /// so, subject to the following conditions:
|
---|
33 | ///
|
---|
34 | /// The above copyright notice and this permission notice shall be included in all
|
---|
35 | /// copies or substantial portions of the Software.
|
---|
36 | ///
|
---|
37 | /// =================================================================================
|
---|
38 | ///
|
---|
39 |
|
---|
40 | using System;
|
---|
41 | using System.Collections.Generic;
|
---|
42 | using System.Text;
|
---|
43 | using System.Drawing;
|
---|
44 | using ILNumerics.Drawing;
|
---|
45 | using ILNumerics.Drawing.Labeling;
|
---|
46 |
|
---|
47 | namespace ILNumerics.Drawing.Interfaces {
|
---|
48 | /// <summary>
|
---|
49 | /// interface for all classes capable of renderung (device
|
---|
50 | /// dependend) texts into plot panels
|
---|
51 | /// </summary>
|
---|
52 | /// <remarks>class definitions should also implement the ILRendererAttribute. See <see cref="ILNumerics.Drawing.Platform.OpenGL.ILOGLRenderer"/> for an example.</remarks>
|
---|
53 | /// <seealso cref="ILNumerics.Drawing.Platform.OpenGL.ILOGLRenderer"/>
|
---|
54 | public interface IILTextRenderer {
|
---|
55 | /// <summary>
|
---|
56 | /// The name of the TextRenderer instance (implementation dependent)
|
---|
57 | /// </summary>
|
---|
58 | string Name { get; }
|
---|
59 | /// <summary>
|
---|
60 | /// A more descriptive name to be displayed into GUI's (implementation dependent)
|
---|
61 | /// </summary>
|
---|
62 | string NameLong { get; }
|
---|
63 | /// <summary>
|
---|
64 | /// Get the graphics device type this TextRenderer instance
|
---|
65 | /// is capable to use for drawing
|
---|
66 | /// </summary>
|
---|
67 | GraphicDeviceType DeviceType { get; }
|
---|
68 | /// <summary>
|
---|
69 | /// Determine, if the text is to be drawn after the rendering
|
---|
70 | /// backbuffer has been swapped and presented to the screen. (implementation dependent)
|
---|
71 | /// </summary>
|
---|
72 | bool DrawAfterBufferSwapped { get; }
|
---|
73 | /// <summary>
|
---|
74 | /// Determine, if this renderer chaches the output (implementation dependent)
|
---|
75 | /// </summary>
|
---|
76 | bool Cached { get; }
|
---|
77 | /// <summary>
|
---|
78 | /// Determine the coord system this renderer is specialized to draw in
|
---|
79 | /// </summary>
|
---|
80 | CoordSystem CoordSystem { get; }
|
---|
81 | /// <summary>
|
---|
82 | /// begins drawing, to be called before Draw()!
|
---|
83 | /// </summary>
|
---|
84 | /// <param name="p">extended render properties</param>
|
---|
85 | void Begin (ILRenderProperties p);
|
---|
86 | /// <summary>
|
---|
87 | /// begins drawing and queries current model view matrix also
|
---|
88 | /// </summary>
|
---|
89 | /// <param name="p">extended render properties</param>
|
---|
90 | /// <param name="modelview">current modelviewmatrix</param>
|
---|
91 | void Begin (ILRenderProperties p, ref double[] modelview);
|
---|
92 | /// <summary>
|
---|
93 | /// Draw the text (screen coords)
|
---|
94 | /// </summary>
|
---|
95 | /// <param name="renderQueue">contains items to be drawn</param>
|
---|
96 | /// <param name="position">position relative to surface, starting point for drawing</param>
|
---|
97 | /// <param name="orientation">orientation for item</param>
|
---|
98 | /// <param name="color">initial or default color</param>
|
---|
99 | /// <remarks>
|
---|
100 | /// <para>Before calling Draw(), the TextRenderer must have been initialized with Begin(g)!</para>
|
---|
101 | /// <para>use this function if drawing in screen coords, the size for render
|
---|
102 | /// output will be taken from the Size member of the render queue (pixels).</para>
|
---|
103 | /// </remarks>
|
---|
104 | /// <exception cref="InvalidOperationException">on attempt to draw any text without previous initialization</exception>
|
---|
105 | void Draw (ILRenderQueue renderQueue, System.Drawing.Point position, TextOrientation orientation, Color color);
|
---|
106 | /// <summary>
|
---|
107 | /// Draws the text in world coords
|
---|
108 | /// </summary>
|
---|
109 | /// <param name="renderQueue">contains items to be drawn</param>
|
---|
110 | /// <param name="x1">x1-position</param>
|
---|
111 | /// <param name="y1">y1-position</param>
|
---|
112 | /// <param name="z1">z1-position</param>
|
---|
113 | /// <param name="x2">x2-position</param>
|
---|
114 | /// <param name="y2">y2-position</param>
|
---|
115 | /// <param name="z2">z2-position</param>
|
---|
116 | /// <param name="color">base color for items not containing individual colors</param>
|
---|
117 | /// <remarks>
|
---|
118 | /// <para>Before calling Draw(), the TextRenderer must have been initialized with Begin(g)!</para>
|
---|
119 | /// <para>Use this function to draw the render queue in world coords. The position parameters mark the upper left
|
---|
120 | /// and lower right corner of the quads to contain the render queue content.</para>
|
---|
121 | /// </remarks>
|
---|
122 | /// <exception cref="InvalidOperationException">on attempt to draw any text without previous initialization</exception>
|
---|
123 | void Draw (ILRenderQueue renderQueue, float x1, float y1, float z1, float x2, float y2, float z2, Color color);
|
---|
124 | /// <summary>
|
---|
125 | /// finalizes the drawing (must prepare it again before drawing!)
|
---|
126 | /// </summary>
|
---|
127 | void End(ILRenderProperties p);
|
---|
128 | /// <summary>
|
---|
129 | /// Cache single item into the renderer cache.
|
---|
130 | /// </summary>
|
---|
131 | /// <param name="key">key used to uniquely identify the item in cache</param>
|
---|
132 | /// <param name="bmp">item bitmap data</param>
|
---|
133 | /// <param name="rect">section in bmp to be transfered into the cache</param>
|
---|
134 | void Cache(string key, Bitmap bmp, RectangleF rect);
|
---|
135 | /// <summary>
|
---|
136 | /// test if an item for a specific key is already cached
|
---|
137 | /// </summary>
|
---|
138 | /// <param name="key"></param>
|
---|
139 | /// <returns></returns>
|
---|
140 | bool ExistsKey(string key);
|
---|
141 | /// <summary>
|
---|
142 | /// test if the key exists and return the size of corresponding item on success
|
---|
143 | /// </summary>
|
---|
144 | /// <param name="key">key identifying the item</param>
|
---|
145 | /// <param name="size">if the key was found: the size of the corresponding item</param>
|
---|
146 | /// <returns>true, if the key exist, false otherwise</returns>
|
---|
147 | bool TryGetSize(string key, ref Size size);
|
---|
148 | /// <summary>
|
---|
149 | /// if set to a color (not Color.Empty), that color will be used for all renderings.
|
---|
150 | /// The color contained in the rendering queue is ignored than.
|
---|
151 | /// </summary>
|
---|
152 | Color ColorOverride {
|
---|
153 | get;
|
---|
154 | set;
|
---|
155 | }
|
---|
156 |
|
---|
157 | /// <summary>
|
---|
158 | /// for cached renderers, fires if the internal cache was cleared
|
---|
159 | /// </summary>
|
---|
160 | event EventHandler CacheCleared;
|
---|
161 |
|
---|
162 | }
|
---|
163 | }
|
---|