Compare commits

...

2 Commits

Author SHA1 Message Date
925464e0c0 Fix build error on older c# versions.
Some checks failed
Build / build (push) Failing after 1m28s
2024-06-19 11:47:54 +03:00
f976af3833 Increment version counter for 2.0.0-rc
Some checks failed
Build / build (push) Failing after 1m34s
2024-06-19 11:42:29 +03:00
2 changed files with 14 additions and 6 deletions

@ -13,7 +13,7 @@
<!-- Nuget Properties. --> <!-- Nuget Properties. -->
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageId>ReFuel.StbImage</PackageId> <PackageId>ReFuel.StbImage</PackageId>
<Version>1.1.0-rc0</Version> <Version>2.0-rc</Version>
<Authors>STBI Authors, H. Utku Maden</Authors> <Authors>STBI Authors, H. Utku Maden</Authors>
<Description> <Description>
A C# wrapper for the ubiquitous stb_image.h and stb_image_write.h library. A C# wrapper for the ubiquitous stb_image.h and stb_image_write.h library.
@ -21,6 +21,13 @@
<PackageReadmeFile>README.md</PackageReadmeFile> <PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile> <PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<PackageIcon>images\icon.png</PackageIcon> <PackageIcon>images\icon.png</PackageIcon>
<PackageProjectUrl>https://refuel.mixedup.dev/docs/ReFuel.StbImage.html</PackageProjectUrl>
<RepositoryUrl>https://git.mixedup.dev/ReFuel/ReFuel.StbImage</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>stb; stb_image; stbi; image; load; save; read; write</PackageTags>
<PackageReleaseNotes># 2.0.0
* Exposed stbi_image_write.h
* Moved native function calls to ReFuel.Stb.Native</PackageReleaseNotes>
</PropertyGroup> </PropertyGroup>
<!-- <!--
@ -30,8 +37,8 @@
that determines a lot of load paths for projects. that determines a lot of load paths for projects.
--> -->
<ItemGroup> <ItemGroup>
<Content Include="*.md" Pack="true" PackagePath="/"/> <Content Include="*.md" Pack="true" PackagePath="/" />
<None Include="rf_stbimage.png" Pack="true" PackagePath="images\icon.png"/> <None Include="rf_stbimage.png" Pack="true" PackagePath="images\icon.png" />
<Content Include="runtimes/linux-arm/native/*.so"> <Content Include="runtimes/linux-arm/native/*.so">
<PackagePath>runtimes/linux-arm/native/</PackagePath> <PackagePath>runtimes/linux-arm/native/</PackagePath>
<Pack>true</Pack> <Pack>true</Pack>

@ -98,13 +98,13 @@ namespace ReFuel.Stb
/// <summary> /// <summary>
/// An easy to use stream wrapper for STBI image write functions. /// An easy to use stream wrapper for STBI image write functions.
/// </summary> /// </summary>
/// <remarks>Keep struct alive for the duration of the write operation.</remarks> /// <remarks>Keep object alive for the duration of the write operation.</remarks>
public struct StbiWriteStreamWrapper public class StbiWriteStreamWrapper
{ {
private readonly Stream _stream; private readonly Stream _stream;
private readonly StbiWriteProc _cb; private readonly StbiWriteProc _cb;
public IntPtr Callback => Marshal.GetFunctionPointerForDelegate(_cb); public IntPtr Callback { get; };
public StbiWriteStreamWrapper(Stream stream) public StbiWriteStreamWrapper(Stream stream)
{ {
@ -113,6 +113,7 @@ namespace ReFuel.Stb
{ {
_cb = WriteCb; _cb = WriteCb;
} }
Callback = Marshal.GetFunctionPointerForDelegate(_cb);
} }
private unsafe void WriteCb(void *context, void *data, int size) private unsafe void WriteCb(void *context, void *data, int size)