diff --git a/crates/servicepoint_binding_cs/ServicePoint/BindGen/ServicePoint.g.cs b/crates/servicepoint_binding_cs/ServicePoint/BindGen/ServicePoint.g.cs
index 2575057..009de2d 100644
--- a/crates/servicepoint_binding_cs/ServicePoint/BindGen/ServicePoint.g.cs
+++ b/crates/servicepoint_binding_cs/ServicePoint/BindGen/ServicePoint.g.cs
@@ -167,7 +167,7 @@ namespace ServicePoint.BindGen
/// Allocates a new `Command::CharBrightness` instance. The passed `ByteGrid` gets consumed. # Safety The caller has to make sure that: - `byte_grid` points to a valid instance of `ByteGrid` - `byte_grid` is not used concurrently or after this call - the returned `Command` instance is freed in some way, either by using a consuming function or by explicitly calling `sp_command_dealloc`.
[DllImport(__DllName, EntryPoint = "sp_command_char_brightness", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- public static extern Command* sp_command_char_brightness(nuint x, nuint y, BrightnessGrid* byte_grid);
+ public static extern Command* sp_command_char_brightness(nuint x, nuint y, CBrightnessGrid* byte_grid);
/// Allocates a new `Command::BitmapLinear` instance. The passed `BitVec` gets consumed. # Safety The caller has to make sure that: - `bit_vec` points to a valid instance of `BitVec` - `bit_vec` is not used concurrently or after this call - `compression` matches one of the allowed enum values - the returned `Command` instance is freed in some way, either by using a consuming function or by explicitly calling `sp_command_dealloc`.
[DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@@ -187,7 +187,7 @@ namespace ServicePoint.BindGen
/// Allocates a new `Command::Cp437Data` instance. The passed `ByteGrid` gets consumed. # Safety The caller has to make sure that: - `byte_grid` points to a valid instance of `ByteGrid` - `byte_grid` is not used concurrently or after this call - the returned `Command` instance is freed in some way, either by using a consuming function or by explicitly calling `sp_command_dealloc`.
[DllImport(__DllName, EntryPoint = "sp_command_cp437_data", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- public static extern Command* sp_command_cp437_data(nuint x, nuint y, PrimitiveGrid* byte_grid);
+ public static extern Command* sp_command_cp437_data(nuint x, nuint y, CCp437Grid* byte_grid);
/// Allocates a new `Command::BitmapLinearWin` instance. The passed `PixelGrid` gets consumed. # Safety The caller has to make sure that: - `pixel_grid` points to a valid instance of `PixelGrid` - `pixel_grid` is not used concurrently or after this call - `compression` matches one of the allowed enum values - the returned `Command` instance is freed in some way, either by using a consuming function or by explicitly calling `sp_command_dealloc`.
[DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_win", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@@ -288,11 +288,6 @@ namespace ServicePoint.BindGen
public nuint length;
}
- [StructLayout(LayoutKind.Sequential)]
- public unsafe partial struct PrimitiveGrid
- {
- }
-
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Connection
{
diff --git a/crates/servicepoint_binding_cs/ServicePoint/BrightnessGrid.cs b/crates/servicepoint_binding_cs/ServicePoint/BrightnessGrid.cs
new file mode 100644
index 0000000..36af6e0
--- /dev/null
+++ b/crates/servicepoint_binding_cs/ServicePoint/BrightnessGrid.cs
@@ -0,0 +1,103 @@
+using ServicePoint.BindGen;
+
+namespace ServicePoint;
+
+public sealed class BrightnessGrid : SpNativeInstance
+{
+ public static BrightnessGrid New(int width, int height)
+ {
+ unsafe
+ {
+ return new BrightnessGrid(NativeMethods.sp_brightness_grid_new((nuint)width, (nuint)height));
+ }
+ }
+
+ public static BrightnessGrid Load(int width, int height, Span bytes)
+ {
+ unsafe
+ {
+ fixed (byte* bytesPtr = bytes)
+ {
+ return new BrightnessGrid(NativeMethods.sp_brightness_grid_load((nuint)width, (nuint)height, bytesPtr,
+ (nuint)bytes.Length));
+ }
+ }
+ }
+
+ public BrightnessGrid Clone()
+ {
+ unsafe
+ {
+ return new BrightnessGrid(NativeMethods.sp_brightness_grid_clone(Instance));
+ }
+ }
+
+ public byte this[int x, int y]
+ {
+ get
+ {
+ unsafe
+ {
+ return NativeMethods.sp_brightness_grid_get(Instance, (nuint)x, (nuint)y);
+ }
+ }
+ set
+ {
+ unsafe
+ {
+ NativeMethods.sp_brightness_grid_set(Instance, (nuint)x, (nuint)y, value);
+ }
+ }
+ }
+
+ public void Fill(byte value)
+ {
+ unsafe
+ {
+ NativeMethods.sp_brightness_grid_fill(Instance, value);
+ }
+ }
+
+ public int Width
+ {
+ get
+ {
+ unsafe
+ {
+ return (int)NativeMethods.sp_brightness_grid_width(Instance);
+ }
+ }
+ }
+
+ public int Height
+ {
+ get
+ {
+ unsafe
+ {
+ return (int)NativeMethods.sp_brightness_grid_height(Instance);
+ }
+ }
+ }
+
+ public Span Data
+ {
+ get
+ {
+ unsafe
+ {
+ var slice = NativeMethods.sp_brightness_grid_unsafe_data_ref(Instance);
+ return new Span(slice.start, (int)slice.length);
+ }
+ }
+ }
+
+ private unsafe BrightnessGrid(BindGen.CBrightnessGrid* instance) : base(instance)
+ {
+ }
+
+ private protected override unsafe void Dealloc()
+ {
+ NativeMethods.sp_brightness_grid_dealloc(Instance);
+ }
+}
diff --git a/crates/servicepoint_binding_cs/ServicePoint/Command.cs b/crates/servicepoint_binding_cs/ServicePoint/Command.cs
index b9d0d3c..a0349c8 100644
--- a/crates/servicepoint_binding_cs/ServicePoint/Command.cs
+++ b/crates/servicepoint_binding_cs/ServicePoint/Command.cs
@@ -61,7 +61,7 @@ public sealed class Command : SpNativeInstance
}
}
- public static Command CharBrightness(int x, int y, ByteGrid grid)
+ public static Command CharBrightness(int x, int y, BrightnessGrid grid)
{
unsafe
{
@@ -113,7 +113,7 @@ public sealed class Command : SpNativeInstance
}
}
- public static Command Cp437Data(int x, int y, ByteGrid byteGrid)
+ public static Command Cp437Data(int x, int y, Cp437Grid byteGrid)
{
unsafe
{
diff --git a/crates/servicepoint_binding_cs/ServicePoint/ByteGrid.cs b/crates/servicepoint_binding_cs/ServicePoint/Cp437Grid.cs
similarity index 62%
rename from crates/servicepoint_binding_cs/ServicePoint/ByteGrid.cs
rename to crates/servicepoint_binding_cs/ServicePoint/Cp437Grid.cs
index e6c4fdc..01a83fb 100644
--- a/crates/servicepoint_binding_cs/ServicePoint/ByteGrid.cs
+++ b/crates/servicepoint_binding_cs/ServicePoint/Cp437Grid.cs
@@ -3,33 +3,33 @@ using ServicePoint.BindGen;
namespace ServicePoint;
-public sealed class ByteGrid : SpNativeInstance
+public sealed class Cp437Grid : SpNativeInstance
{
- public static ByteGrid New(int width, int height)
+ public static Cp437Grid New(int width, int height)
{
unsafe
{
- return new ByteGrid(NativeMethods.sp_byte_grid_new((nuint)width, (nuint)height));
+ return new Cp437Grid(NativeMethods.sp_cp437_grid_new((nuint)width, (nuint)height));
}
}
- public static ByteGrid Load(int width, int height, Span bytes)
+ public static Cp437Grid Load(int width, int height, Span bytes)
{
unsafe
{
fixed (byte* bytesPtr = bytes)
{
- return new ByteGrid(NativeMethods.sp_byte_grid_load((nuint)width, (nuint)height, bytesPtr,
+ return new Cp437Grid(NativeMethods.sp_cp437_grid_load((nuint)width, (nuint)height, bytesPtr,
(nuint)bytes.Length));
}
}
}
- public ByteGrid Clone()
+ public Cp437Grid Clone()
{
unsafe
{
- return new ByteGrid(NativeMethods.sp_byte_grid_clone(Instance));
+ return new Cp437Grid(NativeMethods.sp_cp437_grid_clone(Instance));
}
}
@@ -39,14 +39,14 @@ public sealed class ByteGrid : SpNativeInstance
{
unsafe
{
- return NativeMethods.sp_byte_grid_get(Instance, (nuint)x, (nuint)y);
+ return NativeMethods.sp_cp437_grid_get(Instance, (nuint)x, (nuint)y);
}
}
set
{
unsafe
{
- NativeMethods.sp_byte_grid_set(Instance, (nuint)x, (nuint)y, value);
+ NativeMethods.sp_cp437_grid_set(Instance, (nuint)x, (nuint)y, value);
}
}
}
@@ -85,7 +85,7 @@ public sealed class ByteGrid : SpNativeInstance
{
unsafe
{
- NativeMethods.sp_byte_grid_fill(Instance, value);
+ NativeMethods.sp_cp437_grid_fill(Instance, value);
}
}
@@ -95,7 +95,7 @@ public sealed class ByteGrid : SpNativeInstance
{
unsafe
{
- return (int)NativeMethods.sp_byte_grid_width(Instance);
+ return (int)NativeMethods.sp_cp437_grid_width(Instance);
}
}
}
@@ -106,7 +106,7 @@ public sealed class ByteGrid : SpNativeInstance
{
unsafe
{
- return (int)NativeMethods.sp_byte_grid_height(Instance);
+ return (int)NativeMethods.sp_cp437_grid_height(Instance);
}
}
}
@@ -117,18 +117,18 @@ public sealed class ByteGrid : SpNativeInstance
{
unsafe
{
- var slice = NativeMethods.sp_byte_grid_unsafe_data_ref(Instance);
+ var slice = NativeMethods.sp_cp437_grid_unsafe_data_ref(Instance);
return new Span(slice.start, (int)slice.length);
}
}
}
- private unsafe ByteGrid(BindGen.ByteGrid* instance) : base(instance)
+ private unsafe Cp437Grid(BindGen.CCp437Grid* instance) : base(instance)
{
}
private protected override unsafe void Dealloc()
{
- NativeMethods.sp_byte_grid_dealloc(Instance);
+ NativeMethods.sp_cp437_grid_dealloc(Instance);
}
}
diff --git a/crates/servicepoint_binding_cs/ServicePoint/ServicePoint.csproj b/crates/servicepoint_binding_cs/ServicePoint/ServicePoint.csproj
index 4285c10..f16fffb 100644
--- a/crates/servicepoint_binding_cs/ServicePoint/ServicePoint.csproj
+++ b/crates/servicepoint_binding_cs/ServicePoint/ServicePoint.csproj
@@ -7,7 +7,6 @@
true
true
- true
@@ -35,7 +34,7 @@
-
+
diff --git a/crates/servicepoint_binding_cs/build.rs b/crates/servicepoint_binding_cs/build.rs
index 0cb37b0..ec2744e 100644
--- a/crates/servicepoint_binding_cs/build.rs
+++ b/crates/servicepoint_binding_cs/build.rs
@@ -13,7 +13,6 @@ fn main() {
.input_extern_file("../servicepoint_binding_c/src/lib.rs")
.input_extern_file("../servicepoint_binding_c/src/c_slice.rs")
.input_extern_file("../servicepoint_binding_c/src/packet.rs")
- .input_extern_file("../servicepoint/src/primitive_grid.rs")
.input_extern_file("../servicepoint/src/command.rs")
.input_extern_file("../servicepoint/src/connection.rs")
.input_extern_file("../servicepoint/src/pixel_grid.rs")