diff --git a/CSJ2K/CSJ2K.csproj b/CSJ2K/CSJ2K.csproj index a9e396ac..fca71733 100644 --- a/CSJ2K/CSJ2K.csproj +++ b/CSJ2K/CSJ2K.csproj @@ -61,13 +61,13 @@ 1591,1574,0419 AnyCPU - - - + + + \ No newline at end of file diff --git a/CSJ2K/Util/BitmapImageSource.cs b/CSJ2K/Util/BitmapImageSource.cs index 8529c9d9..7495dbc4 100644 --- a/CSJ2K/Util/BitmapImageSource.cs +++ b/CSJ2K/Util/BitmapImageSource.cs @@ -4,10 +4,10 @@ namespace CSJ2K.Util { using System; + + using System.Linq; using System.DrawingCore; using System.DrawingCore.Imaging; - using System.Linq; - using CSJ2K.j2k.image; internal class BitmapImageSource : PortableImageSource diff --git a/LibreMetaverse.GUI/MiniMap.cs b/LibreMetaverse.GUI/MiniMap.cs index 3b3e0e1c..b21f02ee 100644 --- a/LibreMetaverse.GUI/MiniMap.cs +++ b/LibreMetaverse.GUI/MiniMap.cs @@ -91,7 +91,7 @@ namespace OpenMetaverse.GUI { Bitmap bmp = new Bitmap(256, 256); Graphics g = Graphics.FromImage(bmp); - g.Clear(this.BackColor); + g.Clear((System.DrawingCore.Color)(object)this.BackColor); // *HACK: g.FillRectangle(BG_COLOR, 0f, 0f, 256f, 256f); g.DrawImage(bmp, 0, 0); @@ -183,7 +183,7 @@ namespace OpenMetaverse.GUI ); g.DrawImage(bmp, 0, 0); - this.Image = bmp; + this.Image = (System.Drawing.Image)(object)bmp; // *HACK: } } diff --git a/LibreMetaverse.Rendering.Meshmerizer/MeshmerizerR.cs b/LibreMetaverse.Rendering.Meshmerizer/MeshmerizerR.cs index baa3c4fb..8ee3492f 100644 --- a/LibreMetaverse.Rendering.Meshmerizer/MeshmerizerR.cs +++ b/LibreMetaverse.Rendering.Meshmerizer/MeshmerizerR.cs @@ -33,6 +33,7 @@ using System; using System.Collections.Generic; +using System.DrawingCore; using System.IO; using OpenMetaverse.StructuredData; using PrimMesher; @@ -91,7 +92,7 @@ namespace OpenMetaverse.Rendering /// Sculpt texture /// Level of detail to generate the mesh at /// The generated mesh or null on failure - public SimpleMesh GenerateSimpleSculptMesh(Primitive prim, System.DrawingCore.Bitmap sculptTexture, DetailLevel lod) + public SimpleMesh GenerateSimpleSculptMesh(Primitive prim, Bitmap sculptTexture, DetailLevel lod) { var faceted = GenerateFacetedSculptMesh(prim, sculptTexture, lod); @@ -186,7 +187,7 @@ namespace OpenMetaverse.Rendering /// routine since all the context for finding teh texture is elsewhere. /// /// The faceted mesh or null if can't do it - public OMVR.FacetedMesh GenerateFacetedSculptMesh(Primitive prim, System.DrawingCore.Bitmap scupltTexture, DetailLevel lod) + public OMVR.FacetedMesh GenerateFacetedSculptMesh(Primitive prim, Bitmap scupltTexture, DetailLevel lod) { PrimMesher.SculptMesh.SculptType smSculptType; switch (prim.Sculpt.Type) diff --git a/LibreMetaverse.Rendering.Simple/SimpleRenderer.cs b/LibreMetaverse.Rendering.Simple/SimpleRenderer.cs index 23aa3165..a987df66 100644 --- a/LibreMetaverse.Rendering.Simple/SimpleRenderer.cs +++ b/LibreMetaverse.Rendering.Simple/SimpleRenderer.cs @@ -25,6 +25,7 @@ */ using System; +using System.DrawingCore; using System.Collections.Generic; namespace OpenMetaverse.Rendering @@ -47,7 +48,7 @@ namespace OpenMetaverse.Rendering return mesh; } - public SimpleMesh GenerateSimpleSculptMesh(Primitive prim, System.DrawingCore.Bitmap sculptTexture, DetailLevel lod) + public SimpleMesh GenerateSimpleSculptMesh(Primitive prim, Bitmap sculptTexture, DetailLevel lod) { return GenerateSimpleMesh(prim, lod); } @@ -66,7 +67,7 @@ namespace OpenMetaverse.Rendering return mesh; } - public FacetedMesh GenerateFacetedSculptMesh(Primitive prim, System.DrawingCore.Bitmap sculptTexture, DetailLevel lod) + public FacetedMesh GenerateFacetedSculptMesh(Primitive prim, Bitmap sculptTexture, DetailLevel lod) { return GenerateFacetedMesh(prim, lod); } diff --git a/LibreMetaverse.sln b/LibreMetaverse.sln index 39ea5125..04d54ce2 100644 --- a/LibreMetaverse.sln +++ b/LibreMetaverse.sln @@ -8,8 +8,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSJ2K", "CSJ2K\CSJ2K.csproj EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GridProxy", "Programs\GridProxy\GridProxy.csproj", "{79B51DAA-0000-0000-0000-000000000000}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GridProxyApp", "Programs\GridProxy\GridProxyApp.csproj", "{CF6ECF45-0000-0000-0000-000000000000}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IRCGateway", "Programs\examples\IRCGateway\IRCGateway.csproj", "{89049BBC-0000-0000-0000-000000000000}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibreMetaverse", "LibreMetaverse\LibreMetaverse.csproj", "{27C70F3A-0000-0000-0000-000000000000}" @@ -37,8 +35,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestClient", "Programs\exam EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VoiceTest", "Programs\VoiceTest\VoiceTest.csproj", "{EE4EA934-0000-0000-0000-000000000000}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinGridProxy", "Programs\WinGridProxy\WinGridProxy.csproj", "{455B06F4-0000-0000-0000-000000000000}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrimMesher", "PrimMesher\PrimMesher.csproj", "{2E2B643F-F18B-4791-BA4B-6E82D0E794B6}" EndProject Global @@ -59,10 +55,6 @@ Global {79B51DAA-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {79B51DAA-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU {79B51DAA-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {CF6ECF45-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CF6ECF45-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CF6ECF45-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CF6ECF45-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU {89049BBC-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {89049BBC-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {89049BBC-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -111,10 +103,6 @@ Global {EE4EA934-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {EE4EA934-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU {EE4EA934-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {455B06F4-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {455B06F4-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {455B06F4-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {455B06F4-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU {2E2B643F-F18B-4791-BA4B-6E82D0E794B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2E2B643F-F18B-4791-BA4B-6E82D0E794B6}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E2B643F-F18B-4791-BA4B-6E82D0E794B6}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/LibreMetaverse/Imaging/ManagedImage.cs b/LibreMetaverse/Imaging/ManagedImage.cs index 097fa39c..97bf1414 100644 --- a/LibreMetaverse/Imaging/ManagedImage.cs +++ b/LibreMetaverse/Imaging/ManagedImage.cs @@ -26,6 +26,7 @@ using System; using System.DrawingCore; +using System.DrawingCore.Imaging; namespace OpenMetaverse.Imaging { @@ -122,14 +123,14 @@ namespace OpenMetaverse.Imaging /// /// /// - public ManagedImage(System.DrawingCore.Bitmap bitmap) + public ManagedImage(Bitmap bitmap) { Width = bitmap.Width; Height = bitmap.Height; int pixelCount = Width * Height; - if (bitmap.PixelFormat == System.DrawingCore.Imaging.PixelFormat.Format32bppArgb) + if (bitmap.PixelFormat == PixelFormat.Format32bppArgb) { Channels = ImageChannels.Alpha | ImageChannels.Color; Red = new byte[pixelCount]; @@ -137,8 +138,8 @@ namespace OpenMetaverse.Imaging Blue = new byte[pixelCount]; Alpha = new byte[pixelCount]; - System.DrawingCore.Imaging.BitmapData bd = bitmap.LockBits(new System.DrawingCore.Rectangle(0, 0, Width, Height), - System.DrawingCore.Imaging.ImageLockMode.ReadOnly, System.DrawingCore.Imaging.PixelFormat.Format32bppArgb); + BitmapData bd = bitmap.LockBits(new Rectangle(0, 0, Width, Height), + ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); unsafe { @@ -156,22 +157,22 @@ namespace OpenMetaverse.Imaging bitmap.UnlockBits(bd); } - else if (bitmap.PixelFormat == System.DrawingCore.Imaging.PixelFormat.Format16bppGrayScale) + else if (bitmap.PixelFormat == PixelFormat.Format16bppGrayScale) { Channels = ImageChannels.Gray; Red = new byte[pixelCount]; throw new NotImplementedException("16bpp grayscale image support is incomplete"); } - else if (bitmap.PixelFormat == System.DrawingCore.Imaging.PixelFormat.Format24bppRgb) + else if (bitmap.PixelFormat == PixelFormat.Format24bppRgb) { Channels = ImageChannels.Color; Red = new byte[pixelCount]; Green = new byte[pixelCount]; Blue = new byte[pixelCount]; - System.DrawingCore.Imaging.BitmapData bd = bitmap.LockBits(new System.DrawingCore.Rectangle(0, 0, Width, Height), - System.DrawingCore.Imaging.ImageLockMode.ReadOnly, System.DrawingCore.Imaging.PixelFormat.Format24bppRgb); + BitmapData bd = bitmap.LockBits(new Rectangle(0, 0, Width, Height), + ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); unsafe { @@ -188,15 +189,15 @@ namespace OpenMetaverse.Imaging bitmap.UnlockBits(bd); } - else if (bitmap.PixelFormat == System.DrawingCore.Imaging.PixelFormat.Format32bppRgb) + else if (bitmap.PixelFormat == PixelFormat.Format32bppRgb) { Channels = ImageChannels.Color; Red = new byte[pixelCount]; Green = new byte[pixelCount]; Blue = new byte[pixelCount]; - System.DrawingCore.Imaging.BitmapData bd = bitmap.LockBits(new System.DrawingCore.Rectangle(0, 0, Width, Height), - System.DrawingCore.Imaging.ImageLockMode.ReadOnly, System.DrawingCore.Imaging.PixelFormat.Format32bppRgb); + BitmapData bd = bitmap.LockBits(new Rectangle(0, 0, Width, Height), + ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb); unsafe { @@ -383,7 +384,7 @@ namespace OpenMetaverse.Imaging /// origin, suitable for feeding directly into OpenGL /// /// A byte array containing raw texture data - public System.DrawingCore.Bitmap ExportBitmap() + public Bitmap ExportBitmap() { byte[] raw = new byte[Width * Height * 4]; @@ -424,14 +425,14 @@ namespace OpenMetaverse.Imaging } } - System.DrawingCore.Bitmap b = new System.DrawingCore.Bitmap( + Bitmap b = new Bitmap( Width, Height, - System.DrawingCore.Imaging.PixelFormat.Format32bppArgb); + PixelFormat.Format32bppArgb); - System.DrawingCore.Imaging.BitmapData bd = b.LockBits(new System.DrawingCore.Rectangle(0, 0, b.Width, b.Height), - System.DrawingCore.Imaging.ImageLockMode.WriteOnly, - System.DrawingCore.Imaging.PixelFormat.Format32bppArgb); + BitmapData bd = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), + ImageLockMode.WriteOnly, + PixelFormat.Format32bppArgb); System.Runtime.InteropServices.Marshal.Copy(raw, 0, bd.Scan0, Width * Height * 4); diff --git a/LibreMetaverse/Imaging/OpenJPEG.cs b/LibreMetaverse/Imaging/OpenJPEG.cs index dee8d6ca..aa3d9514 100644 --- a/LibreMetaverse/Imaging/OpenJPEG.cs +++ b/LibreMetaverse/Imaging/OpenJPEG.cs @@ -25,10 +25,10 @@ */ using System; -using System.IO; using System.DrawingCore; using System.DrawingCore.Imaging; using System.Runtime.InteropServices; +using Rectangle = System.DrawingCore.Rectangle; namespace OpenMetaverse.Imaging { diff --git a/LibreMetaverse/Imaging/TGALoader.cs b/LibreMetaverse/Imaging/TGALoader.cs index 09594c5c..553549c1 100644 --- a/LibreMetaverse/Imaging/TGALoader.cs +++ b/LibreMetaverse/Imaging/TGALoader.cs @@ -25,6 +25,8 @@ */ using System; +using System.DrawingCore; +using System.DrawingCore.Imaging; namespace OpenMetaverse.Imaging { @@ -153,7 +155,7 @@ namespace OpenMetaverse.Imaging } static unsafe void decodeLine( - System.DrawingCore.Imaging.BitmapData b, + BitmapData b, int line, int byp, byte[] data, @@ -197,7 +199,7 @@ namespace OpenMetaverse.Imaging } static void decodeRle( - System.DrawingCore.Imaging.BitmapData b, + BitmapData b, int byp, tgaCD cd, System.IO.BinaryReader br, bool bottomUp) { try @@ -262,7 +264,7 @@ namespace OpenMetaverse.Imaging } static void decodePlain( - System.DrawingCore.Imaging.BitmapData b, + BitmapData b, int byp, tgaCD cd, System.IO.BinaryReader br, bool bottomUp) { int w = b.Width; @@ -280,7 +282,7 @@ namespace OpenMetaverse.Imaging } static void decodeStandard8( - System.DrawingCore.Imaging.BitmapData b, + BitmapData b, tgaHeader hdr, System.IO.BinaryReader br) { @@ -301,7 +303,7 @@ namespace OpenMetaverse.Imaging } static void decodeSpecial16( - System.DrawingCore.Imaging.BitmapData b, tgaHeader hdr, System.IO.BinaryReader br) + BitmapData b, tgaHeader hdr, System.IO.BinaryReader br) { // i must convert the input stream to a sequence of uint values // which I then unpack. @@ -323,7 +325,7 @@ namespace OpenMetaverse.Imaging } static void decodeStandard16( - System.DrawingCore.Imaging.BitmapData b, + BitmapData b, tgaHeader hdr, System.IO.BinaryReader br) { @@ -347,7 +349,7 @@ namespace OpenMetaverse.Imaging } - static void decodeSpecial24(System.DrawingCore.Imaging.BitmapData b, + static void decodeSpecial24(BitmapData b, tgaHeader hdr, System.IO.BinaryReader br) { // i must convert the input stream to a sequence of uint values @@ -369,7 +371,7 @@ namespace OpenMetaverse.Imaging decodePlain(b, 3, cd, br, hdr.ImageSpec.BottomUp); } - static void decodeStandard24(System.DrawingCore.Imaging.BitmapData b, + static void decodeStandard24(BitmapData b, tgaHeader hdr, System.IO.BinaryReader br) { // i must convert the input stream to a sequence of uint values @@ -391,7 +393,7 @@ namespace OpenMetaverse.Imaging decodePlain(b, 3, cd, br, hdr.ImageSpec.BottomUp); } - static void decodeStandard32(System.DrawingCore.Imaging.BitmapData b, + static void decodeStandard32(BitmapData b, tgaHeader hdr, System.IO.BinaryReader br) { // i must convert the input stream to a sequence of uint values @@ -415,7 +417,7 @@ namespace OpenMetaverse.Imaging } - public static System.DrawingCore.Size GetTGASize(string filename) + public static System.Drawing.Size GetTGASize(string filename) { System.IO.FileStream f = System.IO.File.OpenRead(filename); @@ -425,11 +427,11 @@ namespace OpenMetaverse.Imaging header.Read(br); br.Close(); - return new System.DrawingCore.Size(header.ImageSpec.Width, header.ImageSpec.Height); + return new System.Drawing.Size(header.ImageSpec.Width, header.ImageSpec.Height); } - public static System.DrawingCore.Bitmap LoadTGA(System.IO.Stream source) + public static Bitmap LoadTGA(System.IO.Stream source) { byte[] buffer = new byte[source.Length]; source.Read(buffer, 0, buffer.Length); @@ -454,8 +456,8 @@ namespace OpenMetaverse.Imaging header.ImageSpec.Height > 4096) throw new ArgumentException("Image too large."); - System.DrawingCore.Bitmap b; - System.DrawingCore.Imaging.BitmapData bd; + Bitmap b; + BitmapData bd; // Create a bitmap for the image. // Only include an alpha layer when the image requires one. @@ -463,25 +465,25 @@ namespace OpenMetaverse.Imaging header.ImageSpec.PixelDepth == 8 || // Assume 8 bit images are alpha only header.ImageSpec.PixelDepth == 32) // Assume 32 bit images are ARGB { // Image needs an alpha layer - b = new System.DrawingCore.Bitmap( + b = new Bitmap( header.ImageSpec.Width, header.ImageSpec.Height, - System.DrawingCore.Imaging.PixelFormat.Format32bppArgb); + PixelFormat.Format32bppArgb); - bd = b.LockBits(new System.DrawingCore.Rectangle(0, 0, b.Width, b.Height), - System.DrawingCore.Imaging.ImageLockMode.WriteOnly, - System.DrawingCore.Imaging.PixelFormat.Format32bppPArgb); + bd = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), + ImageLockMode.WriteOnly, + PixelFormat.Format32bppPArgb); } else { // Image does not need an alpha layer, so do not include one. - b = new System.DrawingCore.Bitmap( + b = new Bitmap( header.ImageSpec.Width, header.ImageSpec.Height, - System.DrawingCore.Imaging.PixelFormat.Format32bppRgb); + PixelFormat.Format32bppRgb); - bd = b.LockBits(new System.DrawingCore.Rectangle(0, 0, b.Width, b.Height), - System.DrawingCore.Imaging.ImageLockMode.WriteOnly, - System.DrawingCore.Imaging.PixelFormat.Format32bppRgb); + bd = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), + ImageLockMode.WriteOnly, + PixelFormat.Format32bppRgb); } switch (header.ImageSpec.PixelDepth) @@ -546,13 +548,13 @@ namespace OpenMetaverse.Imaging throw new ArgumentException("Image too large."); byte[] decoded = new byte[header.ImageSpec.Width * header.ImageSpec.Height * 4]; - System.DrawingCore.Imaging.BitmapData bd = new System.DrawingCore.Imaging.BitmapData(); + BitmapData bd = new BitmapData(); fixed (byte* pdecoded = &decoded[0]) { bd.Width = header.ImageSpec.Width; bd.Height = header.ImageSpec.Height; - bd.PixelFormat = System.DrawingCore.Imaging.PixelFormat.Format32bppPArgb; + bd.PixelFormat = PixelFormat.Format32bppPArgb; bd.Stride = header.ImageSpec.Width * 4; bd.Scan0 = (IntPtr)pdecoded; @@ -616,7 +618,7 @@ namespace OpenMetaverse.Imaging } } - public static System.DrawingCore.Bitmap LoadTGA(string filename) + public static Bitmap LoadTGA(string filename) { try { diff --git a/LibreMetaverse/ImportExport/ColladalLoader.cs b/LibreMetaverse/ImportExport/ColladalLoader.cs index 108c6c09..69ea6eff 100644 --- a/LibreMetaverse/ImportExport/ColladalLoader.cs +++ b/LibreMetaverse/ImportExport/ColladalLoader.cs @@ -31,6 +31,7 @@ using System.Text.RegularExpressions; using System.IO; using System.Xml; using System.DrawingCore; +using System.DrawingCore.Drawing2D; using System.Linq; using System.Xml.Serialization; using OpenMetaverse.ImportExport.Collada14; @@ -154,9 +155,9 @@ namespace OpenMetaverse.ImportExport Bitmap resized = new Bitmap(width, height, bitmap.PixelFormat); Graphics graphics = Graphics.FromImage(resized); - graphics.SmoothingMode = System.DrawingCore.Drawing2D.SmoothingMode.HighQuality; + graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.InterpolationMode = - System.DrawingCore.Drawing2D.InterpolationMode.HighQualityBicubic; + InterpolationMode.HighQualityBicubic; graphics.DrawImage(bitmap, 0, 0, width, height); bitmap.Dispose(); diff --git a/LibreMetaverse/Primitives/TextureEntry.cs b/LibreMetaverse/Primitives/TextureEntry.cs index 0f7b5b90..b7267ff8 100644 --- a/LibreMetaverse/Primitives/TextureEntry.cs +++ b/LibreMetaverse/Primitives/TextureEntry.cs @@ -25,7 +25,6 @@ */ using System; -using System.Collections.Generic; using System.IO; using OpenMetaverse.StructuredData; diff --git a/PrimMesher/PrimMesher.csproj b/PrimMesher/PrimMesher.csproj index 5ffc6480..59250bcf 100644 --- a/PrimMesher/PrimMesher.csproj +++ b/PrimMesher/PrimMesher.csproj @@ -9,11 +9,6 @@ PrimMesher PrimMesher netstandard2.0 - 512 - - - - Dhalia Trimble false diff --git a/PrimMesher/SculptMap.cs b/PrimMesher/SculptMap.cs index 38b3da93..cd3b7e14 100644 --- a/PrimMesher/SculptMap.cs +++ b/PrimMesher/SculptMap.cs @@ -25,16 +25,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// to build without references to System.Drawing, comment this out -#define SYSTEM_DRAWING - using System; using System.Collections.Generic; -using System.Text; - -#if SYSTEM_DRAWING using System.DrawingCore; -using System.DrawingCore.Imaging; +using System.DrawingCore.Drawing2D; namespace PrimMesher { @@ -58,7 +52,7 @@ namespace PrimMesher if (bmW == 0 || bmH == 0) throw new Exception("SculptMap: bitmap has no data"); - int numLodPixels = lod * 2 * lod * 2; // (32 * 2)^2 = 64^2 pixels for default sculpt map image + int numLodPixels = lod * 2 * lod * 2; // (32 * 2)^2 = 64^2 pixels for default sculpt map image bool needsScaling = false; @@ -79,7 +73,7 @@ namespace PrimMesher { if (needsScaling) bm = ScaleImage(bm, width, height, - System.DrawingCore.Drawing2D.InterpolationMode.NearestNeighbor); + InterpolationMode.NearestNeighbor); } catch (Exception e) @@ -107,7 +101,7 @@ namespace PrimMesher { for (int x = 0; x < width; x++) { - Color c = bm.GetPixel(x, y); + var c = bm.GetPixel(x, y); redBytes[byteNdx] = c.R; greenBytes[byteNdx] = c.G; @@ -121,8 +115,8 @@ namespace PrimMesher { for (int x = 0; x <= width; x++) { - Color c = bm.GetPixel(x < width ? x * 2 : x * 2 - 1, - y < height ? y * 2 : y * 2 - 1); + var c = bm.GetPixel(x < width ? x * 2 : x * 2 - 1, + y < height ? y * 2 : y * 2 - 1); redBytes[byteNdx] = c.R; greenBytes[byteNdx] = c.G; @@ -162,9 +156,11 @@ namespace PrimMesher for (colNdx = 0; colNdx < numCols; colNdx++) { if (mirror) - row.Add(new Coord(-(redBytes[smNdx] * pixScale - 0.5f), (greenBytes[smNdx] * pixScale - 0.5f), blueBytes[smNdx] * pixScale - 0.5f)); + row.Add(new Coord(-(redBytes[smNdx] * pixScale - 0.5f), (greenBytes[smNdx] * pixScale - 0.5f), + blueBytes[smNdx] * pixScale - 0.5f)); else - row.Add(new Coord(redBytes[smNdx] * pixScale - 0.5f, greenBytes[smNdx] * pixScale - 0.5f, blueBytes[smNdx] * pixScale - 0.5f)); + row.Add(new Coord(redBytes[smNdx] * pixScale - 0.5f, greenBytes[smNdx] * pixScale - 0.5f, + blueBytes[smNdx] * pixScale - 0.5f)); ++smNdx; } @@ -174,7 +170,7 @@ namespace PrimMesher } private Bitmap ScaleImage(Bitmap srcImage, int destWidth, int destHeight, - System.DrawingCore.Drawing2D.InterpolationMode interpMode) + InterpolationMode interpMode) { Bitmap scaledImage = new Bitmap(srcImage, destWidth, destHeight); scaledImage.SetResolution(96.0f, 96.0f); @@ -192,4 +188,3 @@ namespace PrimMesher } } } -#endif diff --git a/PrimMesher/SculptMesh.cs b/PrimMesher/SculptMesh.cs index 74e74979..5b7a0861 100644 --- a/PrimMesher/SculptMesh.cs +++ b/PrimMesher/SculptMesh.cs @@ -25,11 +25,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections.Generic; using System.IO; using System.DrawingCore; -using System.DrawingCore.Imaging; +using Color = System.DrawingCore.Color; namespace PrimMesher { @@ -47,7 +46,7 @@ namespace PrimMesher public SculptMesh SculptMeshFromFile(string fileName, SculptType sculptType, int lod, bool viewerMode) { - Bitmap bitmap = (Bitmap)Bitmap.FromFile(fileName); + Bitmap bitmap = (Bitmap)Image.FromFile(fileName); SculptMesh sculptMesh = new SculptMesh(bitmap, sculptType, lod, viewerMode); bitmap.Dispose(); return sculptMesh; @@ -56,7 +55,7 @@ namespace PrimMesher public SculptMesh(string fileName, int sculptType, int lod, int viewerMode, int mirror, int invert) { - Bitmap bitmap = (Bitmap)Bitmap.FromFile(fileName); + Bitmap bitmap = (Bitmap)Image.FromFile(fileName); _SculptMesh(bitmap, (SculptType)sculptType, lod, viewerMode != 0, mirror != 0, invert != 0); bitmap.Dispose(); } @@ -87,7 +86,7 @@ namespace PrimMesher uStep = 1.0f / (numXElements - 1); vStep = 1.0f / (numYElements - 1); } - catch (DivideByZeroException) + catch (System.DivideByZeroException) { return; } @@ -125,11 +124,11 @@ namespace PrimMesher p1 = p3 - numXElements; Coord c = new Coord(xBegin + x * xStep, yBegin + y * yStep, zMap[y, x]); - this.coords.Add(c); + coords.Add(c); if (viewerMode) { - this.normals.Add(new Coord()); - this.uvs.Add(new UVCoord(uStep * x, 1.0f - vStep * y)); + normals.Add(new Coord()); + uvs.Add(new UVCoord(uStep * x, 1.0f - vStep * y)); } if (y > 0 && x > 0) @@ -154,8 +153,8 @@ namespace PrimMesher f2 = new Face(p1, p2, p4); } - this.faces.Add(f1); - this.faces.Add(f2); + faces.Add(f1); + faces.Add(f2); } } } @@ -218,7 +217,7 @@ namespace PrimMesher { for (imageY = imageYStart; imageY < imageYEnd; imageY++) { - Color c = bitmap.GetPixel(imageX, imageY); + var c = bitmap.GetPixel(imageX, imageY); if (c.A != 255) { bitmap.SetPixel(imageX, imageY, Color.FromArgb(255, c.R, c.G, c.B)); @@ -262,7 +261,7 @@ namespace PrimMesher imageX = colNdx * scale; if (colNdx == numCols) imageX--; - Color c = bitmap.GetPixel(imageX, imageY); + var c = bitmap.GetPixel(imageX, imageY); if (c.A != 255) { bitmap.SetPixel(imageX, imageY, Color.FromArgb(255, c.R, c.G, c.B)); @@ -386,11 +385,11 @@ namespace PrimMesher p2 = p4 - coordsAcross; p1 = p3 - coordsAcross; - this.coords.Add(rows[imageY][imageX]); + coords.Add(rows[imageY][imageX]); if (viewerMode) { - this.normals.Add(new Coord()); - this.uvs.Add(new UVCoord(widthUnit * imageX, heightUnit * imageY)); + normals.Add(new Coord()); + uvs.Add(new UVCoord(widthUnit * imageX, heightUnit * imageY)); } if (imageY > 0 && imageX > 0) @@ -438,8 +437,8 @@ namespace PrimMesher } } - this.faces.Add(f1); - this.faces.Add(f2); + faces.Add(f1); + faces.Add(f2); } } } @@ -469,19 +468,19 @@ namespace PrimMesher private void calcVertexNormals(SculptType sculptType, int xSize, int ySize) { // compute vertex normals by summing all the surface normals of all the triangles sharing // each vertex and then normalizing - int numFaces = this.faces.Count; + int numFaces = faces.Count; for (int i = 0; i < numFaces; i++) { - Face face = this.faces[i]; - Coord surfaceNormal = face.SurfaceNormal(this.coords); - this.normals[face.n1] += surfaceNormal; - this.normals[face.n2] += surfaceNormal; - this.normals[face.n3] += surfaceNormal; + Face face = faces[i]; + Coord surfaceNormal = face.SurfaceNormal(coords); + normals[face.n1] += surfaceNormal; + normals[face.n2] += surfaceNormal; + normals[face.n3] += surfaceNormal; } - int numNormals = this.normals.Count; + int numNormals = normals.Count; for (int i = 0; i < numNormals; i++) - this.normals[i] = this.normals[i].Normalize(); + normals[i] = normals[i].Normalize(); if (sculptType != SculptType.plane) { // blend the vertex normals at the cylinder seam @@ -489,30 +488,30 @@ namespace PrimMesher { int rowOffset = y * xSize; - this.normals[rowOffset] = this.normals[rowOffset + xSize - 1] = (this.normals[rowOffset] + this.normals[rowOffset + xSize - 1]).Normalize(); + normals[rowOffset] = normals[rowOffset + xSize - 1] = (normals[rowOffset] + normals[rowOffset + xSize - 1]).Normalize(); } } - foreach (Face face in this.faces) + foreach (Face face in faces) { ViewerFace vf = new ViewerFace(0); - vf.v1 = this.coords[face.v1]; - vf.v2 = this.coords[face.v2]; - vf.v3 = this.coords[face.v3]; + vf.v1 = coords[face.v1]; + vf.v2 = coords[face.v2]; + vf.v3 = coords[face.v3]; vf.coordIndex1 = face.v1; vf.coordIndex2 = face.v2; vf.coordIndex3 = face.v3; - vf.n1 = this.normals[face.n1]; - vf.n2 = this.normals[face.n2]; - vf.n3 = this.normals[face.n3]; + vf.n1 = normals[face.n1]; + vf.n2 = normals[face.n2]; + vf.n3 = normals[face.n3]; - vf.uv1 = this.uvs[face.uv1]; - vf.uv2 = this.uvs[face.uv2]; - vf.uv3 = this.uvs[face.uv3]; + vf.uv1 = uvs[face.uv1]; + vf.uv2 = uvs[face.uv2]; + vf.uv3 = uvs[face.uv3]; - this.viewerFaces.Add(vf); + viewerFaces.Add(vf); } } @@ -525,27 +524,27 @@ namespace PrimMesher public void AddPos(float x, float y, float z) { int i; - int numVerts = this.coords.Count; + int numVerts = coords.Count; Coord vert; for (i = 0; i < numVerts; i++) { - vert = this.coords[i]; + vert = coords[i]; vert.X += x; vert.Y += y; vert.Z += z; - this.coords[i] = vert; + coords[i] = vert; } - if (this.viewerFaces != null) + if (viewerFaces != null) { - int numViewerFaces = this.viewerFaces.Count; + int numViewerFaces = viewerFaces.Count; for (i = 0; i < numViewerFaces; i++) { - ViewerFace v = this.viewerFaces[i]; + ViewerFace v = viewerFaces[i]; v.AddPos(x, y, z); - this.viewerFaces[i] = v; + viewerFaces[i] = v; } } } @@ -557,22 +556,22 @@ namespace PrimMesher public void AddRot(Quat q) { int i; - int numVerts = this.coords.Count; + int numVerts = coords.Count; for (i = 0; i < numVerts; i++) - this.coords[i] *= q; + coords[i] *= q; - int numNormals = this.normals.Count; + int numNormals = normals.Count; for (i = 0; i < numNormals; i++) - this.normals[i] *= q; + normals[i] *= q; - if (this.viewerFaces != null) + if (viewerFaces != null) { - int numViewerFaces = this.viewerFaces.Count; + int numViewerFaces = viewerFaces.Count; for (i = 0; i < numViewerFaces; i++) { - ViewerFace v = this.viewerFaces[i]; + ViewerFace v = viewerFaces[i]; v.v1 *= q; v.v2 *= q; v.v3 *= q; @@ -581,7 +580,7 @@ namespace PrimMesher v.n2 *= q; v.n3 *= q; - this.viewerFaces[i] = v; + viewerFaces[i] = v; } } } @@ -589,39 +588,39 @@ namespace PrimMesher public void Scale(float x, float y, float z) { int i; - int numVerts = this.coords.Count; + int numVerts = coords.Count; Coord m = new Coord(x, y, z); for (i = 0; i < numVerts; i++) - this.coords[i] *= m; + coords[i] *= m; - if (this.viewerFaces != null) + if (viewerFaces != null) { - int numViewerFaces = this.viewerFaces.Count; + int numViewerFaces = viewerFaces.Count; for (i = 0; i < numViewerFaces; i++) { - ViewerFace v = this.viewerFaces[i]; + ViewerFace v = viewerFaces[i]; v.v1 *= m; v.v2 *= m; v.v3 *= m; - this.viewerFaces[i] = v; + viewerFaces[i] = v; } } } - public void DumpRaw(String path, String name, String title) + public void DumpRaw(System.String path, System.String name, System.String title) { if (path == null) return; - String fileName = name + "_" + title + ".raw"; - String completePath = System.IO.Path.Combine(path, fileName); + System.String fileName = name + "_" + title + ".raw"; + System.String completePath = System.IO.Path.Combine(path, fileName); StreamWriter sw = new StreamWriter(completePath); - for (int i = 0; i < this.faces.Count; i++) + for (int i = 0; i < faces.Count; i++) { - string s = this.coords[this.faces[i].v1].ToString(); - s += " " + this.coords[this.faces[i].v2].ToString(); - s += " " + this.coords[this.faces[i].v3].ToString(); + string s = coords[faces[i].v1].ToString(); + s += " " + coords[faces[i].v2].ToString(); + s += " " + coords[faces[i].v3].ToString(); sw.WriteLine(s); } diff --git a/Programs/Baker/Baker.csproj b/Programs/Baker/Baker.csproj index e1f17687..3b3bc81f 100644 --- a/Programs/Baker/Baker.csproj +++ b/Programs/Baker/Baker.csproj @@ -59,6 +59,9 @@ 1591,1574,0419 AnyCPU + + + System diff --git a/Programs/Baker/Oven.cs b/Programs/Baker/Oven.cs index 485b6850..e1512e96 100644 --- a/Programs/Baker/Oven.cs +++ b/Programs/Baker/Oven.cs @@ -1,6 +1,5 @@ using System; -using System.Drawing; -using System.Drawing.Imaging; +using System.DrawingCore; using System.Runtime.InteropServices; namespace Baker diff --git a/Programs/Baker/frmBaker.cs b/Programs/Baker/frmBaker.cs index 2dcb5204..a3400c4c 100644 --- a/Programs/Baker/frmBaker.cs +++ b/Programs/Baker/frmBaker.cs @@ -33,7 +33,7 @@ namespace Baker //ManagedImage managedImage = new ManagedImage(AlphaMask); // FIXME: Operate on ManagedImage instead of Bitmap - pic1.Image = Oven.ModifyAlphaMask(_alphaMask, (byte)scrollWeight.Value, 0.0f); + pic1.Image = (System.Drawing.Bitmap)(object)Oven.ModifyAlphaMask(_alphaMask, (byte)scrollWeight.Value, 0.0f); // *HACK: } else { @@ -44,7 +44,7 @@ namespace Baker private void scrollWeight_Scroll(object sender, ScrollEventArgs e) { - pic1.Image = Oven.ModifyAlphaMask(_alphaMask, (byte)scrollWeight.Value, 0.0f); + pic1.Image = (System.Drawing.Bitmap)(object)Oven.ModifyAlphaMask(_alphaMask, (byte)scrollWeight.Value, 0.0f); // *HACK: } private void frmBaker_FormClosing(object sender, FormClosingEventArgs e) diff --git a/Programs/GridProxy/GridProxyApp.csproj b/Programs/GridProxy/GridProxyApp.csproj index a655771a..bfbe4487 100644 --- a/Programs/GridProxy/GridProxyApp.csproj +++ b/Programs/GridProxy/GridProxyApp.csproj @@ -12,7 +12,7 @@ Grid IE50 false - net461 + netstandard2.0 Exe GridProxyApp false @@ -54,7 +54,9 @@ AnyCPU + + diff --git a/Programs/examples/TestClient/Commands/Inventory/UploadImageCommand.cs b/Programs/examples/TestClient/Commands/Inventory/UploadImageCommand.cs index d9bf096f..fb4653bf 100644 --- a/Programs/examples/TestClient/Commands/Inventory/UploadImageCommand.cs +++ b/Programs/examples/TestClient/Commands/Inventory/UploadImageCommand.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.DrawingCore; +using System.DrawingCore.Drawing2D; using OpenMetaverse.Imaging; namespace OpenMetaverse.TestClient @@ -98,7 +99,7 @@ namespace OpenMetaverse.TestClient if (lowfilename.EndsWith(".tga")) bitmap = LoadTGAClass.LoadTGA(fileName); else - bitmap = (Bitmap)System.DrawingCore.Image.FromFile(fileName); + bitmap = (Bitmap)Image.FromFile(fileName); int oldwidth = bitmap.Width; int oldheight = bitmap.Height; @@ -108,9 +109,8 @@ namespace OpenMetaverse.TestClient Bitmap resized = new Bitmap(256, 256, bitmap.PixelFormat); Graphics graphics = Graphics.FromImage(resized); - graphics.SmoothingMode = System.DrawingCore.Drawing2D.SmoothingMode.HighQuality; - graphics.InterpolationMode = - System.DrawingCore.Drawing2D.InterpolationMode.HighQualityBicubic; + graphics.SmoothingMode = SmoothingMode.HighQuality; + graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; graphics.DrawImage(bitmap, 0, 0, 256, 256); bitmap.Dispose(); @@ -129,9 +129,9 @@ namespace OpenMetaverse.TestClient Bitmap resized = new Bitmap(newwidth, newheight, bitmap.PixelFormat); Graphics graphics = Graphics.FromImage(resized); - graphics.SmoothingMode = System.DrawingCore.Drawing2D.SmoothingMode.HighQuality; + graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.InterpolationMode = - System.DrawingCore.Drawing2D.InterpolationMode.HighQualityBicubic; + InterpolationMode.HighQualityBicubic; graphics.DrawImage(bitmap, 0, 0, newwidth, newheight); bitmap.Dispose();