diff options
author | MW | 2008-03-08 20:54:34 +0000 |
---|---|---|
committer | MW | 2008-03-08 20:54:34 +0000 |
commit | d340820826635069813e088f6c17266fbeadd393 (patch) | |
tree | 7d1a3b53a267dbd2e4b1f95d79ba3639639c0558 /OpenSim/Region/Environment/Modules | |
parent | * Implemented 'Revert' channel in Terrain Module. (diff) | |
download | opensim-SC_OLD-d340820826635069813e088f6c17266fbeadd393.zip opensim-SC_OLD-d340820826635069813e088f6c17266fbeadd393.tar.gz opensim-SC_OLD-d340820826635069813e088f6c17266fbeadd393.tar.bz2 opensim-SC_OLD-d340820826635069813e088f6c17266fbeadd393.tar.xz |
Added Frist basic version on the VectorRenderModule, that allows scripts to do some basic drawing onto textures. Currently the method the scripts have to use is most likely not the most user friendly, but this should improve soon. And hope to allow SVG files (either loaded from a web site, or even script created) to be used. I will add a page to the wiki tomorrow, until then http://www.pastebin.ca/934425 is a example c# script that can be used to get a bit of a idea.
Also added osSetDynamicTextureDataBlend and osSetDynamicTextureURLBlend that will allow the various textures to be blended together, but currently there are still a few bugs in them. So not ready for use yet.
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
3 files changed, 403 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs index fe7b763..2988feb 100644 --- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs | |||
@@ -27,12 +27,14 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Drawing; | ||
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using libsecondlife; | 32 | using libsecondlife; |
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Region.Environment.Interfaces; | 35 | using OpenSim.Region.Environment.Interfaces; |
35 | using OpenSim.Region.Environment.Scenes; | 36 | using OpenSim.Region.Environment.Scenes; |
37 | using OpenJPEGNet; | ||
36 | 38 | ||
37 | namespace OpenSim.Region.Environment.Modules | 39 | namespace OpenSim.Region.Environment.Modules |
38 | { | 40 | { |
@@ -93,9 +95,16 @@ namespace OpenSim.Region.Environment.Modules | |||
93 | } | 95 | } |
94 | } | 96 | } |
95 | 97 | ||
98 | |||
96 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, | 99 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, |
97 | string extraParams, int updateTimer) | 100 | string extraParams, int updateTimer) |
98 | { | 101 | { |
102 | return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, updateTimer, false, 255); | ||
103 | } | ||
104 | |||
105 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, | ||
106 | string extraParams, int updateTimer, bool SetBlending, byte AlphaValue) | ||
107 | { | ||
99 | if (RenderPlugins.ContainsKey(contentType)) | 108 | if (RenderPlugins.ContainsKey(contentType)) |
100 | { | 109 | { |
101 | //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); | 110 | //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); |
@@ -108,6 +117,8 @@ namespace OpenSim.Region.Environment.Modules | |||
108 | updater.UpdateTimer = updateTimer; | 117 | updater.UpdateTimer = updateTimer; |
109 | updater.UpdaterID = LLUUID.Random(); | 118 | updater.UpdaterID = LLUUID.Random(); |
110 | updater.Params = extraParams; | 119 | updater.Params = extraParams; |
120 | updater.BlendWithOldTexture = SetBlending; | ||
121 | updater.FrontAlpha = AlphaValue; | ||
111 | 122 | ||
112 | if (!Updaters.ContainsKey(updater.UpdaterID)) | 123 | if (!Updaters.ContainsKey(updater.UpdaterID)) |
113 | { | 124 | { |
@@ -121,7 +132,13 @@ namespace OpenSim.Region.Environment.Modules | |||
121 | } | 132 | } |
122 | 133 | ||
123 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, | 134 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, |
124 | string extraParams, int updateTimer) | 135 | string extraParams, int updateTimer) |
136 | { | ||
137 | return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, false, 255); | ||
138 | } | ||
139 | |||
140 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, | ||
141 | string extraParams, int updateTimer, bool SetBlending, byte AlphaValue) | ||
125 | { | 142 | { |
126 | if (RenderPlugins.ContainsKey(contentType)) | 143 | if (RenderPlugins.ContainsKey(contentType)) |
127 | { | 144 | { |
@@ -133,6 +150,8 @@ namespace OpenSim.Region.Environment.Modules | |||
133 | updater.UpdateTimer = updateTimer; | 150 | updater.UpdateTimer = updateTimer; |
134 | updater.UpdaterID = LLUUID.Random(); | 151 | updater.UpdaterID = LLUUID.Random(); |
135 | updater.Params = extraParams; | 152 | updater.Params = extraParams; |
153 | updater.BlendWithOldTexture = SetBlending; | ||
154 | updater.FrontAlpha = AlphaValue; | ||
136 | 155 | ||
137 | if (!Updaters.ContainsKey(updater.UpdaterID)) | 156 | if (!Updaters.ContainsKey(updater.UpdaterID)) |
138 | { | 157 | { |
@@ -156,6 +175,9 @@ namespace OpenSim.Region.Environment.Modules | |||
156 | public int UpdateTimer; | 175 | public int UpdateTimer; |
157 | public LLUUID LastAssetID; | 176 | public LLUUID LastAssetID; |
158 | public string Params; | 177 | public string Params; |
178 | public bool BlendWithOldTexture = false; | ||
179 | public bool SetNewFrontAlpha = false; | ||
180 | public byte FrontAlpha = 255; | ||
159 | 181 | ||
160 | public DynamicTextureUpdater() | 182 | public DynamicTextureUpdater() |
161 | { | 183 | { |
@@ -166,9 +188,30 @@ namespace OpenSim.Region.Environment.Modules | |||
166 | 188 | ||
167 | public void DataReceived(byte[] data, Scene scene) | 189 | public void DataReceived(byte[] data, Scene scene) |
168 | { | 190 | { |
191 | SceneObjectPart part = scene.GetSceneObjectPart(PrimID); | ||
192 | byte[] assetData; | ||
193 | AssetBase oldAsset = null; | ||
194 | if (BlendWithOldTexture) | ||
195 | { | ||
196 | LLUUID lastTextureID = part.Shape.Textures.DefaultTexture.TextureID; | ||
197 | oldAsset = scene.AssetCache.GetAsset(lastTextureID, true); | ||
198 | if (oldAsset != null) | ||
199 | { | ||
200 | assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha); | ||
201 | } | ||
202 | else | ||
203 | { | ||
204 | assetData = new byte[data.Length]; | ||
205 | Array.Copy(data, assetData, data.Length); | ||
206 | } | ||
207 | } | ||
208 | else | ||
209 | { | ||
210 | assetData = new byte[data.Length]; | ||
211 | Array.Copy(data, assetData, data.Length); | ||
212 | } | ||
213 | |||
169 | //TODO delete the last asset(data), if it was a dynamic texture | 214 | //TODO delete the last asset(data), if it was a dynamic texture |
170 | byte[] assetData = new byte[data.Length]; | ||
171 | Array.Copy(data, assetData, data.Length); | ||
172 | AssetBase asset = new AssetBase(); | 215 | AssetBase asset = new AssetBase(); |
173 | asset.FullID = LLUUID.Random(); | 216 | asset.FullID = LLUUID.Random(); |
174 | asset.Data = assetData; | 217 | asset.Data = assetData; |
@@ -181,10 +224,53 @@ namespace OpenSim.Region.Environment.Modules | |||
181 | 224 | ||
182 | LastAssetID = asset.FullID; | 225 | LastAssetID = asset.FullID; |
183 | 226 | ||
184 | SceneObjectPart part = scene.GetSceneObjectPart(PrimID); | 227 | |
185 | part.Shape.Textures = new LLObject.TextureEntry(asset.FullID); | 228 | part.Shape.Textures = new LLObject.TextureEntry(asset.FullID); |
186 | part.ScheduleFullUpdate(); | 229 | part.ScheduleFullUpdate(); |
187 | } | 230 | } |
231 | |||
232 | private byte[] BlendTextures(byte[] frontImage, byte[] backImage) | ||
233 | { | ||
234 | return BlendTextures(frontImage, backImage, false, 0); | ||
235 | } | ||
236 | |||
237 | private byte[] BlendTextures(byte[] frontImage, byte[] backImage, bool setNewAlpha, byte newAlpha) | ||
238 | { | ||
239 | Bitmap image1 = new Bitmap(OpenJPEG.DecodeToImage(frontImage)); | ||
240 | Bitmap image2 = new Bitmap(OpenJPEG.DecodeToImage(backImage)); | ||
241 | if (setNewAlpha) | ||
242 | { | ||
243 | SetAlpha(ref image1, newAlpha); | ||
244 | } | ||
245 | Bitmap joint = MergeBitMaps(image1, image2); | ||
246 | |||
247 | return OpenJPEG.EncodeFromImage(joint, true); | ||
248 | } | ||
249 | |||
250 | public Bitmap MergeBitMaps(Bitmap front, Bitmap back) | ||
251 | { | ||
252 | Bitmap joint; | ||
253 | Graphics jG; | ||
254 | |||
255 | joint = new Bitmap(back.Width, back.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); | ||
256 | jG = Graphics.FromImage(joint); | ||
257 | |||
258 | jG.DrawImage(back, 0, 0, back.Width, back.Height); | ||
259 | jG.DrawImage(front, 0, 0, back.Width, back.Height); | ||
260 | |||
261 | return joint; | ||
262 | } | ||
263 | |||
264 | private void SetAlpha(ref Bitmap b, byte alpha) | ||
265 | { | ||
266 | for (int w = 0; w < b.Width; w++) | ||
267 | { | ||
268 | for (int h = 0; h < b.Height; h++) | ||
269 | { | ||
270 | b.SetPixel(w, h, Color.FromArgb(alpha, b.GetPixel(w, h))); | ||
271 | } | ||
272 | } | ||
273 | } | ||
188 | } | 274 | } |
189 | } | 275 | } |
190 | } \ No newline at end of file | 276 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs index 0548b9d..1bfc647 100644 --- a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs +++ b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs | |||
@@ -38,6 +38,7 @@ using OpenSim.Region.Environment.Scenes; | |||
38 | 38 | ||
39 | namespace OpenSim.Region.Environment.Modules | 39 | namespace OpenSim.Region.Environment.Modules |
40 | { | 40 | { |
41 | |||
41 | public class LoadImageURLModule : IRegionModule, IDynamicTextureRender | 42 | public class LoadImageURLModule : IRegionModule, IDynamicTextureRender |
42 | { | 43 | { |
43 | private string m_name = "LoadImageURL"; | 44 | private string m_name = "LoadImageURL"; |
@@ -55,7 +56,10 @@ namespace OpenSim.Region.Environment.Modules | |||
55 | public void PostInitialise() | 56 | public void PostInitialise() |
56 | { | 57 | { |
57 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | 58 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); |
58 | m_textureManager.RegisterRender(GetContentType(), this); | 59 | if (m_textureManager != null) |
60 | { | ||
61 | m_textureManager.RegisterRender(GetContentType(), this); | ||
62 | } | ||
59 | } | 63 | } |
60 | 64 | ||
61 | public void Close() | 65 | public void Close() |
diff --git a/OpenSim/Region/Environment/Modules/VectorRenderModule.cs b/OpenSim/Region/Environment/Modules/VectorRenderModule.cs new file mode 100644 index 0000000..d033170 --- /dev/null +++ b/OpenSim/Region/Environment/Modules/VectorRenderModule.cs | |||
@@ -0,0 +1,308 @@ | |||
1 |  | ||
2 | using System; | ||
3 | using System.Drawing; | ||
4 | using System.IO; | ||
5 | using System.Net; | ||
6 | using System.Globalization; | ||
7 | using libsecondlife; | ||
8 | using Nini.Config; | ||
9 | using OpenJPEGNet; | ||
10 | using OpenSim.Framework; | ||
11 | using OpenSim.Region.Environment.Interfaces; | ||
12 | using OpenSim.Region.Environment.Scenes; | ||
13 | //using Cairo; | ||
14 | |||
15 | namespace OpenSim.Region.Environment.Modules | ||
16 | { | ||
17 | public class VectorRenderModule : IRegionModule, IDynamicTextureRender | ||
18 | { | ||
19 | private Scene m_scene; | ||
20 | private string m_name = "VectorRenderModule"; | ||
21 | private IDynamicTextureManager m_textureManager; | ||
22 | |||
23 | public VectorRenderModule() | ||
24 | { | ||
25 | } | ||
26 | |||
27 | public void Initialise(Scene scene, IConfigSource config) | ||
28 | { | ||
29 | if (m_scene == null) | ||
30 | { | ||
31 | m_scene = scene; | ||
32 | } | ||
33 | } | ||
34 | |||
35 | public void PostInitialise() | ||
36 | { | ||
37 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | ||
38 | if (m_textureManager != null) | ||
39 | { | ||
40 | m_textureManager.RegisterRender(GetContentType(), this); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | public void Close() | ||
45 | { | ||
46 | } | ||
47 | |||
48 | public string Name | ||
49 | { | ||
50 | get { return m_name; } | ||
51 | } | ||
52 | |||
53 | public bool IsSharedModule | ||
54 | { | ||
55 | get { return true; } | ||
56 | } | ||
57 | |||
58 | private void Draw(string data, LLUUID id, string extraParams) | ||
59 | { | ||
60 | Bitmap bitmap = new Bitmap(256, 256, System.Drawing.Imaging.PixelFormat.Format32bppArgb); | ||
61 | |||
62 | System.Drawing.Graphics graph = System.Drawing.Graphics.FromImage(bitmap); | ||
63 | |||
64 | extraParams = extraParams.ToLower(); | ||
65 | int alpha = 255; | ||
66 | if (extraParams == "setalpha") | ||
67 | { | ||
68 | alpha = 0; | ||
69 | } | ||
70 | else | ||
71 | { | ||
72 | graph.FillRectangle(new SolidBrush(Color.White), 0, 0, 256, 256); | ||
73 | } | ||
74 | |||
75 | for (int w = 0; w < bitmap.Width; w++) | ||
76 | { | ||
77 | for (int h = 0; h < bitmap.Height; h++) | ||
78 | { | ||
79 | bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h))); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | |||
84 | |||
85 | GDIDraw(data, graph); | ||
86 | |||
87 | byte[] imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true); | ||
88 | m_textureManager.ReturnData(id, imageJ2000); | ||
89 | |||
90 | } | ||
91 | |||
92 | /* private void CairoDraw(string data, System.Drawing.Graphics graph) | ||
93 | { | ||
94 | using (Win32Surface draw = new Win32Surface(graph.GetHdc())) | ||
95 | { | ||
96 | Context contex = new Context(draw); | ||
97 | |||
98 | contex.Antialias = Antialias.None; //fastest method but low quality | ||
99 | contex.LineWidth = 7; | ||
100 | char[] lineDelimiter = { ';' }; | ||
101 | char[] partsDelimiter = { ',' }; | ||
102 | string[] lines = data.Split(lineDelimiter); | ||
103 | |||
104 | foreach (string line in lines) | ||
105 | { | ||
106 | string nextLine = line.Trim(); | ||
107 | |||
108 | if (nextLine.StartsWith("MoveTO")) | ||
109 | { | ||
110 | float x = 0; | ||
111 | float y = 0; | ||
112 | GetParams(partsDelimiter, ref nextLine, ref x, ref y); | ||
113 | contex.MoveTo(x, y); | ||
114 | } | ||
115 | else if (nextLine.StartsWith("LineTo")) | ||
116 | { | ||
117 | float x = 0; | ||
118 | float y = 0; | ||
119 | GetParams(partsDelimiter, ref nextLine, ref x, ref y); | ||
120 | contex.LineTo(x, y); | ||
121 | contex.Stroke(); | ||
122 | } | ||
123 | } | ||
124 | } | ||
125 | graph.ReleaseHdc(); | ||
126 | }*/ | ||
127 | |||
128 | private void GDIDraw(string data, System.Drawing.Graphics graph) | ||
129 | { | ||
130 | System.Drawing.Point startPoint = new System.Drawing.Point(0, 0); | ||
131 | System.Drawing.Point endPoint = new System.Drawing.Point(0, 0); | ||
132 | System.Drawing.Pen drawPen = new Pen(System.Drawing.Color.Black, 7); | ||
133 | Font myFont = new Font("Times New Roman", 14); | ||
134 | SolidBrush myBrush = new SolidBrush(Color.Black); | ||
135 | char[] lineDelimiter = { ';' }; | ||
136 | char[] partsDelimiter = { ',' }; | ||
137 | string[] lines = data.Split(lineDelimiter); | ||
138 | |||
139 | |||
140 | foreach (string line in lines) | ||
141 | { | ||
142 | string nextLine = line.Trim(); | ||
143 | |||
144 | if (nextLine.StartsWith("MoveTo")) | ||
145 | { | ||
146 | float x = 0; | ||
147 | float y = 0; | ||
148 | GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y); | ||
149 | startPoint.X = (int)x; | ||
150 | startPoint.Y = (int)y; | ||
151 | } | ||
152 | else if (nextLine.StartsWith("LineTo")) | ||
153 | { | ||
154 | float x = 0; | ||
155 | float y = 0; | ||
156 | GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y); | ||
157 | endPoint.X = (int)x; | ||
158 | endPoint.Y = (int)y; | ||
159 | graph.DrawLine(drawPen, startPoint, endPoint); | ||
160 | startPoint.X = endPoint.X; | ||
161 | startPoint.Y = endPoint.Y; | ||
162 | } | ||
163 | else if (nextLine.StartsWith("Text")) | ||
164 | { | ||
165 | nextLine = nextLine.Remove(0, 4); | ||
166 | nextLine = nextLine.Trim(); | ||
167 | graph.DrawString(nextLine, myFont, myBrush, startPoint); | ||
168 | } | ||
169 | else if (nextLine.StartsWith("Image")) | ||
170 | { | ||
171 | float x = 0; | ||
172 | float y = 0; | ||
173 | GetParams(partsDelimiter, ref nextLine, 5, ref x, ref y); | ||
174 | endPoint.X = (int)x; | ||
175 | endPoint.Y = (int)y; | ||
176 | System.Drawing.Image image = ImageHttpRequest(nextLine); | ||
177 | graph.DrawImage(image, (float)startPoint.X, (float)startPoint.Y, x, y); | ||
178 | startPoint.X += endPoint.X; | ||
179 | startPoint.Y += endPoint.Y; | ||
180 | } | ||
181 | else if (nextLine.StartsWith("Rectangle")) | ||
182 | { | ||
183 | float x = 0; | ||
184 | float y = 0; | ||
185 | GetParams(partsDelimiter, ref nextLine, 9, ref x, ref y); | ||
186 | endPoint.X = (int)x; | ||
187 | endPoint.Y = (int)y; | ||
188 | graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); | ||
189 | startPoint.X += endPoint.X; | ||
190 | startPoint.Y += endPoint.Y; | ||
191 | } | ||
192 | else if (nextLine.StartsWith("FillRectangle")) | ||
193 | { | ||
194 | float x = 0; | ||
195 | float y = 0; | ||
196 | GetParams(partsDelimiter, ref nextLine, 13, ref x, ref y); | ||
197 | endPoint.X = (int)x; | ||
198 | endPoint.Y = (int)y; | ||
199 | graph.FillRectangle(myBrush, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); | ||
200 | startPoint.X += endPoint.X; | ||
201 | startPoint.Y += endPoint.Y; | ||
202 | } | ||
203 | else if (nextLine.StartsWith("Ellipse")) | ||
204 | { | ||
205 | float x = 0; | ||
206 | float y = 0; | ||
207 | GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y); | ||
208 | endPoint.X = (int)x; | ||
209 | endPoint.Y = (int)y; | ||
210 | graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); | ||
211 | startPoint.X += endPoint.X; | ||
212 | startPoint.Y += endPoint.Y; | ||
213 | } | ||
214 | else if (nextLine.StartsWith("FontSize")) | ||
215 | { | ||
216 | nextLine = nextLine.Remove(0, 8); | ||
217 | nextLine = nextLine.Trim(); | ||
218 | float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); | ||
219 | myFont = new Font("Times New Roman", size); | ||
220 | } | ||
221 | else if (nextLine.StartsWith("PenSize")) | ||
222 | { | ||
223 | nextLine = nextLine.Remove(0, 8); | ||
224 | nextLine = nextLine.Trim(); | ||
225 | float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); | ||
226 | drawPen.Width = size; | ||
227 | } | ||
228 | } | ||
229 | } | ||
230 | |||
231 | private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x, ref float y) | ||
232 | { | ||
233 | line = line.Remove(0, startLength); | ||
234 | string[] parts = line.Split(partsDelimiter); | ||
235 | if (parts.Length == 2) | ||
236 | { | ||
237 | string xVal = parts[0].Trim(); | ||
238 | string yVal = parts[1].Trim(); | ||
239 | x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture); | ||
240 | y = Convert.ToSingle(yVal, CultureInfo.InvariantCulture); | ||
241 | } | ||
242 | else if (parts.Length > 2) | ||
243 | { | ||
244 | string xVal = parts[0].Trim(); | ||
245 | string yVal = parts[1].Trim(); | ||
246 | x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture); | ||
247 | y = Convert.ToSingle(yVal, CultureInfo.InvariantCulture); | ||
248 | |||
249 | line = ""; | ||
250 | for (int i = 2; i < parts.Length; i++) | ||
251 | { | ||
252 | line = line + parts[i].Trim(); | ||
253 | line = line + " "; | ||
254 | } | ||
255 | } | ||
256 | } | ||
257 | |||
258 | private Bitmap ImageHttpRequest(string url) | ||
259 | { | ||
260 | WebRequest request = HttpWebRequest.Create(url); | ||
261 | Stream str = null; | ||
262 | HttpWebResponse response = (HttpWebResponse)(request).GetResponse(); | ||
263 | if (response.StatusCode == HttpStatusCode.OK) | ||
264 | { | ||
265 | Bitmap image = new Bitmap(response.GetResponseStream()); | ||
266 | return image; | ||
267 | } | ||
268 | |||
269 | return null; | ||
270 | } | ||
271 | |||
272 | public string GetContentType() | ||
273 | { | ||
274 | return ("vector"); | ||
275 | } | ||
276 | |||
277 | public string GetName() | ||
278 | { | ||
279 | return m_name; | ||
280 | } | ||
281 | |||
282 | public bool SupportsAsynchronous() | ||
283 | { | ||
284 | return true; | ||
285 | } | ||
286 | |||
287 | public byte[] ConvertUrl(string url, string extraParams) | ||
288 | { | ||
289 | return null; | ||
290 | } | ||
291 | |||
292 | public byte[] ConvertStream(Stream data, string extraParams) | ||
293 | { | ||
294 | return null; | ||
295 | } | ||
296 | |||
297 | public bool AsyncConvertUrl(LLUUID id, string url, string extraParams) | ||
298 | { | ||
299 | return false; | ||
300 | } | ||
301 | |||
302 | public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams) | ||
303 | { | ||
304 | Draw(bodyData, id, extraParams); | ||
305 | return true; | ||
306 | } | ||
307 | } | ||
308 | } \ No newline at end of file | ||