diff options
author | Robert Adams | 2014-01-19 07:32:41 -0800 |
---|---|---|
committer | Robert Adams | 2014-01-19 07:32:41 -0800 |
commit | 813f0da00b2072e187519a89c33df4ee1665e669 (patch) | |
tree | 7237e3c1825a9b7a381ae0440ff6613167f803f5 /OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | |
parent | Fix casting error for float type INI file parameter parsing. (diff) | |
download | opensim-SC_OLD-813f0da00b2072e187519a89c33df4ee1665e669.zip opensim-SC_OLD-813f0da00b2072e187519a89c33df4ee1665e669.tar.gz opensim-SC_OLD-813f0da00b2072e187519a89c33df4ee1665e669.tar.bz2 opensim-SC_OLD-813f0da00b2072e187519a89c33df4ee1665e669.tar.xz |
Add J2K decoder routine that converts directly to an image.
Diffstat (limited to 'OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index d9b0eff..732781a 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Drawing; | ||
30 | using System.IO; | 31 | using System.IO; |
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using System.Text; | 33 | using System.Text; |
@@ -182,6 +183,25 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
182 | return DoJ2KDecode(assetID, j2kData, out layers, out components); | 183 | return DoJ2KDecode(assetID, j2kData, out layers, out components); |
183 | } | 184 | } |
184 | 185 | ||
186 | public Image DecodeToImage(byte[] j2kData) | ||
187 | { | ||
188 | if (m_useCSJ2K) | ||
189 | return J2kImage.FromBytes(j2kData); | ||
190 | else | ||
191 | { | ||
192 | ManagedImage mimage; | ||
193 | Image image; | ||
194 | if (OpenJPEG.DecodeToImage(j2kData, out mimage, out image)) | ||
195 | { | ||
196 | mimage = null; | ||
197 | return image; | ||
198 | } | ||
199 | else | ||
200 | return null; | ||
201 | } | ||
202 | } | ||
203 | |||
204 | |||
185 | #endregion IJ2KDecoder | 205 | #endregion IJ2KDecoder |
186 | 206 | ||
187 | /// <summary> | 207 | /// <summary> |