First Commit

This commit is contained in:
reinard.setiadji@formulatrix.com 2025-08-01 15:29:06 +07:00
parent bb40883c7d
commit 696158848f
18 changed files with 787 additions and 0 deletions

View file

@ -0,0 +1,26 @@
namespace StitchATon.Utility;
public class Grid2D<T>
{
private T[] _buffer;
public readonly int W;
public readonly int H;
public Grid2D( int width, int height )
{
W = width;
H = height;
_buffer = new T[W * H];
}
private int Map( int x, int y )
{
return x + ( y * W );
}
public T this[ int x, int y ]
{
get => _buffer[Map( x, y )];
set => _buffer[Map( x, y )] = value;
}
}

View file

@ -0,0 +1,22 @@
using System.Diagnostics;
namespace StitchATon.Utility;
public class PngNamedPipe : IDisposable
{
private ProcessStartInfo _mkfifoPs = new("mkfifo");
private ProcessStartInfo _rmfifoPs = new("rm");
public readonly string PipeFullname = Path.Join( Path.GetTempPath(), Guid.NewGuid() + ".png" );
public PngNamedPipe( )
{
_mkfifoPs.Arguments = PipeFullname;
Process.Start( _mkfifoPs )?.WaitForExit();
}
public void Dispose()
{
_rmfifoPs.Arguments = PipeFullname;
Process.Start( _rmfifoPs );
}
}