mirror of
https://github.com/cccb/servicepoint.git
synced 2025-01-19 10:20:12 +01:00
250 lines
8.7 KiB
C#
250 lines
8.7 KiB
C#
|
// <auto-generated>
|
||
|
// This code is generated by csbindgen.
|
||
|
// DON'T CHANGE THIS DIRECTLY.
|
||
|
// </auto-generated>
|
||
|
#pragma warning disable CS8500
|
||
|
#pragma warning disable CS8981
|
||
|
using System;
|
||
|
using System.Runtime.InteropServices;
|
||
|
|
||
|
|
||
|
namespace ServicePoint.BindGen
|
||
|
{
|
||
|
public static unsafe partial class BitmapNative
|
||
|
{
|
||
|
const string __DllName = "servicepoint_binding_c";
|
||
|
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// Creates a new [SPBitmap] with the specified dimensions.
|
||
|
///
|
||
|
/// # Arguments
|
||
|
///
|
||
|
/// - `width`: size in pixels in x-direction
|
||
|
/// - `height`: size in pixels in y-direction
|
||
|
///
|
||
|
/// returns: [SPBitmap] initialized to all pixels off. Will never return NULL.
|
||
|
///
|
||
|
/// # Panics
|
||
|
///
|
||
|
/// - when the width is not dividable by 8
|
||
|
///
|
||
|
/// # Safety
|
||
|
///
|
||
|
/// The caller has to make sure that:
|
||
|
///
|
||
|
/// - the returned instance is freed in some way, either by using a consuming function or
|
||
|
/// by explicitly calling `sp_bitmap_free`.
|
||
|
/// </summary>
|
||
|
[DllImport(__DllName, EntryPoint = "sp_bitmap_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||
|
public static extern SPBitmap* sp_bitmap_new(nuint width, nuint height);
|
||
|
|
||
|
/// <summary>
|
||
|
/// Loads a [SPBitmap] with the specified dimensions from the provided data.
|
||
|
///
|
||
|
/// # Arguments
|
||
|
///
|
||
|
/// - `width`: size in pixels in x-direction
|
||
|
/// - `height`: size in pixels in y-direction
|
||
|
///
|
||
|
/// returns: [SPBitmap] that contains a copy of the provided data. Will never return NULL.
|
||
|
///
|
||
|
/// # Panics
|
||
|
///
|
||
|
/// - when `data` is NULL
|
||
|
/// - when the dimensions and data size do not match exactly.
|
||
|
/// - when the width is not dividable by 8
|
||
|
///
|
||
|
/// # Safety
|
||
|
///
|
||
|
/// The caller has to make sure that:
|
||
|
///
|
||
|
/// - `data` points to a valid memory location of at least `data_length` bytes in size.
|
||
|
/// - the returned instance is freed in some way, either by using a consuming function or
|
||
|
/// by explicitly calling `sp_bitmap_free`.
|
||
|
/// </summary>
|
||
|
[DllImport(__DllName, EntryPoint = "sp_bitmap_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||
|
public static extern SPBitmap* sp_bitmap_load(nuint width, nuint height, byte* data, nuint data_length);
|
||
|
|
||
|
/// <summary>
|
||
|
/// Clones a [SPBitmap].
|
||
|
///
|
||
|
/// Will never return NULL.
|
||
|
///
|
||
|
/// # Panics
|
||
|
///
|
||
|
/// - when `bitmap` is NULL
|
||
|
///
|
||
|
/// # Safety
|
||
|
///
|
||
|
/// The caller has to make sure that:
|
||
|
///
|
||
|
/// - `bitmap` points to a valid [SPBitmap]
|
||
|
/// - `bitmap` is not written to concurrently
|
||
|
/// - the returned instance is freed in some way, either by using a consuming function or
|
||
|
/// by explicitly calling `sp_bitmap_free`.
|
||
|
/// </summary>
|
||
|
[DllImport(__DllName, EntryPoint = "sp_bitmap_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||
|
public static extern SPBitmap* sp_bitmap_clone(SPBitmap* bitmap);
|
||
|
|
||
|
/// <summary>
|
||
|
/// Deallocates a [SPBitmap].
|
||
|
///
|
||
|
/// # Panics
|
||
|
///
|
||
|
/// - when `bitmap` is NULL
|
||
|
///
|
||
|
/// # Safety
|
||
|
///
|
||
|
/// The caller has to make sure that:
|
||
|
///
|
||
|
/// - `bitmap` points to a valid [SPBitmap]
|
||
|
/// - `bitmap` is not used concurrently or after bitmap call
|
||
|
/// - `bitmap` was not passed to another consuming function, e.g. to create a [SPCommand]
|
||
|
/// </summary>
|
||
|
[DllImport(__DllName, EntryPoint = "sp_bitmap_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||
|
public static extern void sp_bitmap_free(SPBitmap* bitmap);
|
||
|
|
||
|
/// <summary>
|
||
|
/// Gets the current value at the specified position in the [SPBitmap].
|
||
|
///
|
||
|
/// # Arguments
|
||
|
///
|
||
|
/// - `bitmap`: instance to read from
|
||
|
/// - `x` and `y`: position of the cell to read
|
||
|
///
|
||
|
/// # Panics
|
||
|
///
|
||
|
/// - when `bitmap` is NULL
|
||
|
/// - when accessing `x` or `y` out of bounds
|
||
|
///
|
||
|
/// # Safety
|
||
|
///
|
||
|
/// The caller has to make sure that:
|
||
|
///
|
||
|
/// - `bitmap` points to a valid [SPBitmap]
|
||
|
/// - `bitmap` is not written to concurrently
|
||
|
/// </summary>
|
||
|
[DllImport(__DllName, EntryPoint = "sp_bitmap_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||
|
[return: MarshalAs(UnmanagedType.U1)]
|
||
|
public static extern bool sp_bitmap_get(SPBitmap* bitmap, nuint x, nuint y);
|
||
|
|
||
|
/// <summary>
|
||
|
/// Sets the value of the specified position in the [SPBitmap].
|
||
|
///
|
||
|
/// # Arguments
|
||
|
///
|
||
|
/// - `bitmap`: instance to write to
|
||
|
/// - `x` and `y`: position of the cell
|
||
|
/// - `value`: the value to write to the cell
|
||
|
///
|
||
|
/// returns: old value of the cell
|
||
|
///
|
||
|
/// # Panics
|
||
|
///
|
||
|
/// - when `bitmap` is NULL
|
||
|
/// - when accessing `x` or `y` out of bounds
|
||
|
///
|
||
|
/// # Safety
|
||
|
///
|
||
|
/// The caller has to make sure that:
|
||
|
///
|
||
|
/// - `bitmap` points to a valid [SPBitmap]
|
||
|
/// - `bitmap` is not written to or read from concurrently
|
||
|
/// </summary>
|
||
|
[DllImport(__DllName, EntryPoint = "sp_bitmap_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||
|
public static extern void sp_bitmap_set(SPBitmap* bitmap, nuint x, nuint y, [MarshalAs(UnmanagedType.U1)] bool value);
|
||
|
|
||
|
/// <summary>
|
||
|
/// Sets the state of all pixels in the [SPBitmap].
|
||
|
///
|
||
|
/// # Arguments
|
||
|
///
|
||
|
/// - `bitmap`: instance to write to
|
||
|
/// - `value`: the value to set all pixels to
|
||
|
///
|
||
|
/// # Panics
|
||
|
///
|
||
|
/// - when `bitmap` is NULL
|
||
|
///
|
||
|
/// # Safety
|
||
|
///
|
||
|
/// The caller has to make sure that:
|
||
|
///
|
||
|
/// - `bitmap` points to a valid [SPBitmap]
|
||
|
/// - `bitmap` is not written to or read from concurrently
|
||
|
/// </summary>
|
||
|
[DllImport(__DllName, EntryPoint = "sp_bitmap_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||
|
public static extern void sp_bitmap_fill(SPBitmap* bitmap, [MarshalAs(UnmanagedType.U1)] bool value);
|
||
|
|
||
|
/// <summary>
|
||
|
/// Gets the width in pixels of the [SPBitmap] instance.
|
||
|
///
|
||
|
/// # Arguments
|
||
|
///
|
||
|
/// - `bitmap`: instance to read from
|
||
|
///
|
||
|
/// # Panics
|
||
|
///
|
||
|
/// - when `bitmap` is NULL
|
||
|
///
|
||
|
/// # Safety
|
||
|
///
|
||
|
/// The caller has to make sure that:
|
||
|
///
|
||
|
/// - `bitmap` points to a valid [SPBitmap]
|
||
|
/// </summary>
|
||
|
[DllImport(__DllName, EntryPoint = "sp_bitmap_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||
|
public static extern nuint sp_bitmap_width(SPBitmap* bitmap);
|
||
|
|
||
|
/// <summary>
|
||
|
/// Gets the height in pixels of the [SPBitmap] instance.
|
||
|
///
|
||
|
/// # Arguments
|
||
|
///
|
||
|
/// - `bitmap`: instance to read from
|
||
|
///
|
||
|
/// # Panics
|
||
|
///
|
||
|
/// - when `bitmap` is NULL
|
||
|
///
|
||
|
/// # Safety
|
||
|
///
|
||
|
/// The caller has to make sure that:
|
||
|
///
|
||
|
/// - `bitmap` points to a valid [SPBitmap]
|
||
|
/// </summary>
|
||
|
[DllImport(__DllName, EntryPoint = "sp_bitmap_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||
|
public static extern nuint sp_bitmap_height(SPBitmap* bitmap);
|
||
|
|
||
|
/// <summary>
|
||
|
/// Gets an unsafe reference to the data of the [SPBitmap] instance.
|
||
|
///
|
||
|
/// # Panics
|
||
|
///
|
||
|
/// - when `bitmap` is NULL
|
||
|
///
|
||
|
/// # Safety
|
||
|
///
|
||
|
/// The caller has to make sure that:
|
||
|
///
|
||
|
/// - `bitmap` points to a valid [SPBitmap]
|
||
|
/// - the returned memory range is never accessed after the passed [SPBitmap] has been freed
|
||
|
/// - the returned memory range is never accessed concurrently, either via the [SPBitmap] or directly
|
||
|
/// </summary>
|
||
|
[DllImport(__DllName, EntryPoint = "sp_bitmap_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||
|
public static extern SPByteSlice sp_bitmap_unsafe_data_ref(SPBitmap* bitmap);
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
[StructLayout(LayoutKind.Sequential)]
|
||
|
public unsafe partial struct SPBitmap
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|