6 Commits

Author SHA1 Message Date
ff83cb20f9 Enabled optimzations.
All checks were successful
Build / build (push) Successful in 2m2s
2024-07-23 23:21:12 +03:00
themixedupstuff
3801bc29f8 Update ReFuel.StbImage.csproj
All checks were successful
Build / build (push) Successful in 1m36s
2024-06-29 13:34:59 +02:00
bcd82900c7 Add STBIWDEF as RFEXTERN to build C file.
All checks were successful
Build / build (push) Successful in 1m35s
2024-06-19 12:19:33 +03:00
e759efacf6 [2.0.0-rc.2] Fix global options to be static.
All checks were successful
Build / build (push) Successful in 1m37s
2024-06-19 12:05:54 +03:00
d9a9e3962f Fix build error on older c# versions.
All checks were successful
Build / build (push) Successful in 1m35s
2024-06-19 11:50:36 +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
8 changed files with 28 additions and 14 deletions

View File

@@ -5,6 +5,7 @@ project(rf_stbi LANGUAGES C VERSION 1.0)
if (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")) if (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin"))
add_compile_options(-static-libgcc -static-libstdc++ -fno-exceptions) add_compile_options(-static-libgcc -static-libstdc++ -fno-exceptions)
endif() endif()
add_compile_options(-O3)
add_library(stbi SHARED "rf_stbi.c") add_library(stbi SHARED "rf_stbi.c")
install( install(

View File

@@ -1,19 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<RuntimeIdentifiers>linux-arm;linux-arm64;linux-x64;win-x86;win-x64;osx-arm64;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>linux-arm;linux-arm64;linux-x64;win-x86;win-x64;osx-arm64;osx-x64</RuntimeIdentifiers>
<RootNamespace>ReFuel.Stb</RootNamespace> <RootNamespace>ReFuel.Stb</RootNamespace>
<Optimize>true</Optimize>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<!-- 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.1</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 +22,16 @@
<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.1
* Enabled optimizations across the board for native and managed assemblies.
# 2.0.0
* Exposed stbi_image_write.h
* Moved native function calls to ReFuel.Stb.Native</PackageReleaseNotes>
</PropertyGroup> </PropertyGroup>
<!-- <!--

View File

@@ -157,7 +157,7 @@ namespace ReFuel.Stb
/// <remarks> /// <remarks>
/// -1 for auto, 0 through 5 to pick a filter. Higher is more. Not thread safe. /// -1 for auto, 0 through 5 to pick a filter. Higher is more. Not thread safe.
/// </remarks> /// </remarks>
public int WriteForcePngFilter public static int WriteForcePngFilter
{ {
get => Stbi.write_force_png_filter; get => Stbi.write_force_png_filter;
set set
@@ -177,7 +177,7 @@ namespace ReFuel.Stb
/// <remarks> /// <remarks>
/// Higher is more. Defaults to 8. Not thread safe. /// Higher is more. Defaults to 8. Not thread safe.
/// </remarks> /// </remarks>
public int WritePngCompressionLevel public static int WritePngCompressionLevel
{ {
get => Stbi.write_png_compression_level; get => Stbi.write_png_compression_level;
set => Stbi.write_png_compression_level = value; set => Stbi.write_png_compression_level = value;
@@ -189,7 +189,7 @@ namespace ReFuel.Stb
/// <remarks> /// <remarks>
/// Not thread safe. /// Not thread safe.
/// </remarks> /// </remarks>
public bool WriteTgaEnableRLE public static bool WriteTgaEnableRLE
{ {
get => Stbi.write_tga_with_rle != 0; get => Stbi.write_tga_with_rle != 0;
set => Stbi.write_tga_with_rle = value ? 1 : 0; set => Stbi.write_tga_with_rle = value ? 1 : 0;

View File

@@ -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)

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
cd $(dirname "$0") cd $(dirname "$0")
./docker-cross-compiler/sh/build_native.sh . ./docker-cross-compiler/sh/build_native.sh .
dotnet build dotnet build -c Release

View File

@@ -7,6 +7,7 @@
#define STBI_NO_THREAD_LOCALS 1 #define STBI_NO_THREAD_LOCALS 1
#include "stb/stb_image.h" #include "stb/stb_image.h"
#define STBIWDEF RFEXTERN
#define STBI_WRITE_NO_STDIO 1 #define STBI_WRITE_NO_STDIO 1
#include "stb/stb_image_write.h" #include "stb/stb_image_write.h"

2
stb

Submodule stb updated: 013ac3bedd...f7f20f39fe