aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Scripting/LoadImageURL')
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs82
1 files changed, 47 insertions, 35 deletions
diff --git a/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs
index eaf9d36..a0408cd 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs
@@ -40,39 +40,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
40 public class LoadImageURLModule : IRegionModule, IDynamicTextureRender 40 public class LoadImageURLModule : IRegionModule, IDynamicTextureRender
41 { 41 {
42 private string m_name = "LoadImageURL"; 42 private string m_name = "LoadImageURL";
43 private IDynamicTextureManager m_textureManager;
44 private Scene m_scene; 43 private Scene m_scene;
44 private IDynamicTextureManager m_textureManager;
45 45
46 public void Initialise(Scene scene, IConfigSource config) 46 #region IDynamicTextureRender Members
47 {
48 if (m_scene == null)
49 {
50 m_scene = scene;
51 }
52 }
53
54 public void PostInitialise()
55 {
56 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
57 if (m_textureManager != null)
58 {
59 m_textureManager.RegisterRender(GetContentType(), this);
60 }
61 }
62
63 public void Close()
64 {
65 }
66
67 public string Name
68 {
69 get { return m_name; }
70 }
71
72 public bool IsSharedModule
73 {
74 get { return true; }
75 }
76 47
77 public string GetName() 48 public string GetName()
78 { 49 {
@@ -110,6 +81,43 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
110 return false; 81 return false;
111 } 82 }
112 83
84 #endregion
85
86 #region IRegionModule Members
87
88 public void Initialise(Scene scene, IConfigSource config)
89 {
90 if (m_scene == null)
91 {
92 m_scene = scene;
93 }
94 }
95
96 public void PostInitialise()
97 {
98 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
99 if (m_textureManager != null)
100 {
101 m_textureManager.RegisterRender(GetContentType(), this);
102 }
103 }
104
105 public void Close()
106 {
107 }
108
109 public string Name
110 {
111 get { return m_name; }
112 }
113
114 public bool IsSharedModule
115 {
116 get { return true; }
117 }
118
119 #endregion
120
113 private void MakeHttpRequest(string url, LLUUID requestID) 121 private void MakeHttpRequest(string url, LLUUID requestID)
114 { 122 {
115 WebRequest request = HttpWebRequest.Create(url); 123 WebRequest request = HttpWebRequest.Create(url);
@@ -138,8 +146,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
138 else if ((image.Height < 128) && (image.Width < 128)) 146 else if ((image.Height < 128) && (image.Width < 128))
139 { 147 {
140 newsize = new Size(64, 64); 148 newsize = new Size(64, 64);
141 } 149 }
142 else if ((image.Height <256) && (image.Width < 256)) 150 else if ((image.Height < 256) && (image.Width < 256))
143 { 151 {
144 newsize = new Size(128, 128); 152 newsize = new Size(128, 128);
145 } 153 }
@@ -153,8 +161,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
153 } 161 }
154 else 162 else
155 { 163 {
156 newsize = new Size(1024,1024); 164 newsize = new Size(1024, 1024);
157 } 165 }
158 166
159 Bitmap resize = new Bitmap(image, newsize); 167 Bitmap resize = new Bitmap(image, newsize);
160 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); 168 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
@@ -163,6 +171,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
163 } 171 }
164 } 172 }
165 173
174 #region Nested type: RequestState
175
166 public class RequestState 176 public class RequestState
167 { 177 {
168 public HttpWebRequest Request = null; 178 public HttpWebRequest Request = null;
@@ -175,5 +185,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
175 RequestID = requestID; 185 RequestID = requestID;
176 } 186 }
177 } 187 }
188
189 #endregion
178 } 190 }
179} \ No newline at end of file 191} \ No newline at end of file