-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from LogicReinc/dev-1.1.2
Dev 1.1.2
- Loading branch information
Showing
34 changed files
with
1,009 additions
and
500 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
LogicReinc.BlendFarm.Client/ImageTypes/DefaultImageConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Drawing; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace LogicReinc.BlendFarm.Client.ImageTypes | ||
{ | ||
public class DefaultImageConverter : IImageConverter | ||
{ | ||
public Image FromStream(Stream str) | ||
{ | ||
return new Bitmap(Bitmap.FromStream(str)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Drawing; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace LogicReinc.BlendFarm.Client.ImageTypes | ||
{ | ||
public static class ImageConverter | ||
{ | ||
public static DefaultImageConverter Default { get; } = new DefaultImageConverter(); | ||
|
||
public static Image Convert(byte[] bytes, string format) | ||
{ | ||
using (MemoryStream str = new MemoryStream(bytes)) | ||
return Convert(str, format); | ||
} | ||
public static Image Convert(Stream str, string format) | ||
{ | ||
format = format.ToUpper().Trim(); | ||
switch (format) | ||
{ | ||
case "": | ||
case "BMP": | ||
case "PNG": | ||
case "JPEG": | ||
case "TIFF": | ||
return Default.FromStream(str); | ||
default: | ||
return null; | ||
} | ||
} | ||
} | ||
|
||
public interface IImageConverter | ||
{ | ||
Image FromStream(Stream str); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace LogicReinc.BlendFarm.Client.ImageTypes | ||
{ | ||
public class ImageFormats | ||
{ | ||
public static string[] Formats = new string[] { "BMP", "PNG", "JPEG", "JPEG2000", "TARGA", "TARGA_RAW", "CINEON", "DPX", "OPEN_EXR_MULTILAYER", "OPEN_EXR", "HDR", "TIFF" }; | ||
public static string[] Extensions => _extensions.Values.ToArray(); | ||
private static Dictionary<string, string> _extensions = new Dictionary<string, string>() | ||
{ | ||
{ "BMP", "bmp" }, | ||
{ "PNG", "png" }, | ||
{ "JPEG", "jpg"}, | ||
{ "JPEG2000", "jpg"}, | ||
{ "TARGA", "tga"}, | ||
{ "TARGA_RAW", "tga" }, | ||
{ "CINEON", "cin" }, | ||
{ "DPX", "dpx" }, | ||
{ "OPEN_EXR_MULTILAYER", "exr"}, | ||
{ "OPEN_EXR", "exr"}, | ||
{ "HDR", "hdr" }, | ||
{ "TIFF", "tif"} | ||
}; | ||
|
||
public static string GetExtension(String format) | ||
{ | ||
if (_extensions.ContainsKey(format)) | ||
return _extensions[format]; | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.