-
-
Notifications
You must be signed in to change notification settings - Fork 20
[develop] DW Releases/2025.6 #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -463,9 +463,17 @@ public T ToBitmap<T>() | |
| /// Create a new Bitmap from a a Byte Span. | ||
| /// </summary> | ||
| /// <param name="span">A Byte Span of image data in any common format.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32. | ||
| /// Default is true. Set to false to load as Rgba32.</param> | ||
| public static AnyBitmap FromSpan(ReadOnlySpan<byte> span, bool preserveOriginalFormat = true) | ||
| public static AnyBitmap FromSpan(ReadOnlySpan<byte> span) | ||
| { | ||
| return new AnyBitmap(span, true); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Create a new Bitmap from a a Byte Span. | ||
| /// </summary> | ||
| /// <param name="span">A Byte Span of image data in any common format.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32.</param> | ||
| public static AnyBitmap FromSpan(ReadOnlySpan<byte> span, bool preserveOriginalFormat) | ||
| { | ||
| return new AnyBitmap(span, preserveOriginalFormat); | ||
| } | ||
|
|
@@ -474,22 +482,41 @@ public static AnyBitmap FromSpan(ReadOnlySpan<byte> span, bool preserveOriginalF | |
| /// Create a new Bitmap from a a Byte Array. | ||
| /// </summary> | ||
| /// <param name="bytes">A ByteArray of image data in any common format.</param> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32. | ||
| /// Default is true. Set to false to load as Rgba32.</param> | ||
| public static AnyBitmap FromBytes(byte[] bytes, bool preserveOriginalFormat = true) | ||
| public static AnyBitmap FromBytes(byte[] bytes) | ||
| { | ||
| return new AnyBitmap(bytes, true); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Create a new Bitmap from a a Byte Array. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| /// </summary> | ||
| /// <param name="bytes">A ByteArray of image data in any common format.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32.</param> | ||
| public static AnyBitmap FromBytes(byte[] bytes, bool preserveOriginalFormat) | ||
| { | ||
| return new AnyBitmap(bytes, preserveOriginalFormat); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Create a new Bitmap from a <see cref="Stream"/> (bytes). | ||
| /// </summary> | ||
| /// <param name="stream">A <see cref="Stream"/> of image data in any common format.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32. | ||
| /// <param name="stream">A <see cref="Stream"/> of image data in any common format.</param> | ||
| /// Default is true. Set to false to load as Rgba32.</param> | ||
| /// <seealso cref="FromStream(Stream, bool)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public static AnyBitmap FromStream(MemoryStream stream, bool preserveOriginalFormat = true) | ||
| public static AnyBitmap FromStream(MemoryStream stream) | ||
| { | ||
| return new AnyBitmap(stream, true); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Create a new Bitmap from a <see cref="Stream"/> (bytes). | ||
| /// </summary> | ||
| /// <param name="stream">A <see cref="Stream"/> of image data in any common format.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32.</param> | ||
| /// <seealso cref="FromStream(Stream, bool)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public static AnyBitmap FromStream(MemoryStream stream, bool preserveOriginalFormat) | ||
| { | ||
| return new AnyBitmap(stream, preserveOriginalFormat); | ||
| } | ||
|
|
@@ -498,11 +525,21 @@ public static AnyBitmap FromStream(MemoryStream stream, bool preserveOriginalFor | |
| /// Create a new Bitmap from a <see cref="Stream"/> (bytes). | ||
| /// </summary> | ||
| /// <param name="stream">A <see cref="Stream"/> of image data in any common format.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32. | ||
| /// Default is true. Set to false to load as Rgba32.</param> | ||
| /// <seealso cref="FromStream(MemoryStream, bool)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public static AnyBitmap FromStream(Stream stream, bool preserveOriginalFormat = true) | ||
| public static AnyBitmap FromStream(Stream stream) | ||
| { | ||
| return new AnyBitmap(stream, true); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Create a new Bitmap from a <see cref="Stream"/> (bytes). | ||
| /// </summary> | ||
| /// <param name="stream">A <see cref="Stream"/> of image data in any common format.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32.</param> | ||
| /// <seealso cref="FromStream(MemoryStream, bool)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public static AnyBitmap FromStream(Stream stream, bool preserveOriginalFormat) | ||
| { | ||
| return new AnyBitmap(stream, preserveOriginalFormat); | ||
| } | ||
|
|
@@ -511,10 +548,19 @@ public static AnyBitmap FromStream(Stream stream, bool preserveOriginalFormat = | |
| /// Construct a new Bitmap from binary data (byte span). | ||
| /// </summary> | ||
| /// <param name="span">A byte span of image data in any common format.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32. | ||
| /// Default is true. Set to false to load as Rgba32.</param> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public AnyBitmap(ReadOnlySpan<byte> span, bool preserveOriginalFormat = true) | ||
| public AnyBitmap(ReadOnlySpan<byte> span) | ||
| { | ||
| LoadImage(span, true); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Construct a new Bitmap from binary data (byte span). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it'd be better to clarify the input type in the summary as |
||
| /// </summary> | ||
| /// <param name="span">A byte span of image data in any common format.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32.</param> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public AnyBitmap(ReadOnlySpan<byte> span, bool preserveOriginalFormat) | ||
| { | ||
| LoadImage(span, preserveOriginalFormat); | ||
| } | ||
|
|
@@ -523,11 +569,21 @@ public AnyBitmap(ReadOnlySpan<byte> span, bool preserveOriginalFormat = true) | |
| /// Construct a new Bitmap from binary data (bytes). | ||
| /// </summary> | ||
| /// <param name="bytes">A ByteArray of image data in any common format.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32. | ||
| /// Default is true. Set to false to load as Rgba32.</param> | ||
| /// <seealso cref="FromBytes"/> | ||
| /// <seealso cref="FromBytes(byte[])"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public AnyBitmap(byte[] bytes) | ||
| { | ||
| LoadImage(bytes, true); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Construct a new Bitmap from binary data (bytes). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here: |
||
| /// </summary> | ||
| /// <param name="bytes">A ByteArray of image data in any common format.</param> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32.</param> | ||
| /// <seealso cref="FromBytes(byte[], bool)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public AnyBitmap(byte[] bytes, bool preserveOriginalFormat = true) | ||
| public AnyBitmap(byte[] bytes, bool preserveOriginalFormat) | ||
| { | ||
| LoadImage(bytes, preserveOriginalFormat); | ||
| } | ||
|
|
@@ -536,8 +592,18 @@ public AnyBitmap(byte[] bytes, bool preserveOriginalFormat = true) | |
| /// Construct a new Bitmap from a <see cref="Stream"/> (bytes). | ||
| /// </summary> | ||
| /// <param name="stream">A <see cref="Stream"/> of image data in any common format.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32. | ||
| /// Default is true. Set to false to load as Rgba32.</param> | ||
| /// <seealso cref="FromStream(Stream, bool)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public AnyBitmap(MemoryStream stream) | ||
| { | ||
| LoadImage(stream.ToArray(), true); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Construct a new Bitmap from a <see cref="Stream"/> (bytes). | ||
| /// </summary> | ||
| /// <param name="stream">A <see cref="Stream"/> of image data in any common format.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32.</param> | ||
| /// <seealso cref="FromStream(Stream, bool)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public AnyBitmap(MemoryStream stream, bool preserveOriginalFormat = true) | ||
|
|
@@ -549,11 +615,21 @@ public AnyBitmap(MemoryStream stream, bool preserveOriginalFormat = true) | |
| /// Construct a new Bitmap from a <see cref="Stream"/> (bytes). | ||
| /// </summary> | ||
| /// <param name="stream">A <see cref="Stream"/> of image data in any common format.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32. | ||
| /// Default is true. Set to false to load as Rgba32.</param> | ||
| /// <seealso cref="FromStream(MemoryStream, bool)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public AnyBitmap(Stream stream, bool preserveOriginalFormat = true) | ||
| public AnyBitmap(Stream stream) | ||
| { | ||
| LoadImage(stream, true); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Construct a new Bitmap from a <see cref="Stream"/> (bytes). | ||
| /// </summary> | ||
| /// <param name="stream">A <see cref="Stream"/> of image data in any common format.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32.</param> | ||
| /// <seealso cref="FromStream(MemoryStream, bool)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public AnyBitmap(Stream stream, bool preserveOriginalFormat) | ||
| { | ||
| LoadImage(stream, preserveOriginalFormat); | ||
| } | ||
|
|
@@ -574,11 +650,21 @@ public AnyBitmap(AnyBitmap original, int width, int height) | |
| /// Construct a new Bitmap from a file. | ||
| /// </summary> | ||
| /// <param name="file">A fully qualified file path./</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32. | ||
| /// Default is true. Set to false to load as Rgba32.</param> | ||
| /// <seealso cref="FromFile"/> | ||
| /// <seealso cref="FromFile(string)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public AnyBitmap(string file, bool preserveOriginalFormat = true) | ||
| public AnyBitmap(string file) | ||
| { | ||
| LoadImage(File.ReadAllBytes(file), true); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Construct a new Bitmap from a file. | ||
| /// </summary> | ||
| /// <param name="file">A fully qualified file path./</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32.</param> | ||
| /// <seealso cref="FromFile(string, bool)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public AnyBitmap(string file, bool preserveOriginalFormat) | ||
| { | ||
| LoadImage(File.ReadAllBytes(file), preserveOriginalFormat); | ||
| } | ||
|
|
@@ -587,11 +673,29 @@ public AnyBitmap(string file, bool preserveOriginalFormat = true) | |
| /// Construct a new Bitmap from a Uri | ||
| /// </summary> | ||
| /// <param name="uri">The uri of the image.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32. | ||
| /// Default is true. Set to false to load as Rgba32.</param> | ||
| /// <seealso cref="FromUriAsync"/> | ||
| /// <seealso cref="FromUriAsync(Uri)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public AnyBitmap(Uri uri, bool preserveOriginalFormat = true) | ||
| public AnyBitmap(Uri uri) | ||
| { | ||
| try | ||
| { | ||
| using Stream stream = LoadUriAsync(uri).GetAwaiter().GetResult(); | ||
| LoadImage(stream, true); | ||
| } | ||
| catch (Exception e) | ||
| { | ||
| throw new NotSupportedException("Error while loading AnyBitmap from Uri", e); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Construct a new Bitmap from a Uri | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| /// </summary> | ||
| /// <param name="uri">The uri of the image.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32.</param> | ||
| /// <seealso cref="FromUriAsync(Uri, bool)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public AnyBitmap(Uri uri, bool preserveOriginalFormat) | ||
| { | ||
| try | ||
| { | ||
|
|
@@ -619,11 +723,28 @@ public AnyBitmap(int width, int height, Color backgroundColor = null) | |
| /// Create a new Bitmap from a file. | ||
| /// </summary> | ||
| /// <param name="file">A fully qualified file path.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32. | ||
| /// Default is true. Set to false to load as Rgba32.</param> | ||
| /// <seealso cref="FromFile"/> | ||
| /// <seealso cref="FromFile(string)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public static AnyBitmap FromFile(string file, bool preserveOriginalFormat = true) | ||
| public static AnyBitmap FromFile(string file) | ||
| { | ||
| if (file.ToLower().EndsWith(".svg")) | ||
| { | ||
| return LoadSVGImage(file, true); | ||
| } | ||
| else | ||
| { | ||
| return new AnyBitmap(file, true); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Create a new Bitmap from a file. | ||
| /// </summary> | ||
| /// <param name="file">A fully qualified file path.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32.</param> | ||
| /// <seealso cref="FromFile(string, bool)"/> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| public static AnyBitmap FromFile(string file, bool preserveOriginalFormat) | ||
| { | ||
| if (file.ToLower().EndsWith(".svg")) | ||
| { | ||
|
|
@@ -639,13 +760,33 @@ public static AnyBitmap FromFile(string file, bool preserveOriginalFormat = true | |
| /// Construct a new Bitmap from a Uri | ||
| /// </summary> | ||
| /// <param name="uri">The uri of the image.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32. | ||
| /// Default is true. Set to false to load as Rgba32.</param> | ||
| /// <returns></returns> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| /// <seealso cref="FromUri"/> | ||
| /// <seealso cref="FromUriAsync"/> | ||
| public static async Task<AnyBitmap> FromUriAsync(Uri uri, bool preserveOriginalFormat = true) | ||
| /// <seealso cref="FromUri(Uri)"/> | ||
| /// <seealso cref="FromUriAsync(Uri)"/> | ||
| public static async Task<AnyBitmap> FromUriAsync(Uri uri) | ||
| { | ||
| try | ||
| { | ||
| using Stream stream = await LoadUriAsync(uri); | ||
| return new AnyBitmap(stream, true); | ||
| } | ||
| catch (Exception e) | ||
| { | ||
| throw new NotSupportedException("Error while loading AnyBitmap from Uri", e); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Construct a new Bitmap from a Uri | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||
| /// </summary> | ||
| /// <param name="uri">The uri of the image.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32.</param> | ||
| /// <returns></returns> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| /// <seealso cref="FromUri(Uri, bool)"/> | ||
| /// <seealso cref="FromUriAsync(Uri, bool)"/> | ||
| public static async Task<AnyBitmap> FromUriAsync(Uri uri, bool preserveOriginalFormat) | ||
| { | ||
| try | ||
| { | ||
|
|
@@ -662,15 +803,13 @@ public static async Task<AnyBitmap> FromUriAsync(Uri uri, bool preserveOriginalF | |
| /// Construct a new Bitmap from a Uri | ||
| /// </summary> | ||
| /// <param name="uri">The uri of the image.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32. | ||
| /// Default is true. Set to false to load as Rgba32.</param> | ||
| /// <returns></returns> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| /// <seealso cref="FromUriAsync"/> | ||
| /// <seealso cref="FromUriAsync(Uri)"/> | ||
| #if NET6_0_OR_GREATER | ||
| [Obsolete("FromUri(Uri) is obsolete for net60 or greater because it uses WebClient which is obsolete. Consider using FromUriAsync(Uri) method.")] | ||
| #endif | ||
| public static AnyBitmap FromUri(Uri uri, bool preserveOriginalFormat = true) | ||
| public static AnyBitmap FromUri(Uri uri) | ||
| { | ||
| try | ||
| { | ||
|
|
@@ -683,6 +822,30 @@ public static AnyBitmap FromUri(Uri uri, bool preserveOriginalFormat = true) | |
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Construct a new Bitmap from a Uri | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||
| /// </summary> | ||
| /// <param name="uri">The uri of the image.</param> | ||
| /// <param name="preserveOriginalFormat">Determine whether to load <see cref="SixLabors.ImageSharp.Image"/> as its original pixel format or Rgba32.</param> | ||
| /// <returns></returns> | ||
| /// <seealso cref="AnyBitmap"/> | ||
| /// <seealso cref="FromUriAsync(Uri, bool)"/> | ||
| #if NET6_0_OR_GREATER | ||
| [Obsolete("FromUri(Uri) is obsolete for net60 or greater because it uses WebClient which is obsolete. Consider using FromUriAsync(Uri) method.")] | ||
| #endif | ||
| public static AnyBitmap FromUri(Uri uri, bool preserveOriginalFormat) | ||
| { | ||
| try | ||
| { | ||
| using WebClient client = new(); | ||
| return new AnyBitmap(client.OpenRead(uri), preserveOriginalFormat); | ||
| } | ||
| catch (Exception e) | ||
| { | ||
| throw new NotSupportedException("Error while loading AnyBitmap from Uri", e); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Creates an AnyBitmap object from a buffer of RGB pixel data. | ||
| /// </summary> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from a a Byte Span->from a byte span