-
Notifications
You must be signed in to change notification settings - Fork 25
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 #56 from imazen/memory
Rewrite internals and add new APIs and deprecation warnings.
- Loading branch information
Showing
95 changed files
with
8,503 additions
and
9,519 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
Imageflow.NET contains code contributed by: | ||
|
||
Nathanael Jones <[email protected]> | ||
Lilith River <[email protected]> |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,55 +1,55 @@ | ||
using System.Text.Json.Nodes; | ||
using System.Text.Json.Nodes; | ||
|
||
using Imageflow.Fluent; | ||
|
||
namespace Imageflow.Bindings | ||
namespace Imageflow.Bindings; | ||
|
||
public class ImageInfo | ||
{ | ||
public class ImageInfo | ||
private ImageInfo(JsonNode imageInfo) | ||
{ | ||
private ImageInfo(JsonNode imageInfo) | ||
{ | ||
var obj = imageInfo.AsObject(); | ||
// ImageWidth = imageInfo.image_width.Value; | ||
// ImageHeight = imageInfo.image_height.Value; | ||
// PreferredMimeType = imageInfo.preferred_mime_type.Value; | ||
// PreferredExtension = imageInfo.preferred_extension.Value; | ||
// FrameDecodesInto = Enum.Parse(typeof(Fluent.PixelFormat), imageInfo.frame_decodes_into.Value, | ||
// true); | ||
const string widthMsg = "Imageflow get_image_info responded with null image_info.image_width"; | ||
ImageWidth = obj.TryGetPropertyValue("image_width", out var imageWidthValue) | ||
? imageWidthValue?.GetValue<long>() ?? throw new ImageflowAssertionFailed(widthMsg) | ||
: throw new ImageflowAssertionFailed(widthMsg); | ||
|
||
const string heightMsg = "Imageflow get_image_info responded with null image_info.image_height"; | ||
ImageHeight = obj.TryGetPropertyValue("image_height", out var imageHeightValue) | ||
? imageHeightValue?.GetValue<long>() ?? throw new ImageflowAssertionFailed(heightMsg) | ||
: throw new ImageflowAssertionFailed(heightMsg); | ||
|
||
const string mimeMsg = "Imageflow get_image_info responded with null image_info.preferred_mime_type"; | ||
PreferredMimeType = obj.TryGetPropertyValue("preferred_mime_type", out var preferredMimeTypeValue) | ||
? preferredMimeTypeValue?.GetValue<string>() ?? throw new ImageflowAssertionFailed(mimeMsg) | ||
: throw new ImageflowAssertionFailed(mimeMsg); | ||
|
||
const string extMsg = "Imageflow get_image_info responded with null image_info.preferred_extension"; | ||
PreferredExtension = obj.TryGetPropertyValue("preferred_extension", out var preferredExtensionValue) | ||
? preferredExtensionValue?.GetValue<string>() ?? throw new ImageflowAssertionFailed(extMsg) | ||
: throw new ImageflowAssertionFailed(extMsg); | ||
|
||
const string frameMsg = "Imageflow get_image_info responded with null image_info.frame_decodes_into"; | ||
FrameDecodesInto = obj.TryGetPropertyValue("frame_decodes_into", out var frameDecodesIntoValue) | ||
? PixelFormatParser.Parse(frameDecodesIntoValue?.GetValue<string>() ?? throw new ImageflowAssertionFailed(frameMsg)) | ||
: throw new ImageflowAssertionFailed(frameMsg); | ||
|
||
} | ||
internal static ImageInfo FromDynamic(JsonNode imageInfo) | ||
{ | ||
return new ImageInfo(imageInfo); | ||
} | ||
|
||
public PixelFormat FrameDecodesInto { get; private init; } | ||
public long ImageWidth { get; private init; } | ||
public long ImageHeight { get; private init; } | ||
public string PreferredMimeType { get; private init; } | ||
public string PreferredExtension { get; private init; } | ||
var obj = imageInfo.AsObject(); | ||
// ImageWidth = imageInfo.image_width.Value; | ||
// ImageHeight = imageInfo.image_height.Value; | ||
// PreferredMimeType = imageInfo.preferred_mime_type.Value; | ||
// PreferredExtension = imageInfo.preferred_extension.Value; | ||
// FrameDecodesInto = Enum.Parse(typeof(Fluent.PixelFormat), imageInfo.frame_decodes_into.Value, | ||
// true); | ||
const string widthMsg = "Imageflow get_image_info responded with null image_info.image_width"; | ||
ImageWidth = obj.TryGetPropertyValue("image_width", out var imageWidthValue) | ||
? imageWidthValue?.GetValue<long>() ?? throw new ImageflowAssertionFailed(widthMsg) | ||
: throw new ImageflowAssertionFailed(widthMsg); | ||
|
||
const string heightMsg = "Imageflow get_image_info responded with null image_info.image_height"; | ||
ImageHeight = obj.TryGetPropertyValue("image_height", out var imageHeightValue) | ||
? imageHeightValue?.GetValue<long>() ?? throw new ImageflowAssertionFailed(heightMsg) | ||
: throw new ImageflowAssertionFailed(heightMsg); | ||
|
||
const string mimeMsg = "Imageflow get_image_info responded with null image_info.preferred_mime_type"; | ||
PreferredMimeType = obj.TryGetPropertyValue("preferred_mime_type", out var preferredMimeTypeValue) | ||
? preferredMimeTypeValue?.GetValue<string>() ?? throw new ImageflowAssertionFailed(mimeMsg) | ||
: throw new ImageflowAssertionFailed(mimeMsg); | ||
|
||
const string extMsg = "Imageflow get_image_info responded with null image_info.preferred_extension"; | ||
PreferredExtension = obj.TryGetPropertyValue("preferred_extension", out var preferredExtensionValue) | ||
? preferredExtensionValue?.GetValue<string>() ?? throw new ImageflowAssertionFailed(extMsg) | ||
: throw new ImageflowAssertionFailed(extMsg); | ||
|
||
const string frameMsg = "Imageflow get_image_info responded with null image_info.frame_decodes_into"; | ||
FrameDecodesInto = obj.TryGetPropertyValue("frame_decodes_into", out var frameDecodesIntoValue) | ||
? PixelFormatParser.Parse(frameDecodesIntoValue?.GetValue<string>() ?? throw new ImageflowAssertionFailed(frameMsg)) | ||
: throw new ImageflowAssertionFailed(frameMsg); | ||
|
||
} | ||
internal static ImageInfo FromDynamic(JsonNode imageInfo) | ||
{ | ||
return new ImageInfo(imageInfo); | ||
} | ||
|
||
public PixelFormat FrameDecodesInto { get; private init; } | ||
public long ImageWidth { get; private init; } | ||
public long ImageHeight { get; private init; } | ||
public string PreferredMimeType { get; private init; } | ||
public string PreferredExtension { get; private init; } | ||
|
||
} |
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 |
---|---|---|
@@ -1,8 +1,7 @@ | ||
namespace Imageflow.Bindings | ||
{ | ||
/// <inheritdoc /> | ||
/// <summary> | ||
/// For bugs | ||
/// </summary> | ||
public class ImageflowAssertionFailed(string message) : Exception(message); | ||
} | ||
namespace Imageflow.Bindings; | ||
|
||
/// <inheritdoc /> | ||
/// <summary> | ||
/// For bugs | ||
/// </summary> | ||
public class ImageflowAssertionFailed(string message) : Exception(message); |
Oops, something went wrong.