diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs (renamed from OpenSim/Region/Environment/Modules/VectorRenderModule.cs) | 722 |
1 files changed, 361 insertions, 361 deletions
diff --git a/OpenSim/Region/Environment/Modules/VectorRenderModule.cs b/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs index 0ea6fc3..4fba5b9 100644 --- a/OpenSim/Region/Environment/Modules/VectorRenderModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -1,361 +1,361 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Drawing; | 29 | using System.Drawing; |
30 | using System.Drawing.Imaging; | 30 | using System.Drawing.Imaging; |
31 | using System.Globalization; | 31 | using System.Globalization; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Net; | 33 | using System.Net; |
34 | using libsecondlife; | 34 | using libsecondlife; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using OpenJPEGNet; | 36 | using OpenJPEGNet; |
37 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Environment.Interfaces; |
38 | using OpenSim.Region.Environment.Scenes; | 38 | using OpenSim.Region.Environment.Scenes; |
39 | using Image=System.Drawing.Image; | 39 | using Image=System.Drawing.Image; |
40 | 40 | ||
41 | //using Cairo; | 41 | //using Cairo; |
42 | 42 | ||
43 | namespace OpenSim.Region.Environment.Modules | 43 | namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender |
44 | { | 44 | { |
45 | public class VectorRenderModule : IRegionModule, IDynamicTextureRender | 45 | public class VectorRenderModule : IRegionModule, IDynamicTextureRender |
46 | { | 46 | { |
47 | private Scene m_scene; | 47 | private Scene m_scene; |
48 | private string m_name = "VectorRenderModule"; | 48 | private string m_name = "VectorRenderModule"; |
49 | private IDynamicTextureManager m_textureManager; | 49 | private IDynamicTextureManager m_textureManager; |
50 | 50 | ||
51 | public VectorRenderModule() | 51 | public VectorRenderModule() |
52 | { | 52 | { |
53 | } | 53 | } |
54 | 54 | ||
55 | public void Initialise(Scene scene, IConfigSource config) | 55 | public void Initialise(Scene scene, IConfigSource config) |
56 | { | 56 | { |
57 | if (m_scene == null) | 57 | if (m_scene == null) |
58 | { | 58 | { |
59 | m_scene = scene; | 59 | m_scene = scene; |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | public void PostInitialise() | 63 | public void PostInitialise() |
64 | { | 64 | { |
65 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | 65 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); |
66 | if (m_textureManager != null) | 66 | if (m_textureManager != null) |
67 | { | 67 | { |
68 | m_textureManager.RegisterRender(GetContentType(), this); | 68 | m_textureManager.RegisterRender(GetContentType(), this); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | public void Close() | 72 | public void Close() |
73 | { | 73 | { |
74 | } | 74 | } |
75 | 75 | ||
76 | public string Name | 76 | public string Name |
77 | { | 77 | { |
78 | get { return m_name; } | 78 | get { return m_name; } |
79 | } | 79 | } |
80 | 80 | ||
81 | public bool IsSharedModule | 81 | public bool IsSharedModule |
82 | { | 82 | { |
83 | get { return true; } | 83 | get { return true; } |
84 | } | 84 | } |
85 | 85 | ||
86 | private void Draw(string data, LLUUID id, string extraParams) | 86 | private void Draw(string data, LLUUID id, string extraParams) |
87 | { | 87 | { |
88 | // TODO: this is a brutal hack. extraParams should actually be parsed reasonably. | 88 | // TODO: this is a brutal hack. extraParams should actually be parsed reasonably. |
89 | int size = 256; | 89 | int size = 256; |
90 | try { | 90 | try { |
91 | size = Convert.ToInt32(extraParams); | 91 | size = Convert.ToInt32(extraParams); |
92 | } catch (Exception e) { | 92 | } catch (Exception e) { |
93 | 93 | ||
94 | //Ckrinke: Add a WriteLine to remove the warning about 'e' defined but not used | 94 | //Ckrinke: Add a WriteLine to remove the warning about 'e' defined but not used |
95 | Console.WriteLine("Problem with Draw. Please verify parameters." + e.ToString()); | 95 | Console.WriteLine("Problem with Draw. Please verify parameters." + e.ToString()); |
96 | } | 96 | } |
97 | 97 | ||
98 | if ((size < 128) || (size > 1024)) | 98 | if ((size < 128) || (size > 1024)) |
99 | size = 256; | 99 | size = 256; |
100 | 100 | ||
101 | Bitmap bitmap = new Bitmap(size, size, PixelFormat.Format32bppArgb); | 101 | Bitmap bitmap = new Bitmap(size, size, PixelFormat.Format32bppArgb); |
102 | 102 | ||
103 | Graphics graph = Graphics.FromImage(bitmap); | 103 | Graphics graph = Graphics.FromImage(bitmap); |
104 | 104 | ||
105 | extraParams = extraParams.ToLower(); | 105 | extraParams = extraParams.ToLower(); |
106 | int alpha = 255; | 106 | int alpha = 255; |
107 | if (extraParams == "setalpha") | 107 | if (extraParams == "setalpha") |
108 | { | 108 | { |
109 | alpha = 0; | 109 | alpha = 0; |
110 | } | 110 | } |
111 | else | 111 | else |
112 | { | 112 | { |
113 | graph.FillRectangle(new SolidBrush(Color.White), 0, 0, size, size); | 113 | graph.FillRectangle(new SolidBrush(Color.White), 0, 0, size, size); |
114 | } | 114 | } |
115 | 115 | ||
116 | for (int w = 0; w < bitmap.Width; w++) | 116 | for (int w = 0; w < bitmap.Width; w++) |
117 | { | 117 | { |
118 | for (int h = 0; h < bitmap.Height; h++) | 118 | for (int h = 0; h < bitmap.Height; h++) |
119 | { | 119 | { |
120 | bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h))); | 120 | bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h))); |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | 124 | ||
125 | 125 | ||
126 | GDIDraw(data, graph); | 126 | GDIDraw(data, graph); |
127 | 127 | ||
128 | byte[] imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true); | 128 | byte[] imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true); |
129 | m_textureManager.ReturnData(id, imageJ2000); | 129 | m_textureManager.ReturnData(id, imageJ2000); |
130 | 130 | ||
131 | } | 131 | } |
132 | 132 | ||
133 | /* | 133 | /* |
134 | private void CairoDraw(string data, System.Drawing.Graphics graph) | 134 | private void CairoDraw(string data, System.Drawing.Graphics graph) |
135 | { | 135 | { |
136 | using (Win32Surface draw = new Win32Surface(graph.GetHdc())) | 136 | using (Win32Surface draw = new Win32Surface(graph.GetHdc())) |
137 | { | 137 | { |
138 | Context contex = new Context(draw); | 138 | Context contex = new Context(draw); |
139 | 139 | ||
140 | contex.Antialias = Antialias.None; //fastest method but low quality | 140 | contex.Antialias = Antialias.None; //fastest method but low quality |
141 | contex.LineWidth = 7; | 141 | contex.LineWidth = 7; |
142 | char[] lineDelimiter = { ';' }; | 142 | char[] lineDelimiter = { ';' }; |
143 | char[] partsDelimiter = { ',' }; | 143 | char[] partsDelimiter = { ',' }; |
144 | string[] lines = data.Split(lineDelimiter); | 144 | string[] lines = data.Split(lineDelimiter); |
145 | 145 | ||
146 | foreach (string line in lines) | 146 | foreach (string line in lines) |
147 | { | 147 | { |
148 | string nextLine = line.Trim(); | 148 | string nextLine = line.Trim(); |
149 | 149 | ||
150 | if (nextLine.StartsWith("MoveTO")) | 150 | if (nextLine.StartsWith("MoveTO")) |
151 | { | 151 | { |
152 | float x = 0; | 152 | float x = 0; |
153 | float y = 0; | 153 | float y = 0; |
154 | GetParams(partsDelimiter, ref nextLine, ref x, ref y); | 154 | GetParams(partsDelimiter, ref nextLine, ref x, ref y); |
155 | contex.MoveTo(x, y); | 155 | contex.MoveTo(x, y); |
156 | } | 156 | } |
157 | else if (nextLine.StartsWith("LineTo")) | 157 | else if (nextLine.StartsWith("LineTo")) |
158 | { | 158 | { |
159 | float x = 0; | 159 | float x = 0; |
160 | float y = 0; | 160 | float y = 0; |
161 | GetParams(partsDelimiter, ref nextLine, ref x, ref y); | 161 | GetParams(partsDelimiter, ref nextLine, ref x, ref y); |
162 | contex.LineTo(x, y); | 162 | contex.LineTo(x, y); |
163 | contex.Stroke(); | 163 | contex.Stroke(); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | } | 166 | } |
167 | graph.ReleaseHdc(); | 167 | graph.ReleaseHdc(); |
168 | } | 168 | } |
169 | */ | 169 | */ |
170 | 170 | ||
171 | private void GDIDraw(string data, Graphics graph) | 171 | private void GDIDraw(string data, Graphics graph) |
172 | { | 172 | { |
173 | Point startPoint = new Point(0, 0); | 173 | Point startPoint = new Point(0, 0); |
174 | Point endPoint = new Point(0, 0); | 174 | Point endPoint = new Point(0, 0); |
175 | Pen drawPen = new Pen(Color.Black, 7); | 175 | Pen drawPen = new Pen(Color.Black, 7); |
176 | Font myFont = new Font("Times New Roman", 14); | 176 | Font myFont = new Font("Times New Roman", 14); |
177 | SolidBrush myBrush = new SolidBrush(Color.Black); | 177 | SolidBrush myBrush = new SolidBrush(Color.Black); |
178 | char[] lineDelimiter = { ';' }; | 178 | char[] lineDelimiter = { ';' }; |
179 | char[] partsDelimiter = { ',' }; | 179 | char[] partsDelimiter = { ',' }; |
180 | string[] lines = data.Split(lineDelimiter); | 180 | string[] lines = data.Split(lineDelimiter); |
181 | 181 | ||
182 | foreach (string line in lines) | 182 | foreach (string line in lines) |
183 | { | 183 | { |
184 | string nextLine = line.Trim(); | 184 | string nextLine = line.Trim(); |
185 | //replace with switch, or even better, do some proper parsing | 185 | //replace with switch, or even better, do some proper parsing |
186 | if (nextLine.StartsWith("MoveTo")) | 186 | if (nextLine.StartsWith("MoveTo")) |
187 | { | 187 | { |
188 | float x = 0; | 188 | float x = 0; |
189 | float y = 0; | 189 | float y = 0; |
190 | GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y); | 190 | GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y); |
191 | startPoint.X = (int)x; | 191 | startPoint.X = (int)x; |
192 | startPoint.Y = (int)y; | 192 | startPoint.Y = (int)y; |
193 | } | 193 | } |
194 | else if (nextLine.StartsWith("LineTo")) | 194 | else if (nextLine.StartsWith("LineTo")) |
195 | { | 195 | { |
196 | float x = 0; | 196 | float x = 0; |
197 | float y = 0; | 197 | float y = 0; |
198 | GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y); | 198 | GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y); |
199 | endPoint.X = (int)x; | 199 | endPoint.X = (int)x; |
200 | endPoint.Y = (int)y; | 200 | endPoint.Y = (int)y; |
201 | graph.DrawLine(drawPen, startPoint, endPoint); | 201 | graph.DrawLine(drawPen, startPoint, endPoint); |
202 | startPoint.X = endPoint.X; | 202 | startPoint.X = endPoint.X; |
203 | startPoint.Y = endPoint.Y; | 203 | startPoint.Y = endPoint.Y; |
204 | } | 204 | } |
205 | else if (nextLine.StartsWith("Text")) | 205 | else if (nextLine.StartsWith("Text")) |
206 | { | 206 | { |
207 | nextLine = nextLine.Remove(0, 4); | 207 | nextLine = nextLine.Remove(0, 4); |
208 | nextLine = nextLine.Trim(); | 208 | nextLine = nextLine.Trim(); |
209 | graph.DrawString(nextLine, myFont, myBrush, startPoint); | 209 | graph.DrawString(nextLine, myFont, myBrush, startPoint); |
210 | } | 210 | } |
211 | else if (nextLine.StartsWith("Image")) | 211 | else if (nextLine.StartsWith("Image")) |
212 | { | 212 | { |
213 | float x = 0; | 213 | float x = 0; |
214 | float y = 0; | 214 | float y = 0; |
215 | GetParams(partsDelimiter, ref nextLine, 5, ref x, ref y); | 215 | GetParams(partsDelimiter, ref nextLine, 5, ref x, ref y); |
216 | endPoint.X = (int)x; | 216 | endPoint.X = (int)x; |
217 | endPoint.Y = (int)y; | 217 | endPoint.Y = (int)y; |
218 | Image image = ImageHttpRequest(nextLine); | 218 | Image image = ImageHttpRequest(nextLine); |
219 | graph.DrawImage(image, (float)startPoint.X, (float)startPoint.Y, x, y); | 219 | graph.DrawImage(image, (float)startPoint.X, (float)startPoint.Y, x, y); |
220 | startPoint.X += endPoint.X; | 220 | startPoint.X += endPoint.X; |
221 | startPoint.Y += endPoint.Y; | 221 | startPoint.Y += endPoint.Y; |
222 | } | 222 | } |
223 | else if (nextLine.StartsWith("Rectangle")) | 223 | else if (nextLine.StartsWith("Rectangle")) |
224 | { | 224 | { |
225 | float x = 0; | 225 | float x = 0; |
226 | float y = 0; | 226 | float y = 0; |
227 | GetParams(partsDelimiter, ref nextLine, 9, ref x, ref y); | 227 | GetParams(partsDelimiter, ref nextLine, 9, ref x, ref y); |
228 | endPoint.X = (int)x; | 228 | endPoint.X = (int)x; |
229 | endPoint.Y = (int)y; | 229 | endPoint.Y = (int)y; |
230 | graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); | 230 | graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); |
231 | startPoint.X += endPoint.X; | 231 | startPoint.X += endPoint.X; |
232 | startPoint.Y += endPoint.Y; | 232 | startPoint.Y += endPoint.Y; |
233 | } | 233 | } |
234 | else if (nextLine.StartsWith("FillRectangle")) | 234 | else if (nextLine.StartsWith("FillRectangle")) |
235 | { | 235 | { |
236 | float x = 0; | 236 | float x = 0; |
237 | float y = 0; | 237 | float y = 0; |
238 | GetParams(partsDelimiter, ref nextLine, 13, ref x, ref y); | 238 | GetParams(partsDelimiter, ref nextLine, 13, ref x, ref y); |
239 | endPoint.X = (int)x; | 239 | endPoint.X = (int)x; |
240 | endPoint.Y = (int)y; | 240 | endPoint.Y = (int)y; |
241 | graph.FillRectangle(myBrush, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); | 241 | graph.FillRectangle(myBrush, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); |
242 | startPoint.X += endPoint.X; | 242 | startPoint.X += endPoint.X; |
243 | startPoint.Y += endPoint.Y; | 243 | startPoint.Y += endPoint.Y; |
244 | } | 244 | } |
245 | else if (nextLine.StartsWith("Ellipse")) | 245 | else if (nextLine.StartsWith("Ellipse")) |
246 | { | 246 | { |
247 | float x = 0; | 247 | float x = 0; |
248 | float y = 0; | 248 | float y = 0; |
249 | GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y); | 249 | GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y); |
250 | endPoint.X = (int)x; | 250 | endPoint.X = (int)x; |
251 | endPoint.Y = (int)y; | 251 | endPoint.Y = (int)y; |
252 | graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); | 252 | graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); |
253 | startPoint.X += endPoint.X; | 253 | startPoint.X += endPoint.X; |
254 | startPoint.Y += endPoint.Y; | 254 | startPoint.Y += endPoint.Y; |
255 | } | 255 | } |
256 | else if (nextLine.StartsWith("FontSize")) | 256 | else if (nextLine.StartsWith("FontSize")) |
257 | { | 257 | { |
258 | nextLine = nextLine.Remove(0, 8); | 258 | nextLine = nextLine.Remove(0, 8); |
259 | nextLine = nextLine.Trim(); | 259 | nextLine = nextLine.Trim(); |
260 | float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); | 260 | float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); |
261 | myFont = new Font("Times New Roman", size); | 261 | myFont = new Font("Times New Roman", size); |
262 | } | 262 | } |
263 | else if (nextLine.StartsWith("PenSize")) | 263 | else if (nextLine.StartsWith("PenSize")) |
264 | { | 264 | { |
265 | nextLine = nextLine.Remove(0, 8); | 265 | nextLine = nextLine.Remove(0, 8); |
266 | nextLine = nextLine.Trim(); | 266 | nextLine = nextLine.Trim(); |
267 | float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); | 267 | float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); |
268 | drawPen.Width = size; | 268 | drawPen.Width = size; |
269 | } | 269 | } |
270 | else if (nextLine.StartsWith("PenColour")) | 270 | else if (nextLine.StartsWith("PenColour")) |
271 | { | 271 | { |
272 | nextLine = nextLine.Remove(0, 9); | 272 | nextLine = nextLine.Remove(0, 9); |
273 | nextLine = nextLine.Trim(); | 273 | nextLine = nextLine.Trim(); |
274 | 274 | ||
275 | Color newColour = Color.FromName(nextLine); | 275 | Color newColour = Color.FromName(nextLine); |
276 | 276 | ||
277 | myBrush.Color = newColour; | 277 | myBrush.Color = newColour; |
278 | drawPen.Color = newColour; | 278 | drawPen.Color = newColour; |
279 | } | 279 | } |
280 | } | 280 | } |
281 | } | 281 | } |
282 | 282 | ||
283 | private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x, ref float y) | 283 | private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x, ref float y) |
284 | { | 284 | { |
285 | line = line.Remove(0, startLength); | 285 | line = line.Remove(0, startLength); |
286 | string[] parts = line.Split(partsDelimiter); | 286 | string[] parts = line.Split(partsDelimiter); |
287 | if (parts.Length == 2) | 287 | if (parts.Length == 2) |
288 | { | 288 | { |
289 | string xVal = parts[0].Trim(); | 289 | string xVal = parts[0].Trim(); |
290 | string yVal = parts[1].Trim(); | 290 | string yVal = parts[1].Trim(); |
291 | x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture); | 291 | x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture); |
292 | y = Convert.ToSingle(yVal, CultureInfo.InvariantCulture); | 292 | y = Convert.ToSingle(yVal, CultureInfo.InvariantCulture); |
293 | } | 293 | } |
294 | else if (parts.Length > 2) | 294 | else if (parts.Length > 2) |
295 | { | 295 | { |
296 | string xVal = parts[0].Trim(); | 296 | string xVal = parts[0].Trim(); |
297 | string yVal = parts[1].Trim(); | 297 | string yVal = parts[1].Trim(); |
298 | x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture); | 298 | x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture); |
299 | y = Convert.ToSingle(yVal, CultureInfo.InvariantCulture); | 299 | y = Convert.ToSingle(yVal, CultureInfo.InvariantCulture); |
300 | 300 | ||
301 | line = ""; | 301 | line = ""; |
302 | for (int i = 2; i < parts.Length; i++) | 302 | for (int i = 2; i < parts.Length; i++) |
303 | { | 303 | { |
304 | line = line + parts[i].Trim(); | 304 | line = line + parts[i].Trim(); |
305 | line = line + " "; | 305 | line = line + " "; |
306 | } | 306 | } |
307 | } | 307 | } |
308 | } | 308 | } |
309 | 309 | ||
310 | private Bitmap ImageHttpRequest(string url) | 310 | private Bitmap ImageHttpRequest(string url) |
311 | { | 311 | { |
312 | WebRequest request = HttpWebRequest.Create(url); | 312 | WebRequest request = HttpWebRequest.Create(url); |
313 | //Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. | 313 | //Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. |
314 | //Ckrinke Stream str = null; | 314 | //Ckrinke Stream str = null; |
315 | HttpWebResponse response = (HttpWebResponse)(request).GetResponse(); | 315 | HttpWebResponse response = (HttpWebResponse)(request).GetResponse(); |
316 | if (response.StatusCode == HttpStatusCode.OK) | 316 | if (response.StatusCode == HttpStatusCode.OK) |
317 | { | 317 | { |
318 | Bitmap image = new Bitmap(response.GetResponseStream()); | 318 | Bitmap image = new Bitmap(response.GetResponseStream()); |
319 | return image; | 319 | return image; |
320 | } | 320 | } |
321 | 321 | ||
322 | return null; | 322 | return null; |
323 | } | 323 | } |
324 | 324 | ||
325 | public string GetContentType() | 325 | public string GetContentType() |
326 | { | 326 | { |
327 | return ("vector"); | 327 | return ("vector"); |
328 | } | 328 | } |
329 | 329 | ||
330 | public string GetName() | 330 | public string GetName() |
331 | { | 331 | { |
332 | return m_name; | 332 | return m_name; |
333 | } | 333 | } |
334 | 334 | ||
335 | public bool SupportsAsynchronous() | 335 | public bool SupportsAsynchronous() |
336 | { | 336 | { |
337 | return true; | 337 | return true; |
338 | } | 338 | } |
339 | 339 | ||
340 | public byte[] ConvertUrl(string url, string extraParams) | 340 | public byte[] ConvertUrl(string url, string extraParams) |
341 | { | 341 | { |
342 | return null; | 342 | return null; |
343 | } | 343 | } |
344 | 344 | ||
345 | public byte[] ConvertStream(Stream data, string extraParams) | 345 | public byte[] ConvertStream(Stream data, string extraParams) |
346 | { | 346 | { |
347 | return null; | 347 | return null; |
348 | } | 348 | } |
349 | 349 | ||
350 | public bool AsyncConvertUrl(LLUUID id, string url, string extraParams) | 350 | public bool AsyncConvertUrl(LLUUID id, string url, string extraParams) |
351 | { | 351 | { |
352 | return false; | 352 | return false; |
353 | } | 353 | } |
354 | 354 | ||
355 | public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams) | 355 | public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams) |
356 | { | 356 | { |
357 | Draw(bodyData, id, extraParams); | 357 | Draw(bodyData, id, extraParams); |
358 | return true; | 358 | return true; |
359 | } | 359 | } |
360 | } | 360 | } |
361 | } | 361 | } \ No newline at end of file |