These dependencies have been moved into their own repositories.
65
Dockerfile
@ -1,65 +0,0 @@
|
||||
# This is going to create an environment for you to cross compile all the
|
||||
# packages needed to build this project.
|
||||
#
|
||||
# As always, debian > ubuntu <3
|
||||
FROM debian:stable-slim
|
||||
WORKDIR /root
|
||||
|
||||
# Set host name.
|
||||
RUN echo quik_docker_env > /etc/hostname
|
||||
|
||||
# Download and Install dependencies.
|
||||
# Install WGET
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y sudo wget
|
||||
|
||||
# Add the .NET package repository to the repository listing.
|
||||
RUN wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
|
||||
RUN dpkg -i packages-microsoft-prod.deb
|
||||
RUN rm packages-microsoft-prod.deb
|
||||
|
||||
# APT dependencies.
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y \
|
||||
build-essential \
|
||||
bzip2 \
|
||||
cmake \
|
||||
clang \
|
||||
cpio \
|
||||
dotnet-sdk-6.0 \
|
||||
gcc-arm-linux-gnueabihf \
|
||||
gcc-aarch64-linux-gnu \
|
||||
gcc-i686-linux-gnu \
|
||||
git \
|
||||
libharfbuzz-dev \
|
||||
libpng-dev \
|
||||
libssl-dev \
|
||||
libxml2-dev \
|
||||
lzma-dev \
|
||||
mingw-w64 \
|
||||
nuget \
|
||||
ninja-build \
|
||||
patch \
|
||||
python3 \
|
||||
xz-utils \
|
||||
zlib1g-dev
|
||||
|
||||
# Clone osxcross
|
||||
# Let's do this later.
|
||||
# RUN git clone https://github.com/tpoechtrager/osxcross.git osxcross
|
||||
|
||||
# Setup interactive shell.
|
||||
# Setup sudo. Remove password prompt for group "wheel".
|
||||
RUN echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/quik_sudo_conf
|
||||
|
||||
# Create a default user and switch.
|
||||
RUN adduser --comment "" --disabled-password quik
|
||||
USER quik
|
||||
WORKDIR /home/quik
|
||||
|
||||
# Copy bashrc
|
||||
RUN cp /etc/bash.bashrc ~/.bashrc
|
||||
RUN echo source $HOME/src/sh/bashrc.sh >> ~/.bashrc
|
||||
|
||||
# Execute an interactive shell.
|
||||
CMD bash
|
@ -1,120 +0,0 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Quik.FreeType
|
||||
{
|
||||
public static class FT
|
||||
{
|
||||
private const string freetype2 = "freetype";
|
||||
|
||||
private static readonly string[] LibraryNames = new string[]
|
||||
{
|
||||
//FIXME: This is wrong on so many levels, but, i need to do this
|
||||
// in order to get a change of this running.
|
||||
"runtimes/win-x64/native/libfreetype.dll",
|
||||
"runtimes/win-x86/native/libfreetype.dll",
|
||||
"runtimes/linux-arm/native/libfreetype.so",
|
||||
"runtimes/linux-arm64/native/libfreetype.so",
|
||||
"runtimes/linux-x64/native/libfreetype.so",
|
||||
"runtimes/native/libfreetype.dylib",
|
||||
"libfreetype.dll",
|
||||
"libfreetype.so",
|
||||
"libfreetype.dylib",
|
||||
};
|
||||
|
||||
static FT()
|
||||
{
|
||||
NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), Resolver);
|
||||
}
|
||||
|
||||
private static IntPtr Resolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
|
||||
{
|
||||
if (libraryName != freetype2)
|
||||
return IntPtr.Zero;
|
||||
|
||||
foreach (string name in LibraryNames)
|
||||
{
|
||||
if (NativeLibrary.TryLoad(name, assembly, searchPath, out IntPtr handle))
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
return NativeLibrary.Load(libraryName);
|
||||
}
|
||||
|
||||
[DllImport(freetype2, EntryPoint = "FT_Init_FreeType")]
|
||||
public static extern FTError InitFreeType(out FTLibrary library);
|
||||
|
||||
[DllImport(freetype2, EntryPoint = "FT_Done_FreeType")]
|
||||
public static extern FTError DoneFreeType(FTLibrary library);
|
||||
|
||||
[DllImport(freetype2, EntryPoint = "FT_New_Face")]
|
||||
public static extern FTError NewFace(
|
||||
FTLibrary library,
|
||||
[MarshalAs(UnmanagedType.LPStr)] string path,
|
||||
long faceIndex,
|
||||
out FTFace face);
|
||||
|
||||
[DllImport(freetype2, EntryPoint = "FT_New_Memory_Face")]
|
||||
public static extern FTError NewMemoryFace(
|
||||
FTLibrary library,
|
||||
IntPtr buffer,
|
||||
long size,
|
||||
long faceIndex,
|
||||
out FTFace face);
|
||||
|
||||
[DllImport(freetype2, EntryPoint = "FT_New_Memory_Face")]
|
||||
public static extern FTError NewMemoryFace(
|
||||
FTLibrary library,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
|
||||
long size,
|
||||
long faceIndex,
|
||||
out FTFace face);
|
||||
|
||||
[DllImport(freetype2, EntryPoint = "FT_New_Memory_Face")]
|
||||
public static extern FTError NewMemoryFace(
|
||||
FTLibrary library,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] Span<byte> buffer,
|
||||
long size,
|
||||
long faceIndex,
|
||||
out FTFace face);
|
||||
|
||||
// public static extern FTError OpenFace(FTLibrary library, in FTOpenArgs args, long faceIndex, out FTFace face);
|
||||
|
||||
// [DllImport(freetype2, EntryPoint = "FT_Attach_File")]
|
||||
// public static extern FTError AttachFile(FTFace face, [MarshalAs(UnmanagedType.LPStr)] string filePathName);
|
||||
|
||||
[DllImport(freetype2, EntryPoint = "FT_Set_Char_Size")]
|
||||
public static extern FTError SetCharSize(
|
||||
FTFace library,
|
||||
long charWidth,
|
||||
long charHeight,
|
||||
uint horizontalResolution,
|
||||
uint verticalResolution);
|
||||
|
||||
|
||||
[DllImport(freetype2, EntryPoint = "FT_Get_Char_Index")]
|
||||
public static extern uint GetCharIndex(FTFace face, ulong charCode);
|
||||
|
||||
[DllImport(freetype2, EntryPoint = "FT_Load_Glyph")]
|
||||
public static extern FTError LoadGlyph(FTFace face, uint charIndex, FTLoadFlags flags);
|
||||
|
||||
[DllImport(freetype2, EntryPoint = "FT_Render_Glyph")]
|
||||
public static extern FTError RenderGlyph(FTGlyphSlot slot, FTRenderMode mode);
|
||||
|
||||
[DllImport(freetype2, EntryPoint = "FT_Done_Face")]
|
||||
public static extern FTError DoneFace(FTFace face);
|
||||
|
||||
[DllImport(freetype2, EntryPoint = "FT_Bitmap_Init")]
|
||||
public static extern void BitmapInit(ref FTBitmap bitmap);
|
||||
|
||||
[DllImport(freetype2, EntryPoint = "FT_Bitmap_Convert")]
|
||||
public static extern void BitmapConvert(FTLibrary library, in FTBitmap source, ref FTBitmap target,
|
||||
int alignment);
|
||||
|
||||
[DllImport(freetype2, EntryPoint = "FT_Bitmap_Done")]
|
||||
public static extern void BitmapDone(FTLibrary library, ref FTBitmap bitmap);
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
namespace Quik.FreeType
|
||||
{
|
||||
public enum FTError : int
|
||||
{
|
||||
None = 0,
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Quik.FreeType
|
||||
{
|
||||
[Flags]
|
||||
public enum FTLoadFlags
|
||||
{
|
||||
Default = 0,
|
||||
NoScale = 1 << 0,
|
||||
NoHinting = 1 << 1,
|
||||
Render = 1 << 2,
|
||||
NoBitmap = 1 << 3,
|
||||
VerticalLayout = 1 << 4,
|
||||
ForceAutoHint = 1 << 5,
|
||||
CropBitmap = 1 << 6,
|
||||
Pedantic = 1 << 7,
|
||||
IgnoreGlobalAdvanceWidth = 1 << 9,
|
||||
NoRecurse = 1 << 10,
|
||||
IgnoreTransform = 1 << 11,
|
||||
Monochrome= 1 << 12,
|
||||
LinearDesign = 1 << 13,
|
||||
SbitsOnly = 1 << 14,
|
||||
NoAutoHint = 1 << 15,
|
||||
Color = 1 << 20,
|
||||
ComputeMetrics = 1 << 21,
|
||||
BitmapMetricsOnly = 1 << 22
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
namespace Quik.FreeType
|
||||
{
|
||||
public enum FTRenderMode
|
||||
{
|
||||
Normal = 0,
|
||||
Light,
|
||||
Mono,
|
||||
Lcd,
|
||||
LcdVertical,
|
||||
Sdf
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Quik.FreeType
|
||||
{
|
||||
[Flags]
|
||||
public enum FaceFlag : int
|
||||
{
|
||||
Scalable = 1 << 0,
|
||||
FixedSizes = 1 << 1,
|
||||
FixedWidth = 1 << 2,
|
||||
Sfnt = 1 << 3,
|
||||
Horizontal = 1 << 4,
|
||||
Vertical = 1 << 5,
|
||||
Kerning = 1 << 6,
|
||||
FastGlyphs = 1 << 7,
|
||||
MultipleMasters = 1 << 8,
|
||||
GlyphNames = 1 << 9,
|
||||
ExternalStream = 1 << 10,
|
||||
Hinter = 1 << 11,
|
||||
CidKeyed = 1 << 12,
|
||||
Tricky = 1 << 13,
|
||||
Color = 1 << 14,
|
||||
Variation = 1 << 15,
|
||||
Svg = 1 << 16,
|
||||
Sbix = 1 << 17,
|
||||
SbixOverlay = 1 << 18
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<RuntimeIdentifiers>linux-arm;linux-arm64;linux-x64;win-x86;win-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Nuget Properties. -->
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<PackageId>Quik.FreeType</PackageId>
|
||||
<Version>1.0.0</Version>
|
||||
<Authors>FreeType Authors, H. Utku Maden</Authors>
|
||||
<Description>
|
||||
A C# wrapper for the FreeType font loading library.
|
||||
</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="runtimes/**">
|
||||
<PackagePath>runtimes</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,183 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Disable unused warnings for native types.
|
||||
#pragma warning disable CS0649
|
||||
|
||||
namespace Quik.FreeType
|
||||
{
|
||||
public struct FTLibrary
|
||||
{
|
||||
private IntPtr _handle;
|
||||
public IntPtr Handle => _handle;
|
||||
}
|
||||
|
||||
public unsafe struct FTFace
|
||||
{
|
||||
private IntPtr _handle;
|
||||
public IntPtr Handle => _handle;
|
||||
private unsafe FTFaceInternal* Ptr => (FTFaceInternal*)_handle;
|
||||
|
||||
public long NumberOfGlyphs => Ptr->NumberOfGlyphs;
|
||||
public long FaceIndex => Ptr->FaceIndex;
|
||||
public FaceFlag FaceFlags => (FaceFlag)Ptr->FaceFlags;
|
||||
public long StyleFlags => Ptr->StyleFlags;
|
||||
public string FamilyName => Marshal.PtrToStringUTF8(Ptr->FamilyName);
|
||||
public string StyleName => Marshal.PtrToStringUTF8(Ptr->StyleName);
|
||||
public int NumberOfFixedSizes => Ptr->NumberOfFixedSizes;
|
||||
public int NumberOfCharMaps => Ptr->NumberOfCharMaps;
|
||||
public FTGlyphSlot Glyph => Ptr->Glyph;
|
||||
public short Ascender => Ptr->Ascender;
|
||||
public short Descender => Ptr->Descender;
|
||||
public ref readonly FTSizeMetrics ScaledSize => ref ((FTSize*)Ptr->Size)->Metrics;
|
||||
}
|
||||
|
||||
public struct FTBox
|
||||
{
|
||||
public long XMin;
|
||||
public long YMin;
|
||||
public long XMax;
|
||||
public long YMax;
|
||||
}
|
||||
|
||||
internal struct FTFaceInternal
|
||||
{
|
||||
public long NumberOfFaces;
|
||||
public long FaceIndex;
|
||||
public long FaceFlags;
|
||||
public long StyleFlags;
|
||||
public long NumberOfGlyphs;
|
||||
public IntPtr FamilyName;
|
||||
public IntPtr StyleName;
|
||||
public int NumberOfFixedSizes;
|
||||
public IntPtr AvailableSizes;
|
||||
public int NumberOfCharMaps;
|
||||
public IntPtr Charmaps;
|
||||
public FTGeneric Generic;
|
||||
public FTBox BoundingBox;
|
||||
public ushort UnitsPerEm;
|
||||
public short Ascender;
|
||||
public short Descender;
|
||||
public short Height;
|
||||
public short MaxAdvanceWidth;
|
||||
public short MaxAdvanceHeight;
|
||||
public short UnderlinePosition;
|
||||
public short UnderlineThickness;
|
||||
public FTGlyphSlot Glyph;
|
||||
public IntPtr Size;
|
||||
public IntPtr Charmap;
|
||||
|
||||
// Rest of the struct is private to implementation.
|
||||
}
|
||||
|
||||
public struct FTGeneric
|
||||
{
|
||||
public IntPtr Data;
|
||||
public IntPtr Finalizer;
|
||||
}
|
||||
|
||||
public struct FTVector
|
||||
{
|
||||
public long X;
|
||||
public long Y;
|
||||
}
|
||||
|
||||
public struct FTBitmap
|
||||
{
|
||||
public uint Rows;
|
||||
public uint Width;
|
||||
public int Pitch;
|
||||
public IntPtr Buffer;
|
||||
public ushort NumberOfGrays;
|
||||
public byte PixelMode;
|
||||
public byte PaletteMode;
|
||||
public IntPtr Palette;
|
||||
}
|
||||
|
||||
public struct FTOutline
|
||||
{
|
||||
public short NumberOfContours;
|
||||
public short NumberOfPoints;
|
||||
public IntPtr Points;
|
||||
public IntPtr Tags;
|
||||
public IntPtr Contours;
|
||||
public int Flags;
|
||||
}
|
||||
|
||||
internal struct FTGlyphSlotInternal
|
||||
{
|
||||
public FTLibrary Library;
|
||||
public FTFace Face;
|
||||
public FTGlyphSlot Next;
|
||||
public uint GlyphIndex;
|
||||
public FTGeneric Generic;
|
||||
public FTGlyphMetrics Metrics;
|
||||
public long LinearHorizontalAdvance;
|
||||
public long LinearVerticalAdvance;
|
||||
public FTVector Advance;
|
||||
public int Format;
|
||||
public FTBitmap Bitmap;
|
||||
public int BitmapLeft;
|
||||
public int BitmapTop;
|
||||
public FTOutline Outline;
|
||||
public uint NumberOfSubGlyphs;
|
||||
public IntPtr SubGlyphs;
|
||||
public IntPtr ControlData;
|
||||
public long ControlLength;
|
||||
public long LsbDelta;
|
||||
public long RsbDelta;
|
||||
public IntPtr Other;
|
||||
public IntPtr Internal;
|
||||
}
|
||||
|
||||
public unsafe struct FTGlyphSlot
|
||||
{
|
||||
private IntPtr _handle;
|
||||
public IntPtr Handle => _handle;
|
||||
private FTGlyphSlotInternal* Ptr => (FTGlyphSlotInternal*) _handle;
|
||||
|
||||
public FTLibrary Library => Ptr->Library;
|
||||
public FTFace Face => Ptr->Face;
|
||||
public FTGlyphSlot Next => Ptr->Next;
|
||||
public uint GlyphIndex => Ptr->GlyphIndex;
|
||||
public ref readonly FTGlyphMetrics Metrics => ref Ptr->Metrics;
|
||||
public long LinearHorizontalAdvance => Ptr->LinearHorizontalAdvance;
|
||||
public long LinearVerticalAdvance => Ptr->LinearVerticalAdvance;
|
||||
public FTVector Advance => Ptr->Advance;
|
||||
public ref readonly FTBitmap Bitmap => ref Ptr->Bitmap;
|
||||
public long BitmapLeft => Ptr->BitmapLeft;
|
||||
public long BitmapTop => Ptr->BitmapTop;
|
||||
}
|
||||
|
||||
public struct FTGlyphMetrics
|
||||
{
|
||||
public long Width;
|
||||
public long Height;
|
||||
public long HorizontalBearingX;
|
||||
public long HorizontalBearingY;
|
||||
public long HorizontalAdvance;
|
||||
public long VerticalBearingX;
|
||||
public long VerticalBearingY;
|
||||
public long VerticalAdvance;
|
||||
}
|
||||
|
||||
public struct FTSizeMetrics
|
||||
{
|
||||
public short Xppem;
|
||||
public short Yppem;
|
||||
public long XScale;
|
||||
public long YScale;
|
||||
public long Ascender;
|
||||
public long Descender;
|
||||
public long Height;
|
||||
public long MaxAdvance;
|
||||
}
|
||||
|
||||
public struct FTSize
|
||||
{
|
||||
public IntPtr Face;
|
||||
public FTGeneric Generic;
|
||||
public FTSizeMetrics Metrics;
|
||||
private IntPtr Privates;
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
cd $(dirname "$0")
|
||||
|
||||
# Apply the patch file that makes it easier to build freetype.
|
||||
# Note that this doesn't work all that well on windows.
|
||||
cat ../lib/freetype_patch.diff | git -C ../lib/freetype apply
|
||||
|
||||
QUIK_ADDITIONAL_CMAKE=-DBUILD_SHARED_LIBS\=true DST=$PWD ../sh/quik_build_native.sh ../lib/freetype
|
@ -1,12 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(quik_stbi LANGUAGES C VERSION 1.0)
|
||||
|
||||
add_compile_options(-static-libgcc)
|
||||
|
||||
add_library(stbi SHARED "quik_stbi.c")
|
||||
target_include_directories(stbi PRIVATE "../lib")
|
||||
install(
|
||||
TARGETS stbi
|
||||
RUNTIME DESTINATION .
|
||||
LIBRARY DESTINATION .)
|
@ -1,12 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Quik.Stb.Image
|
||||
{
|
||||
[AttributeUsage(System.AttributeTargets.All, Inherited = false, AllowMultiple = true)]
|
||||
internal sealed class NativeTypeNameAttribute : System.Attribute
|
||||
{
|
||||
public NativeTypeNameAttribute(string typename)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>disable</Nullable>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<RuntimeIdentifiers>linux-arm;linux-arm64;linux-x64;win-x86;win-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Nuget Properties. -->
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<PackageId>Quik.StbImage</PackageId>
|
||||
<Version>1.0.0</Version>
|
||||
<Authors>STBI Authors, H. Utku Maden</Authors>
|
||||
<Description>
|
||||
A C# wrapper for the ubiquitous Stb Image library.
|
||||
</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="runtimes/**">
|
||||
<PackagePath>runtimes</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,144 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Quik.Stb
|
||||
{
|
||||
/// <summary>
|
||||
/// A class that encompasses all features of stb_image.h in a safe way.
|
||||
/// </summary>
|
||||
public unsafe class StbImage : IDisposable
|
||||
{
|
||||
private bool isDisposed = false;
|
||||
|
||||
/// <summary>
|
||||
/// Pointer to the image.
|
||||
/// </summary>
|
||||
public IntPtr ImagePointer { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Width of the image.
|
||||
/// </summary>
|
||||
public int Width { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Height of the image.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public int Height { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Internal image format.
|
||||
/// </summary>
|
||||
public StbiImageFormat Format { get; }
|
||||
public bool IsFloat { get; }
|
||||
|
||||
private StbImage(IntPtr image, int x, int y, StbiImageFormat format, bool isFloat)
|
||||
{
|
||||
ImagePointer = image;
|
||||
Width = x;
|
||||
Height = y;
|
||||
Format = format;
|
||||
IsFloat = isFloat;
|
||||
}
|
||||
|
||||
~StbImage()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public void Dispose() => Dispose(true);
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (isDisposed) return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
Stbi.image_free(ImagePointer.ToPointer());
|
||||
isDisposed = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set to flip the y-axis of loaded images on load.
|
||||
/// </summary>
|
||||
public static bool FlipVerticallyOnLoad { set => Stbi.set_flip_vertically_on_load(1); }
|
||||
|
||||
/// <summary>
|
||||
/// Set to unpremultiply images on load.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// According to the stb_image documentation, only iPhone PNG images
|
||||
/// can come with premultiplied alpha.
|
||||
/// </remarks>
|
||||
public static bool UnpremultiplyOnLoad { set => Stbi.set_unpremultiply_on_load(1); }
|
||||
|
||||
/// <summary>
|
||||
/// Try loading an image, without raising exceptions.
|
||||
/// </summary>
|
||||
/// <param name="image">The resulting image.</param>
|
||||
/// <param name="stream">Source stream.</param>
|
||||
/// <param name="format">The desired image format.</param>
|
||||
/// <returns>True on success.</returns>
|
||||
public static bool TryLoad(out StbImage image, Stream stream, StbiImageFormat format = StbiImageFormat.Default, bool isFloat = false)
|
||||
{
|
||||
int x, y, iFormat;
|
||||
StbiStreamWrapper wrapper = new StbiStreamWrapper(stream, true);
|
||||
wrapper.CreateCallbacks(out stbi_io_callbacks cb);
|
||||
|
||||
stream.Position = 0;
|
||||
IntPtr imagePtr;
|
||||
if (isFloat)
|
||||
{
|
||||
imagePtr = (IntPtr)Stbi.loadf_from_callbacks(&cb, null, &x, &y, &iFormat, (int)format);
|
||||
}
|
||||
else
|
||||
{
|
||||
imagePtr = (IntPtr)Stbi.load_from_callbacks(&cb, null, &x, &y, &iFormat, (int)format);
|
||||
}
|
||||
|
||||
if (imagePtr != IntPtr.Zero)
|
||||
{
|
||||
image = new StbImage(imagePtr, x, y, (StbiImageFormat)iFormat, isFloat);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
image = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load an image.
|
||||
/// </summary>
|
||||
/// <param name="stream">The stream to load from.</param>
|
||||
/// <param name="format">The desired image format.</param>
|
||||
/// <returns>The image object.</returns>
|
||||
public static StbImage Load(Stream stream, StbiImageFormat format = StbiImageFormat.Default, bool isFloat = false)
|
||||
{
|
||||
if (TryLoad(out StbImage image, stream, format, isFloat))
|
||||
{
|
||||
return image;
|
||||
}
|
||||
|
||||
string reason = Marshal.PtrToStringUTF8((IntPtr)Stbi.failure_reason());
|
||||
throw new Exception($"Failed to load image: {reason}");
|
||||
}
|
||||
|
||||
public bool IsLoadable(Stream stream)
|
||||
{
|
||||
int x, y, iFormat;
|
||||
StbiStreamWrapper wrapper = new StbiStreamWrapper(stream, true);
|
||||
wrapper.CreateCallbacks(out stbi_io_callbacks cb);
|
||||
|
||||
stream.Position = 0;
|
||||
int result = Stbi.info_from_callbacks(&cb, null, &x, &y, &iFormat);
|
||||
|
||||
return result != 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Quik.Stb
|
||||
{
|
||||
public unsafe static partial class Stbi
|
||||
{
|
||||
private delegate void FailedAssertProc(byte *expression, byte *file, int line, byte *function);
|
||||
|
||||
private static readonly string[] LibraryNames = new string[]
|
||||
{
|
||||
//FIXME: This is wrong on so many levels, but, i need to do this
|
||||
// in order to get a change of this running.
|
||||
"runtimes/win-x64/native/libstbi.dll",
|
||||
"runtimes/win-x86/native/libstbi.dll",
|
||||
"runtimes/linux-arm/native/libstbi.so",
|
||||
"runtimes/linux-arm64/native/libstbi.so",
|
||||
"runtimes/linux-x64/native/libstbi.so",
|
||||
"runtimes/native/libstbi.dylib",
|
||||
"libstbi.dll",
|
||||
"libstbi.so",
|
||||
"libstbi.dylib",
|
||||
};
|
||||
|
||||
static Stbi()
|
||||
{
|
||||
NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), Resolver);
|
||||
|
||||
quik_stbi_failed_assert_store(Marshal.GetFunctionPointerForDelegate<FailedAssertProc>(FailedAssert));
|
||||
}
|
||||
|
||||
private static IntPtr Resolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
|
||||
{
|
||||
if (libraryName != "stbi")
|
||||
return IntPtr.Zero;
|
||||
|
||||
foreach (string name in LibraryNames)
|
||||
{
|
||||
if (NativeLibrary.TryLoad(name, assembly, searchPath, out IntPtr handle))
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
return NativeLibrary.Load(libraryName);
|
||||
}
|
||||
|
||||
private static void FailedAssert(byte *expression, byte *file, int line, byte *function)
|
||||
{
|
||||
string expr = expression == null ? string.Empty : Marshal.PtrToStringUTF8((IntPtr)expression);
|
||||
string f = file == null ? string.Empty : Marshal.PtrToStringUTF8((IntPtr)file);
|
||||
string func = function == null ? string.Empty : Marshal.PtrToStringUTF8((IntPtr)function);
|
||||
|
||||
Exception ex = new Exception("Assert failed in native stbi code.");
|
||||
ex.Data.Add("Expression", expr);
|
||||
ex.Data.Add("File", f);
|
||||
ex.Data.Add("Line", line);
|
||||
ex.Data.Add("Function", func);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,177 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Quik.Stb.Image;
|
||||
|
||||
namespace Quik.Stb
|
||||
{
|
||||
[NativeTypeName("unsigned int")]
|
||||
public enum StbiEnum : uint
|
||||
{
|
||||
STBI_default = 0,
|
||||
STBI_grey = 1,
|
||||
STBI_grey_alpha = 2,
|
||||
STBI_rgb = 3,
|
||||
STBI_rgb_alpha = 4,
|
||||
}
|
||||
|
||||
public partial struct stbi_io_callbacks
|
||||
{
|
||||
[NativeTypeName("int (*)(void *, char *, int)")]
|
||||
public IntPtr read;
|
||||
|
||||
[NativeTypeName("void (*)(void *, int)")]
|
||||
public IntPtr skip;
|
||||
|
||||
[NativeTypeName("int (*)(void *)")]
|
||||
public IntPtr eof;
|
||||
}
|
||||
|
||||
public static unsafe partial class Stbi
|
||||
{
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern void quik_stbi_failed_assert_store([NativeTypeName("quik_failed_assert_cb_t")] IntPtr cb);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_load_from_memory", ExactSpelling = true)]
|
||||
[return: NativeTypeName("stbi_uc *")]
|
||||
public static extern byte* load_from_memory([NativeTypeName("const stbi_uc *")] byte* buffer, int len, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_load_from_callbacks", ExactSpelling = true)]
|
||||
[return: NativeTypeName("stbi_uc *")]
|
||||
public static extern byte* load_from_callbacks([NativeTypeName("const stbi_io_callbacks *")] stbi_io_callbacks* clbk, void* user, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_load", ExactSpelling = true)]
|
||||
[return: NativeTypeName("stbi_uc *")]
|
||||
public static extern byte* load([NativeTypeName("const char *")] sbyte* filename, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_load_from_file", ExactSpelling = true)]
|
||||
[return: NativeTypeName("stbi_uc *")]
|
||||
public static extern byte* load_from_file([NativeTypeName("FILE *")] void* f, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_load_gif_from_memory", ExactSpelling = true)]
|
||||
[return: NativeTypeName("stbi_uc *")]
|
||||
public static extern byte* load_gif_from_memory([NativeTypeName("const stbi_uc *")] byte* buffer, int len, int** delays, int* x, int* y, int* z, int* comp, int req_comp);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_load_16_from_memory", ExactSpelling = true)]
|
||||
[return: NativeTypeName("stbi_us *")]
|
||||
public static extern ushort* load_16_from_memory([NativeTypeName("const stbi_uc *")] byte* buffer, int len, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_load_16_from_callbacks", ExactSpelling = true)]
|
||||
[return: NativeTypeName("stbi_us *")]
|
||||
public static extern ushort* load_16_from_callbacks([NativeTypeName("const stbi_io_callbacks *")] stbi_io_callbacks* clbk, void* user, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_load_16", ExactSpelling = true)]
|
||||
[return: NativeTypeName("stbi_us *")]
|
||||
public static extern ushort* load_16([NativeTypeName("const char *")] sbyte* filename, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_load_from_file_16", ExactSpelling = true)]
|
||||
[return: NativeTypeName("stbi_us *")]
|
||||
public static extern ushort* load_from_file_16([NativeTypeName("FILE *")] void* f, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_loadf_from_memory", ExactSpelling = true)]
|
||||
public static extern float* loadf_from_memory([NativeTypeName("const stbi_uc *")] byte* buffer, int len, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_loadf_from_callbacks", ExactSpelling = true)]
|
||||
public static extern float* loadf_from_callbacks([NativeTypeName("const stbi_io_callbacks *")] stbi_io_callbacks* clbk, void* user, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_loadf", ExactSpelling = true)]
|
||||
public static extern float* loadf([NativeTypeName("const char *")] sbyte* filename, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_loadf_from_file", ExactSpelling = true)]
|
||||
public static extern float* loadf_from_file([NativeTypeName("FILE *")] void* f, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_hdr_to_ldr_gamma", ExactSpelling = true)]
|
||||
public static extern void hdr_to_ldr_gamma(float gamma);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_hdr_to_ldr_scale", ExactSpelling = true)]
|
||||
public static extern void hdr_to_ldr_scale(float scale);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_ldr_to_hdr_gamma", ExactSpelling = true)]
|
||||
public static extern void ldr_to_hdr_gamma(float gamma);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_ldr_to_hdr_scale", ExactSpelling = true)]
|
||||
public static extern void ldr_to_hdr_scale(float scale);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_is_hdr_from_callbacks", ExactSpelling = true)]
|
||||
public static extern int is_hdr_from_callbacks([NativeTypeName("const stbi_io_callbacks *")] stbi_io_callbacks* clbk, void* user);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_is_hdr_from_memory", ExactSpelling = true)]
|
||||
public static extern int is_hdr_from_memory([NativeTypeName("const stbi_uc *")] byte* buffer, int len);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_is_hdr", ExactSpelling = true)]
|
||||
public static extern int is_hdr([NativeTypeName("const char *")] sbyte* filename);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_is_hdr_from_file", ExactSpelling = true)]
|
||||
public static extern int is_hdr_from_file([NativeTypeName("FILE *")] void* f);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_failure_reason", ExactSpelling = true)]
|
||||
[return: NativeTypeName("const char *")]
|
||||
public static extern sbyte* failure_reason();
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_image_free", ExactSpelling = true)]
|
||||
public static extern void image_free(void* retval_from_stbi_load);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_info_from_memory", ExactSpelling = true)]
|
||||
public static extern int info_from_memory([NativeTypeName("const stbi_uc *")] byte* buffer, int len, int* x, int* y, int* comp);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_info_from_callbacks", ExactSpelling = true)]
|
||||
public static extern int info_from_callbacks([NativeTypeName("const stbi_io_callbacks *")] stbi_io_callbacks* clbk, void* user, int* x, int* y, int* comp);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_is_16_bit_from_memory", ExactSpelling = true)]
|
||||
public static extern int is_16_bit_from_memory([NativeTypeName("const stbi_uc *")] byte* buffer, int len);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_is_16_bit_from_callbacks", ExactSpelling = true)]
|
||||
public static extern int is_16_bit_from_callbacks([NativeTypeName("const stbi_io_callbacks *")] stbi_io_callbacks* clbk, void* user);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_info", ExactSpelling = true)]
|
||||
public static extern int info([NativeTypeName("const char *")] sbyte* filename, int* x, int* y, int* comp);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_info_from_file", ExactSpelling = true)]
|
||||
public static extern int info_from_file([NativeTypeName("FILE *")] void* f, int* x, int* y, int* comp);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_is_16_bit", ExactSpelling = true)]
|
||||
public static extern int is_16_bit([NativeTypeName("const char *")] sbyte* filename);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_is_16_bit_from_file", ExactSpelling = true)]
|
||||
public static extern int is_16_bit_from_file([NativeTypeName("FILE *")] void* f);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_set_unpremultiply_on_load", ExactSpelling = true)]
|
||||
public static extern void set_unpremultiply_on_load(int flag_true_if_should_unpremultiply);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_convert_iphone_png_to_rgb", ExactSpelling = true)]
|
||||
public static extern void convert_iphone_png_to_rgb(int flag_true_if_should_convert);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_set_flip_vertically_on_load", ExactSpelling = true)]
|
||||
public static extern void set_flip_vertically_on_load(int flag_true_if_should_flip);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_set_unpremultiply_on_load_thread", ExactSpelling = true)]
|
||||
public static extern void set_unpremultiply_on_load_thread(int flag_true_if_should_unpremultiply);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_convert_iphone_png_to_rgb_thread", ExactSpelling = true)]
|
||||
public static extern void convert_iphone_png_to_rgb_thread(int flag_true_if_should_convert);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_set_flip_vertically_on_load_thread", ExactSpelling = true)]
|
||||
public static extern void set_flip_vertically_on_load_thread(int flag_true_if_should_flip);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_zlib_decode_malloc_guesssize", ExactSpelling = true)]
|
||||
[return: NativeTypeName("char *")]
|
||||
public static extern sbyte* zlib_decode_malloc_guesssize([NativeTypeName("const char *")] sbyte* buffer, int len, int initial_size, int* outlen);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_zlib_decode_malloc_guesssize_headerflag", ExactSpelling = true)]
|
||||
[return: NativeTypeName("char *")]
|
||||
public static extern sbyte* zlib_decode_malloc_guesssize_headerflag([NativeTypeName("const char *")] sbyte* buffer, int len, int initial_size, int* outlen, int parse_header);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_zlib_decode_malloc", ExactSpelling = true)]
|
||||
[return: NativeTypeName("char *")]
|
||||
public static extern sbyte* zlib_decode_malloc([NativeTypeName("const char *")] sbyte* buffer, int len, int* outlen);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_zlib_decode_buffer", ExactSpelling = true)]
|
||||
public static extern int zlib_decode_buffer([NativeTypeName("char *")] sbyte* obuffer, int olen, [NativeTypeName("const char *")] sbyte* ibuffer, int ilen);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_zlib_decode_noheader_malloc", ExactSpelling = true)]
|
||||
[return: NativeTypeName("char *")]
|
||||
public static extern sbyte* zlib_decode_noheader_malloc([NativeTypeName("const char *")] sbyte* buffer, int len, int* outlen);
|
||||
|
||||
[DllImport("stbi", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_zlib_decode_noheader_buffer", ExactSpelling = true)]
|
||||
public static extern int zlib_decode_noheader_buffer([NativeTypeName("char *")] sbyte* obuffer, int olen, [NativeTypeName("const char *")] sbyte* ibuffer, int ilen);
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
namespace Quik.Stb
|
||||
{
|
||||
public enum StbiImageFormat
|
||||
{
|
||||
Default = (int)StbiEnum.STBI_default,
|
||||
Grey = (int)StbiEnum.STBI_grey,
|
||||
GreyAlpha = (int)StbiEnum.STBI_grey_alpha,
|
||||
Rgb = (int)StbiEnum.STBI_rgb,
|
||||
Rgba = (int)StbiEnum.STBI_rgb_alpha
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Quik.Stb
|
||||
{
|
||||
public unsafe class StbiStreamWrapper : IDisposable
|
||||
{
|
||||
private Stream _stream;
|
||||
private bool _keepOpen;
|
||||
private bool _isDisposed;
|
||||
|
||||
private delegate int ReadProc(void *userdata, byte* buffer, int count);
|
||||
private delegate void SkipProc(void *userdata, int count);
|
||||
private delegate int Eof(void *userdata);
|
||||
|
||||
public StbiStreamWrapper(Stream stream, bool keepOpen = false)
|
||||
{
|
||||
if (stream == null) throw new ArgumentNullException(nameof(stream));
|
||||
|
||||
_stream = stream;
|
||||
_keepOpen = keepOpen;
|
||||
}
|
||||
|
||||
public void CreateCallbacks(out stbi_io_callbacks cb)
|
||||
{
|
||||
cb = default;
|
||||
cb.read = Marshal.GetFunctionPointerForDelegate<ReadProc>(ReadCb);
|
||||
cb.skip = Marshal.GetFunctionPointerForDelegate<SkipProc>(SkipCb);
|
||||
cb.eof = Marshal.GetFunctionPointerForDelegate<Eof>(EofCb);
|
||||
}
|
||||
|
||||
private int ReadCb(void *userdata, byte* buffer, int count)
|
||||
{
|
||||
Span<byte> bytes = new Span<byte>(buffer, count);
|
||||
return _stream.Read(bytes);
|
||||
}
|
||||
|
||||
private void SkipCb(void *userdata, int count)
|
||||
{
|
||||
_stream.Seek(count, SeekOrigin.Current);
|
||||
}
|
||||
|
||||
private int EofCb(void *userdata)
|
||||
{
|
||||
if (!_stream.CanRead || _stream.Position == _stream.Length)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_isDisposed) return;
|
||||
|
||||
if (!_keepOpen) _stream.Dispose();
|
||||
|
||||
_isDisposed = true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
cd $(dirname "$0")
|
||||
../sh/quik_build_native.sh .
|
@ -1,30 +0,0 @@
|
||||
-x
|
||||
c
|
||||
-l
|
||||
stbi
|
||||
--config
|
||||
compatible-codegen
|
||||
single-file
|
||||
exclude-fnptr-codegen
|
||||
generate-aggressive-inlining
|
||||
generate-setslastsystemerror-attribute
|
||||
unix-types
|
||||
--include-directory
|
||||
../lib
|
||||
--include-directory
|
||||
../Quik.StbImage
|
||||
--include-directory
|
||||
/usr/lib/llvm-14/lib/clang/14.0.6/include
|
||||
--file
|
||||
../Quik.StbImage.redist/quik_stbi.h
|
||||
../lib/stb/stb_image.h
|
||||
--methodClassName
|
||||
Stbi
|
||||
--namespace
|
||||
Quik.Stb
|
||||
--output
|
||||
Stbi.cs
|
||||
--prefixStrip
|
||||
stbi_
|
||||
--with-type
|
||||
FILE=void
|
@ -1,6 +0,0 @@
|
||||
#include "quik_stbi.h"
|
||||
|
||||
QUIK_DEFINE_LIB(quik_stbi);
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION 1
|
||||
#include "stb/stb_image.h"
|
@ -1,18 +0,0 @@
|
||||
#ifndef _QUIK_STBI_H_
|
||||
#define _QUIK_STBI_H_
|
||||
|
||||
#include "quik/quik_common.h"
|
||||
|
||||
QUIK_DECLARE_LIB(quik_stbi)
|
||||
|
||||
/* TODO: Change this declaration so we can export a DLL properly in windows. */
|
||||
#define STBIDEF QEXTERN
|
||||
|
||||
#define STBI_ASSERT(EXPR) do { \
|
||||
if (!(EXPR)) \
|
||||
quik_stbi_failed_assert(#EXPR, __FILE__, __LINE__ - 2, __QUIK_FUNCTION__); \
|
||||
} while(0)
|
||||
|
||||
#include "stb/stb_image.h"
|
||||
|
||||
#endif
|
@ -1,12 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(quik_stbtt LANGUAGES C VERSION 1.0)
|
||||
|
||||
add_compile_options(-static-libgcc)
|
||||
|
||||
add_library(stbtt SHARED "quik_stbtt.c")
|
||||
target_include_directories(stbtt PRIVATE "../lib")
|
||||
install(
|
||||
TARGETS stbtt
|
||||
RUNTIME DESTINATION .
|
||||
LIBRARY DESTINATION .)
|
@ -1,12 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Quik.Stb.TrueType
|
||||
{
|
||||
[AttributeUsage(System.AttributeTargets.All, Inherited = false, AllowMultiple = true)]
|
||||
internal sealed class NativeTypeNameAttribute : System.Attribute
|
||||
{
|
||||
public NativeTypeNameAttribute(string typename)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>disable</Nullable>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Quik.StbTrueType.redist" Version="1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="runtimes/**">
|
||||
<PackagePath>runtimes</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,355 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Quik.Stb
|
||||
{
|
||||
public unsafe class StbFont : IDisposable
|
||||
{
|
||||
IntPtr _buffer;
|
||||
stbtt_fontinfo* _info;
|
||||
List<stbtt_kerningentry> _kerningTable;
|
||||
|
||||
public IntPtr FontBuffer => _buffer;
|
||||
public ref stbtt_fontinfo FontInfo => ref *_info;
|
||||
|
||||
public IReadOnlyList<stbtt_kerningentry> KerningTable
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_kerningTable != null)
|
||||
return _kerningTable;
|
||||
|
||||
int count = Stbtt.GetKerningTableLength(_info);
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
return _kerningTable = new List<stbtt_kerningentry>();
|
||||
}
|
||||
else
|
||||
{
|
||||
stbtt_kerningentry[] array = new stbtt_kerningentry[count];
|
||||
|
||||
fixed (stbtt_kerningentry *ptr = array)
|
||||
Stbtt.GetKerningTable(_info, ptr, count);
|
||||
|
||||
return _kerningTable = new List<stbtt_kerningentry>(array);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int Ascend { get; }
|
||||
public int Descend { get; }
|
||||
public int VerticalLineGap { get; }
|
||||
public int AscendOS2 { get; }
|
||||
public int DescendOS2 { get; }
|
||||
public int VerticalLineGapOS2 { get; }
|
||||
public Box BoundingBox { get; }
|
||||
|
||||
private StbFont(IntPtr buffer, stbtt_fontinfo* info)
|
||||
{
|
||||
_buffer = buffer;
|
||||
_info = info;
|
||||
|
||||
int a, b, c, d;
|
||||
|
||||
Stbtt.GetFontVMetrics(_info, &a, &b, &c);
|
||||
Ascend = a;
|
||||
Descend = b;
|
||||
VerticalLineGap = c;
|
||||
|
||||
Stbtt.GetFontVMetricsOS2(_info, &a, &b, &c);
|
||||
AscendOS2 = a;
|
||||
DescendOS2 = b;
|
||||
VerticalLineGapOS2 = c;
|
||||
|
||||
Stbtt.GetFontBoundingBox(_info, &a, &b, &c, &d);
|
||||
BoundingBox = new Box(a, b, c, d);
|
||||
}
|
||||
~StbFont()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
|
||||
public int FindGlyphIndex(int codepoint)
|
||||
{
|
||||
return Stbtt.FindGlyphIndex(_info, codepoint);
|
||||
}
|
||||
public int FindGlyphIndex(Rune codepoint) => FindGlyphIndex(codepoint.Value);
|
||||
|
||||
public float ScaleForPixelHeight(float pixels)
|
||||
{
|
||||
return Stbtt.ScaleForPixelHeight(_info, pixels);
|
||||
}
|
||||
|
||||
public float ScaleForMappingEmToPixels(float pixels)
|
||||
{
|
||||
return Stbtt.ScaleForMappingEmToPixels(_info, pixels);
|
||||
}
|
||||
|
||||
public void GetCodepointHMetrics(int codepoint, out int advance, out int bearing)
|
||||
{
|
||||
int a, b;
|
||||
|
||||
Stbtt.GetCodepointHMetrics(_info, codepoint, &a, &b);
|
||||
|
||||
advance = a;
|
||||
bearing = b;
|
||||
}
|
||||
|
||||
public void GetCodepointHMetrics(Rune codepoint, out int advance, out int bearing)
|
||||
=> GetCodepointHMetrics(codepoint.Value, out advance, out bearing);
|
||||
|
||||
public int GetCodepointKernAdvance(int cp1, int cp2)
|
||||
{
|
||||
return Stbtt.GetCodepointKernAdvance(_info, cp1, cp2);
|
||||
}
|
||||
public int GetCodepointKernAdvance(Rune cp1, Rune cp2) => GetCodepointKernAdvance(cp1.Value, cp2.Value);
|
||||
|
||||
public int GetCodepointBox(int codepoint, out Box box)
|
||||
{
|
||||
int x0, y0;
|
||||
int x1, y1;
|
||||
int rval;
|
||||
|
||||
rval = Stbtt.GetCodepointBox(_info, codepoint, &x0, &y0, &x1, &y1);
|
||||
|
||||
box = new Box(x0, y0, x1, y1);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
public void GetGlyphHMetrics(int glyph, out int advance, out int bearing)
|
||||
{
|
||||
int a, b;
|
||||
|
||||
Stbtt.GetGlyphHMetrics(_info, glyph, &a, &b);
|
||||
|
||||
advance = a;
|
||||
bearing = b;
|
||||
}
|
||||
|
||||
public int GetGlyphKernAdvance(int gl1, int gl2)
|
||||
{
|
||||
return Stbtt.GetGlyphKernAdvance(_info, gl1, gl2);
|
||||
}
|
||||
|
||||
public int GetGlyphBox(int glyph, out Box box)
|
||||
{
|
||||
int x0, y0;
|
||||
int x1, y1;
|
||||
int rval;
|
||||
|
||||
rval = Stbtt.GetGlyphBox(_info, glyph, &x0, &y0, &x1, &y1);
|
||||
|
||||
box = new Box(x0, y0, x1, y1);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
public bool IsGlyphEmpty(int glyph)
|
||||
{
|
||||
return Stbtt.IsGlyphEmpty(_info, glyph) != 0;
|
||||
}
|
||||
|
||||
public Bitmap GetCodepointBitmap(float scaleX, float scaleY, int codepoint, out int offsetX, out int offsetY)
|
||||
{
|
||||
int w, h, x, y;
|
||||
void* ptr = Stbtt.GetCodepointBitmap(_info, scaleX, scaleY, codepoint, &w, &h, &x, &y);
|
||||
|
||||
offsetX = x;
|
||||
offsetY = y;
|
||||
|
||||
return new Bitmap((IntPtr)ptr, w, h, FreeBitmap);
|
||||
}
|
||||
|
||||
public Bitmap GetCodepointBitmap(float scaleX, float scaleY, Rune codepoint, out int offsetX, out int offsetY)
|
||||
=> GetCodepointBitmap(scaleX, scaleY, codepoint.Value, out offsetX, out offsetY);
|
||||
|
||||
public Bitmap GetCodepointBitmapSubpixel(float scaleX, float scaleY, float shiftX, float shiftY, int codepoint, out int offsetX, out int offsetY)
|
||||
{
|
||||
int w, h, x, y;
|
||||
void* ptr = Stbtt.GetCodepointBitmapSubpixel(_info, scaleX, scaleY, shiftX, shiftY, codepoint, &w, &h, &x, &y);
|
||||
|
||||
offsetX = x;
|
||||
offsetY = y;
|
||||
|
||||
return new Bitmap((IntPtr)ptr, w, h, FreeBitmap);
|
||||
}
|
||||
|
||||
public Bitmap GetCodepointBitmapSubpixel(float scaleX, float scaleY, float shiftX, float shiftY, Rune codepoint, out int offsetX, out int offsetY)
|
||||
=> GetCodepointBitmapSubpixel(scaleX, scaleY, shiftX, shiftY, codepoint.Value, out offsetX, out offsetY);
|
||||
|
||||
public Bitmap GetGlyphBitmap(float scaleX, float scaleY, int glyph, out int offsetX, out int offsetY)
|
||||
{
|
||||
int w, h, x, y;
|
||||
void* ptr = Stbtt.GetGlyphBitmap(_info, scaleX, scaleY, glyph, &w, &h, &x, &y);
|
||||
|
||||
offsetX = x;
|
||||
offsetY = y;
|
||||
|
||||
return new Bitmap((IntPtr)ptr, w, h, FreeBitmap);
|
||||
}
|
||||
|
||||
public Bitmap GetGlyphBitmapSubpixel(float scaleX, float scaleY, float shiftX, float shiftY, int glyph, out int offsetX, out int offsetY)
|
||||
{
|
||||
int w, h, x, y;
|
||||
void* ptr = Stbtt.GetGlyphBitmapSubpixel(_info, scaleX, scaleY, shiftX, shiftY, glyph, &w, &h, &x, &y);
|
||||
|
||||
offsetX = x;
|
||||
offsetY = y;
|
||||
|
||||
return new Bitmap((IntPtr)ptr, w, h, FreeBitmap);
|
||||
}
|
||||
|
||||
public Bitmap GetGlyphSdf(float scale, int glyph, int padding, byte edgeValue, float pixelDistScale, out int offsetX, out int offsetY)
|
||||
{
|
||||
int w, h, x, y;
|
||||
void *ptr = Stbtt.GetGlyphSDF(_info, scale, glyph, padding, edgeValue, pixelDistScale, &w, &h, &x, &y);
|
||||
|
||||
offsetX = x;
|
||||
offsetY = y;
|
||||
|
||||
return new Bitmap((IntPtr)ptr, w, h, FreeSdf);
|
||||
}
|
||||
|
||||
public Bitmap GetCodepointSdf(float scale, int codepoint, int padding, byte edgeValue, float pixelDistScale, out int offsetX, out int offsetY)
|
||||
{
|
||||
int w, h, x, y;
|
||||
void *ptr = Stbtt.GetCodepointSDF(_info, scale, codepoint, padding, edgeValue, pixelDistScale, &w, &h, &x, &y);
|
||||
|
||||
offsetX = x;
|
||||
offsetY = y;
|
||||
|
||||
return new Bitmap((IntPtr)ptr, w, h, FreeSdf);
|
||||
}
|
||||
|
||||
public Bitmap GetCodepointSdf(float scale, Rune codepoint, int padding, byte edgeValue, float pixelDistScale, out int offsetX, out int offsetY)
|
||||
=> GetCodepointSdf(scale, codepoint.Value, padding, edgeValue, pixelDistScale, out offsetX, out offsetY);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
bool isDisposed = false;
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (isDisposed) return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
|
||||
Marshal.FreeHGlobal(_buffer);
|
||||
Marshal.FreeHGlobal((IntPtr)_info);
|
||||
isDisposed = true;
|
||||
}
|
||||
|
||||
public static bool TryLoad(Stream stream, out StbFont font)
|
||||
{
|
||||
byte* buffer = (byte*)Marshal.AllocHGlobal((int)stream.Length);
|
||||
stbtt_fontinfo* fontInfo = (stbtt_fontinfo*)Marshal.AllocHGlobal(sizeof(stbtt_fontinfo));
|
||||
|
||||
stream.Read(new Span<byte>(buffer, (int)stream.Length));
|
||||
|
||||
int nfont = Stbtt.GetNumberOfFonts(buffer);
|
||||
|
||||
if (nfont == 0)
|
||||
{
|
||||
font = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
int offset = Stbtt.GetFontOffsetForIndex(buffer, 0);
|
||||
|
||||
if (Stbtt.InitFont(fontInfo, (byte*)buffer, offset) == 0)
|
||||
{
|
||||
Marshal.FreeHGlobal((IntPtr)buffer);
|
||||
Marshal.FreeHGlobal((IntPtr)fontInfo);
|
||||
|
||||
font = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
font = new StbFont((IntPtr)buffer, fontInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static StbFont Load(Stream stream)
|
||||
{
|
||||
if (TryLoad(stream, out StbFont font))
|
||||
{
|
||||
return font;
|
||||
}
|
||||
|
||||
throw new Exception("Could not load the font.");
|
||||
}
|
||||
|
||||
private static void FreeBitmap(IntPtr buffer)
|
||||
{
|
||||
Stbtt.FreeBitmap((byte*)buffer, null);
|
||||
}
|
||||
|
||||
private static void FreeSdf(IntPtr buffer)
|
||||
{
|
||||
Stbtt.FreeSDF((byte*)buffer, null);
|
||||
}
|
||||
|
||||
public struct Box
|
||||
{
|
||||
public int X0;
|
||||
public int Y0;
|
||||
public int X1;
|
||||
public int Y1;
|
||||
|
||||
public Box(int x0, int y0, int x1, int y1)
|
||||
{
|
||||
X0 = x0; Y0 = y0;
|
||||
X1 = x1; Y1 = y1;
|
||||
}
|
||||
}
|
||||
|
||||
public class Bitmap : IDisposable
|
||||
{
|
||||
public IntPtr Buffer { get; }
|
||||
public int Width { get; }
|
||||
public int Height { get; }
|
||||
|
||||
private readonly Action<IntPtr> Destroy;
|
||||
|
||||
public Bitmap(IntPtr buffer, int width, int height, Action<IntPtr> destroy)
|
||||
{
|
||||
Buffer = buffer;
|
||||
Width = width;
|
||||
Height = height;
|
||||
Destroy = destroy;
|
||||
}
|
||||
~Bitmap()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public void Dispose() => Dispose(true);
|
||||
|
||||
private bool isDiposed = false;
|
||||
public void Dispose(bool disposing)
|
||||
{
|
||||
if (isDiposed) return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
Destroy(Buffer);
|
||||
isDiposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Quik.Stb
|
||||
{
|
||||
public unsafe static partial class Stbtt
|
||||
{
|
||||
private delegate void FailedAssertProc(byte *expression, byte *file, int line, byte *function);
|
||||
|
||||
private static readonly string[] LibraryNames = new string[]
|
||||
{
|
||||
//FIXME: This is wrong on so many levels, but, i need to do this
|
||||
// in order to get a change of this running.
|
||||
"runtimes/win-x64/native/libstbtt.dll",
|
||||
"runtimes/win-x86/native/libstbtt.dll",
|
||||
"runtimes/linux-arm/native/libstbtt.so",
|
||||
"runtimes/linux-arm64/native/libstbtt.so",
|
||||
"runtimes/linux-x64/native/libstbtt.so",
|
||||
"runtimes/native/libstbtt.dylib",
|
||||
"libstbtt.dll",
|
||||
"libstbtt.so",
|
||||
"libstbtt.dylib",
|
||||
};
|
||||
|
||||
static Stbtt()
|
||||
{
|
||||
NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), Resolver);
|
||||
|
||||
quik_stbtt_failed_assert_store(Marshal.GetFunctionPointerForDelegate<FailedAssertProc>(FailedAssert));
|
||||
}
|
||||
|
||||
private static IntPtr Resolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
|
||||
{
|
||||
if (libraryName != "stbtt")
|
||||
return IntPtr.Zero;
|
||||
|
||||
foreach (string name in LibraryNames)
|
||||
{
|
||||
if (NativeLibrary.TryLoad(name, assembly, searchPath, out IntPtr handle))
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
return NativeLibrary.Load(libraryName);
|
||||
}
|
||||
|
||||
private static void FailedAssert(byte *expression, byte *file, int line, byte *function)
|
||||
{
|
||||
string expr = expression == null ? string.Empty : Marshal.PtrToStringUTF8((IntPtr)expression);
|
||||
string f = file == null ? string.Empty : Marshal.PtrToStringUTF8((IntPtr)file);
|
||||
string func = function == null ? string.Empty : Marshal.PtrToStringUTF8((IntPtr)function);
|
||||
|
||||
Exception ex =
|
||||
new Exception($"Assert failed in native stbtt code. ({System.IO.Path.GetFileName(f)}:{line})");
|
||||
ex.Data.Add("Expression", expr);
|
||||
ex.Data.Add("File", f);
|
||||
ex.Data.Add("Line", line);
|
||||
ex.Data.Add("Function", func);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,495 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Quik.Stb.TrueType;
|
||||
|
||||
namespace Quik.Stb
|
||||
{
|
||||
public unsafe partial struct stbtt__buf
|
||||
{
|
||||
[NativeTypeName("unsigned char *")]
|
||||
public byte* data;
|
||||
|
||||
public int cursor;
|
||||
|
||||
public int size;
|
||||
}
|
||||
|
||||
public partial struct stbtt_bakedchar
|
||||
{
|
||||
[NativeTypeName("unsigned short")]
|
||||
public ushort x0;
|
||||
|
||||
[NativeTypeName("unsigned short")]
|
||||
public ushort y0;
|
||||
|
||||
[NativeTypeName("unsigned short")]
|
||||
public ushort x1;
|
||||
|
||||
[NativeTypeName("unsigned short")]
|
||||
public ushort y1;
|
||||
|
||||
public float xoff;
|
||||
|
||||
public float yoff;
|
||||
|
||||
public float xadvance;
|
||||
}
|
||||
|
||||
public partial struct stbtt_aligned_quad
|
||||
{
|
||||
public float x0;
|
||||
|
||||
public float y0;
|
||||
|
||||
public float s0;
|
||||
|
||||
public float t0;
|
||||
|
||||
public float x1;
|
||||
|
||||
public float y1;
|
||||
|
||||
public float s1;
|
||||
|
||||
public float t1;
|
||||
}
|
||||
|
||||
public partial struct stbtt_packedchar
|
||||
{
|
||||
[NativeTypeName("unsigned short")]
|
||||
public ushort x0;
|
||||
|
||||
[NativeTypeName("unsigned short")]
|
||||
public ushort y0;
|
||||
|
||||
[NativeTypeName("unsigned short")]
|
||||
public ushort x1;
|
||||
|
||||
[NativeTypeName("unsigned short")]
|
||||
public ushort y1;
|
||||
|
||||
public float xoff;
|
||||
|
||||
public float yoff;
|
||||
|
||||
public float xadvance;
|
||||
|
||||
public float xoff2;
|
||||
|
||||
public float yoff2;
|
||||
}
|
||||
|
||||
public partial struct stbrp_rect
|
||||
{
|
||||
}
|
||||
|
||||
public unsafe partial struct stbtt_pack_range
|
||||
{
|
||||
public float font_size;
|
||||
|
||||
public int first_unicode_codepoint_in_range;
|
||||
|
||||
public int* array_of_unicode_codepoints;
|
||||
|
||||
public int num_chars;
|
||||
|
||||
public stbtt_packedchar* chardata_for_range;
|
||||
|
||||
[NativeTypeName("unsigned char")]
|
||||
public byte h_oversample;
|
||||
|
||||
[NativeTypeName("unsigned char")]
|
||||
public byte v_oversample;
|
||||
}
|
||||
|
||||
public unsafe partial struct stbtt_pack_context
|
||||
{
|
||||
public void* user_allocator_context;
|
||||
|
||||
public void* pack_info;
|
||||
|
||||
public int width;
|
||||
|
||||
public int height;
|
||||
|
||||
public int stride_in_bytes;
|
||||
|
||||
public int padding;
|
||||
|
||||
public int skip_missing;
|
||||
|
||||
[NativeTypeName("unsigned int")]
|
||||
public uint h_oversample;
|
||||
|
||||
[NativeTypeName("unsigned int")]
|
||||
public uint v_oversample;
|
||||
|
||||
[NativeTypeName("unsigned char *")]
|
||||
public byte* pixels;
|
||||
|
||||
public void* nodes;
|
||||
}
|
||||
|
||||
public unsafe partial struct stbtt_fontinfo
|
||||
{
|
||||
public void* userdata;
|
||||
|
||||
[NativeTypeName("unsigned char *")]
|
||||
public byte* data;
|
||||
|
||||
public int fontstart;
|
||||
|
||||
public int numGlyphs;
|
||||
|
||||
public int loca;
|
||||
|
||||
public int head;
|
||||
|
||||
public int glyf;
|
||||
|
||||
public int hhea;
|
||||
|
||||
public int hmtx;
|
||||
|
||||
public int kern;
|
||||
|
||||
public int gpos;
|
||||
|
||||
public int svg;
|
||||
|
||||
public int index_map;
|
||||
|
||||
public int indexToLocFormat;
|
||||
|
||||
public stbtt__buf cff;
|
||||
|
||||
public stbtt__buf charstrings;
|
||||
|
||||
public stbtt__buf gsubrs;
|
||||
|
||||
public stbtt__buf subrs;
|
||||
|
||||
public stbtt__buf fontdicts;
|
||||
|
||||
public stbtt__buf fdselect;
|
||||
}
|
||||
|
||||
public partial struct stbtt_kerningentry
|
||||
{
|
||||
public int glyph1;
|
||||
|
||||
public int glyph2;
|
||||
|
||||
public int advance;
|
||||
}
|
||||
|
||||
[NativeTypeName("unsigned int")]
|
||||
public enum StbttV : uint
|
||||
{
|
||||
STBTT_vmove = 1,
|
||||
STBTT_vline,
|
||||
STBTT_vcurve,
|
||||
STBTT_vcubic,
|
||||
}
|
||||
|
||||
public partial struct stbtt_vertex
|
||||
{
|
||||
public short x;
|
||||
|
||||
public short y;
|
||||
|
||||
public short cx;
|
||||
|
||||
public short cy;
|
||||
|
||||
public short cx1;
|
||||
|
||||
public short cy1;
|
||||
|
||||
[NativeTypeName("unsigned char")]
|
||||
public byte type;
|
||||
|
||||
[NativeTypeName("unsigned char")]
|
||||
public byte padding;
|
||||
}
|
||||
|
||||
public unsafe partial struct stbtt__bitmap
|
||||
{
|
||||
public int w;
|
||||
|
||||
public int h;
|
||||
|
||||
public int stride;
|
||||
|
||||
[NativeTypeName("unsigned char *")]
|
||||
public byte* pixels;
|
||||
}
|
||||
|
||||
[NativeTypeName("unsigned int")]
|
||||
public enum StbttPlatform : uint
|
||||
{
|
||||
STBTT_PLATFORM_ID_UNICODE = 0,
|
||||
STBTT_PLATFORM_ID_MAC = 1,
|
||||
STBTT_PLATFORM_ID_ISO = 2,
|
||||
STBTT_PLATFORM_ID_MICROSOFT = 3,
|
||||
}
|
||||
|
||||
[NativeTypeName("unsigned int")]
|
||||
public enum StbttUnicode : uint
|
||||
{
|
||||
STBTT_UNICODE_EID_UNICODE_1_0 = 0,
|
||||
STBTT_UNICODE_EID_UNICODE_1_1 = 1,
|
||||
STBTT_UNICODE_EID_ISO_10646 = 2,
|
||||
STBTT_UNICODE_EID_UNICODE_2_0_BMP = 3,
|
||||
STBTT_UNICODE_EID_UNICODE_2_0_FULL = 4,
|
||||
}
|
||||
|
||||
[NativeTypeName("unsigned int")]
|
||||
public enum StbttMs : uint
|
||||
{
|
||||
STBTT_MS_EID_SYMBOL = 0,
|
||||
STBTT_MS_EID_UNICODE_BMP = 1,
|
||||
STBTT_MS_EID_SHIFTJIS = 2,
|
||||
STBTT_MS_EID_UNICODE_FULL = 10,
|
||||
}
|
||||
|
||||
[NativeTypeName("unsigned int")]
|
||||
public enum StbttMac : uint
|
||||
{
|
||||
STBTT_MAC_EID_ROMAN = 0,
|
||||
STBTT_MAC_EID_ARABIC = 4,
|
||||
STBTT_MAC_EID_JAPANESE = 1,
|
||||
STBTT_MAC_EID_HEBREW = 5,
|
||||
STBTT_MAC_EID_CHINESE_TRAD = 2,
|
||||
STBTT_MAC_EID_GREEK = 6,
|
||||
STBTT_MAC_EID_KOREAN = 3,
|
||||
STBTT_MAC_EID_RUSSIAN = 7,
|
||||
}
|
||||
|
||||
[NativeTypeName("unsigned int")]
|
||||
public enum StbttMsLang : uint
|
||||
{
|
||||
STBTT_MS_LANG_ENGLISH = 0x0409,
|
||||
STBTT_MS_LANG_ITALIAN = 0x0410,
|
||||
STBTT_MS_LANG_CHINESE = 0x0804,
|
||||
STBTT_MS_LANG_JAPANESE = 0x0411,
|
||||
STBTT_MS_LANG_DUTCH = 0x0413,
|
||||
STBTT_MS_LANG_KOREAN = 0x0412,
|
||||
STBTT_MS_LANG_FRENCH = 0x040c,
|
||||
STBTT_MS_LANG_RUSSIAN = 0x0419,
|
||||
STBTT_MS_LANG_GERMAN = 0x0407,
|
||||
STBTT_MS_LANG_SPANISH = 0x0409,
|
||||
STBTT_MS_LANG_HEBREW = 0x040d,
|
||||
STBTT_MS_LANG_SWEDISH = 0x041D,
|
||||
}
|
||||
|
||||
[NativeTypeName("unsigned int")]
|
||||
public enum StbttMacLang : uint
|
||||
{
|
||||
STBTT_MAC_LANG_ENGLISH = 0,
|
||||
STBTT_MAC_LANG_JAPANESE = 11,
|
||||
STBTT_MAC_LANG_ARABIC = 12,
|
||||
STBTT_MAC_LANG_KOREAN = 23,
|
||||
STBTT_MAC_LANG_DUTCH = 4,
|
||||
STBTT_MAC_LANG_RUSSIAN = 32,
|
||||
STBTT_MAC_LANG_FRENCH = 1,
|
||||
STBTT_MAC_LANG_SPANISH = 6,
|
||||
STBTT_MAC_LANG_GERMAN = 2,
|
||||
STBTT_MAC_LANG_SWEDISH = 5,
|
||||
STBTT_MAC_LANG_HEBREW = 10,
|
||||
STBTT_MAC_LANG_CHINESE_SIMPLIFIED = 33,
|
||||
STBTT_MAC_LANG_ITALIAN = 3,
|
||||
STBTT_MAC_LANG_CHINESE_TRAD = 19,
|
||||
}
|
||||
|
||||
public static unsafe partial class Stbtt
|
||||
{
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern void quik_stbtt_failed_assert_store([NativeTypeName("quik_failed_assert_cb_t")] IntPtr cb);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_BakeFontBitmap", ExactSpelling = true)]
|
||||
public static extern int BakeFontBitmap([NativeTypeName("const unsigned char *")] byte* data, int offset, float pixel_height, [NativeTypeName("unsigned char *")] byte* pixels, int pw, int ph, int first_char, int num_chars, stbtt_bakedchar* chardata);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetBakedQuad", ExactSpelling = true)]
|
||||
public static extern void GetBakedQuad([NativeTypeName("const stbtt_bakedchar *")] stbtt_bakedchar* chardata, int pw, int ph, int char_index, float* xpos, float* ypos, stbtt_aligned_quad* q, int opengl_fillrule);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetScaledFontVMetrics", ExactSpelling = true)]
|
||||
public static extern void GetScaledFontVMetrics([NativeTypeName("const unsigned char *")] byte* fontdata, int index, float size, float* ascent, float* descent, float* lineGap);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_PackBegin", ExactSpelling = true)]
|
||||
public static extern int PackBegin(stbtt_pack_context* spc, [NativeTypeName("unsigned char *")] byte* pixels, int width, int height, int stride_in_bytes, int padding, void* alloc_context);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_PackEnd", ExactSpelling = true)]
|
||||
public static extern void PackEnd(stbtt_pack_context* spc);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_PackFontRange", ExactSpelling = true)]
|
||||
public static extern int PackFontRange(stbtt_pack_context* spc, [NativeTypeName("const unsigned char *")] byte* fontdata, int font_index, float font_size, int first_unicode_char_in_range, int num_chars_in_range, stbtt_packedchar* chardata_for_range);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_PackFontRanges", ExactSpelling = true)]
|
||||
public static extern int PackFontRanges(stbtt_pack_context* spc, [NativeTypeName("const unsigned char *")] byte* fontdata, int font_index, stbtt_pack_range* ranges, int num_ranges);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_PackSetOversampling", ExactSpelling = true)]
|
||||
public static extern void PackSetOversampling(stbtt_pack_context* spc, [NativeTypeName("unsigned int")] uint h_oversample, [NativeTypeName("unsigned int")] uint v_oversample);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_PackSetSkipMissingCodepoints", ExactSpelling = true)]
|
||||
public static extern void PackSetSkipMissingCodepoints(stbtt_pack_context* spc, int skip);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetPackedQuad", ExactSpelling = true)]
|
||||
public static extern void GetPackedQuad([NativeTypeName("const stbtt_packedchar *")] stbtt_packedchar* chardata, int pw, int ph, int char_index, float* xpos, float* ypos, stbtt_aligned_quad* q, int align_to_integer);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_PackFontRangesGatherRects", ExactSpelling = true)]
|
||||
public static extern int PackFontRangesGatherRects(stbtt_pack_context* spc, [NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, stbtt_pack_range* ranges, int num_ranges, stbrp_rect* rects);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_PackFontRangesPackRects", ExactSpelling = true)]
|
||||
public static extern void PackFontRangesPackRects(stbtt_pack_context* spc, stbrp_rect* rects, int num_rects);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_PackFontRangesRenderIntoRects", ExactSpelling = true)]
|
||||
public static extern int PackFontRangesRenderIntoRects(stbtt_pack_context* spc, [NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, stbtt_pack_range* ranges, int num_ranges, stbrp_rect* rects);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetNumberOfFonts", ExactSpelling = true)]
|
||||
public static extern int GetNumberOfFonts([NativeTypeName("const unsigned char *")] byte* data);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetFontOffsetForIndex", ExactSpelling = true)]
|
||||
public static extern int GetFontOffsetForIndex([NativeTypeName("const unsigned char *")] byte* data, int index);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_InitFont", ExactSpelling = true)]
|
||||
public static extern int InitFont(stbtt_fontinfo* info, [NativeTypeName("const unsigned char *")] byte* data, int offset);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_FindGlyphIndex", ExactSpelling = true)]
|
||||
public static extern int FindGlyphIndex([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int unicode_codepoint);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_ScaleForPixelHeight", ExactSpelling = true)]
|
||||
public static extern float ScaleForPixelHeight([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, float pixels);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_ScaleForMappingEmToPixels", ExactSpelling = true)]
|
||||
public static extern float ScaleForMappingEmToPixels([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, float pixels);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetFontVMetrics", ExactSpelling = true)]
|
||||
public static extern void GetFontVMetrics([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int* ascent, int* descent, int* lineGap);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetFontVMetricsOS2", ExactSpelling = true)]
|
||||
public static extern int GetFontVMetricsOS2([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int* typoAscent, int* typoDescent, int* typoLineGap);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetFontBoundingBox", ExactSpelling = true)]
|
||||
public static extern void GetFontBoundingBox([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int* x0, int* y0, int* x1, int* y1);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetCodepointHMetrics", ExactSpelling = true)]
|
||||
public static extern void GetCodepointHMetrics([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int codepoint, int* advanceWidth, int* leftSideBearing);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetCodepointKernAdvance", ExactSpelling = true)]
|
||||
public static extern int GetCodepointKernAdvance([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int ch1, int ch2);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetCodepointBox", ExactSpelling = true)]
|
||||
public static extern int GetCodepointBox([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int codepoint, int* x0, int* y0, int* x1, int* y1);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetGlyphHMetrics", ExactSpelling = true)]
|
||||
public static extern void GetGlyphHMetrics([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int glyph_index, int* advanceWidth, int* leftSideBearing);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetGlyphKernAdvance", ExactSpelling = true)]
|
||||
public static extern int GetGlyphKernAdvance([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int glyph1, int glyph2);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetGlyphBox", ExactSpelling = true)]
|
||||
public static extern int GetGlyphBox([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int glyph_index, int* x0, int* y0, int* x1, int* y1);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetKerningTableLength", ExactSpelling = true)]
|
||||
public static extern int GetKerningTableLength([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetKerningTable", ExactSpelling = true)]
|
||||
public static extern int GetKerningTable([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, stbtt_kerningentry* table, int table_length);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_IsGlyphEmpty", ExactSpelling = true)]
|
||||
public static extern int IsGlyphEmpty([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int glyph_index);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetCodepointShape", ExactSpelling = true)]
|
||||
public static extern int GetCodepointShape([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int unicode_codepoint, stbtt_vertex** vertices);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetGlyphShape", ExactSpelling = true)]
|
||||
public static extern int GetGlyphShape([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int glyph_index, stbtt_vertex** vertices);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_FreeShape", ExactSpelling = true)]
|
||||
public static extern void FreeShape([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, stbtt_vertex* vertices);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_FindSVGDoc", ExactSpelling = true)]
|
||||
[return: NativeTypeName("unsigned char *")]
|
||||
public static extern byte* FindSVGDoc([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int gl);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetCodepointSVG", ExactSpelling = true)]
|
||||
public static extern int GetCodepointSVG([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int unicode_codepoint, [NativeTypeName("const char **")] sbyte** svg);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetGlyphSVG", ExactSpelling = true)]
|
||||
public static extern int GetGlyphSVG([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, int gl, [NativeTypeName("const char **")] sbyte** svg);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_FreeBitmap", ExactSpelling = true)]
|
||||
public static extern void FreeBitmap([NativeTypeName("unsigned char *")] byte* bitmap, void* userdata);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetCodepointBitmap", ExactSpelling = true)]
|
||||
[return: NativeTypeName("unsigned char *")]
|
||||
public static extern byte* GetCodepointBitmap([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, float scale_x, float scale_y, int codepoint, int* width, int* height, int* xoff, int* yoff);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetCodepointBitmapSubpixel", ExactSpelling = true)]
|
||||
[return: NativeTypeName("unsigned char *")]
|
||||
public static extern byte* GetCodepointBitmapSubpixel([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int* width, int* height, int* xoff, int* yoff);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_MakeCodepointBitmap", ExactSpelling = true)]
|
||||
public static extern void MakeCodepointBitmap([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, [NativeTypeName("unsigned char *")] byte* output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_MakeCodepointBitmapSubpixel", ExactSpelling = true)]
|
||||
public static extern void MakeCodepointBitmapSubpixel([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, [NativeTypeName("unsigned char *")] byte* output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_MakeCodepointBitmapSubpixelPrefilter", ExactSpelling = true)]
|
||||
public static extern void MakeCodepointBitmapSubpixelPrefilter([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, [NativeTypeName("unsigned char *")] byte* output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float* sub_x, float* sub_y, int codepoint);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetCodepointBitmapBox", ExactSpelling = true)]
|
||||
public static extern void GetCodepointBitmapBox([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* font, int codepoint, float scale_x, float scale_y, int* ix0, int* iy0, int* ix1, int* iy1);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetCodepointBitmapBoxSubpixel", ExactSpelling = true)]
|
||||
public static extern void GetCodepointBitmapBoxSubpixel([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* font, int codepoint, float scale_x, float scale_y, float shift_x, float shift_y, int* ix0, int* iy0, int* ix1, int* iy1);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetGlyphBitmap", ExactSpelling = true)]
|
||||
[return: NativeTypeName("unsigned char *")]
|
||||
public static extern byte* GetGlyphBitmap([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, float scale_x, float scale_y, int glyph, int* width, int* height, int* xoff, int* yoff);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetGlyphBitmapSubpixel", ExactSpelling = true)]
|
||||
[return: NativeTypeName("unsigned char *")]
|
||||
public static extern byte* GetGlyphBitmapSubpixel([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, float scale_x, float scale_y, float shift_x, float shift_y, int glyph, int* width, int* height, int* xoff, int* yoff);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_MakeGlyphBitmap", ExactSpelling = true)]
|
||||
public static extern void MakeGlyphBitmap([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, [NativeTypeName("unsigned char *")] byte* output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_MakeGlyphBitmapSubpixel", ExactSpelling = true)]
|
||||
public static extern void MakeGlyphBitmapSubpixel([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, [NativeTypeName("unsigned char *")] byte* output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_MakeGlyphBitmapSubpixelPrefilter", ExactSpelling = true)]
|
||||
public static extern void MakeGlyphBitmapSubpixelPrefilter([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, [NativeTypeName("unsigned char *")] byte* output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float* sub_x, float* sub_y, int glyph);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetGlyphBitmapBox", ExactSpelling = true)]
|
||||
public static extern void GetGlyphBitmapBox([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* font, int glyph, float scale_x, float scale_y, int* ix0, int* iy0, int* ix1, int* iy1);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetGlyphBitmapBoxSubpixel", ExactSpelling = true)]
|
||||
public static extern void GetGlyphBitmapBoxSubpixel([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* font, int glyph, float scale_x, float scale_y, float shift_x, float shift_y, int* ix0, int* iy0, int* ix1, int* iy1);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_Rasterize", ExactSpelling = true)]
|
||||
public static extern void Rasterize(stbtt__bitmap* result, float flatness_in_pixels, stbtt_vertex* vertices, int num_verts, float scale_x, float scale_y, float shift_x, float shift_y, int x_off, int y_off, int invert, void* userdata);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_FreeSDF", ExactSpelling = true)]
|
||||
public static extern void FreeSDF([NativeTypeName("unsigned char *")] byte* bitmap, void* userdata);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetGlyphSDF", ExactSpelling = true)]
|
||||
[return: NativeTypeName("unsigned char *")]
|
||||
public static extern byte* GetGlyphSDF([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, float scale, int glyph, int padding, [NativeTypeName("unsigned char")] byte onedge_value, float pixel_dist_scale, int* width, int* height, int* xoff, int* yoff);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetCodepointSDF", ExactSpelling = true)]
|
||||
[return: NativeTypeName("unsigned char *")]
|
||||
public static extern byte* GetCodepointSDF([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* info, float scale, int codepoint, int padding, [NativeTypeName("unsigned char")] byte onedge_value, float pixel_dist_scale, int* width, int* height, int* xoff, int* yoff);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_FindMatchingFont", ExactSpelling = true)]
|
||||
public static extern int FindMatchingFont([NativeTypeName("const unsigned char *")] byte* fontdata, [NativeTypeName("const char *")] sbyte* name, int flags);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_CompareUTF8toUTF16_bigendian", ExactSpelling = true)]
|
||||
public static extern int CompareUTF8toUTF16_bigendian([NativeTypeName("const char *")] sbyte* s1, int len1, [NativeTypeName("const char *")] sbyte* s2, int len2);
|
||||
|
||||
[DllImport("stbtt", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbtt_GetFontNameString", ExactSpelling = true)]
|
||||
[return: NativeTypeName("const char *")]
|
||||
public static extern sbyte* GetFontNameString([NativeTypeName("const stbtt_fontinfo *")] stbtt_fontinfo* font, int* length, int platformID, int encodingID, int languageID, int nameID);
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
cd $(dirname "$0")
|
||||
../sh/quik_build_native.sh .
|
@ -1,30 +0,0 @@
|
||||
-x
|
||||
c
|
||||
-l
|
||||
stbtt
|
||||
--config
|
||||
compatible-codegen
|
||||
single-file
|
||||
exclude-fnptr-codegen
|
||||
generate-aggressive-inlining
|
||||
generate-setslastsystemerror-attribute
|
||||
unix-types
|
||||
--include-directory
|
||||
../lib
|
||||
--include-directory
|
||||
../Quik.StbTrueType.redist
|
||||
--include-directory
|
||||
/usr/lib/llvm-14/lib/clang/14.0.6/include
|
||||
--file
|
||||
../Quik.StbTrueType.redist/quik_stbtt.h
|
||||
../lib/stb/stb_truetype.h
|
||||
--methodClassName
|
||||
Stbtt
|
||||
--namespace
|
||||
Quik.Stb
|
||||
--output
|
||||
Stbtt.cs
|
||||
--prefixStrip
|
||||
stbtt_
|
||||
--with-type
|
||||
FILE=void
|
@ -1,6 +0,0 @@
|
||||
#include "quik_stbtt.h"
|
||||
|
||||
QUIK_DEFINE_LIB(quik_stbtt);
|
||||
|
||||
#define STB_TRUETYPE_IMPLEMENTATION 1
|
||||
#include "stb/stb_truetype.h"
|
@ -1,14 +0,0 @@
|
||||
#ifndef _QUIK_STBTT_H_
|
||||
#define _QUIK_STBTT_H_
|
||||
|
||||
#include "quik/quik_common.h"
|
||||
|
||||
QUIK_DECLARE_LIB(quik_stbtt);
|
||||
|
||||
#define STBTT_assert(EXPR) do { \
|
||||
quik_stbtt_failed_assert(#EXPR, __FILE__, __LINE__ - 2, __QUIK_FUNCTION__); \
|
||||
} while(0)
|
||||
|
||||
#include "stb/stb_truetype.h"
|
||||
|
||||
#endif
|
61
Quik.sln
@ -1,21 +1,17 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
#
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quik", "Quik\Quik.csproj", "{B86B2B99-DAE4-43CE-A040-1D8E143B94A7}"
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34701.34
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Quik", "Quik\Quik.csproj", "{B86B2B99-DAE4-43CE-A040-1D8E143B94A7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quik.OpenTK", "Quik.OpenTK\Quik.OpenTK.csproj", "{586E5E28-1D07-4CC2-B04F-0BC420564F57}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quik.StbImage", "Quik.StbImage\Quik.StbImage.csproj", "{B1D7A987-F50A-4B6C-943D-F74525431BF5}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Quik.OpenTK", "Quik.OpenTK\Quik.OpenTK.csproj", "{586E5E28-1D07-4CC2-B04F-0BC420564F57}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{AE05ADE5-A809-479F-97D5-BEAFE7604285}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quik.Stb.Tests", "tests\Quik.Stb.Tests\Quik.Stb.Tests.csproj", "{BC7D3002-B79B-4141-B6CC-74FB2175B474}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QuikDemo", "tests\QuikDemo\QuikDemo.csproj", "{79CBF97F-4884-4692-94FB-75DDEB61E26F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuikDemo", "tests\QuikDemo\QuikDemo.csproj", "{79CBF97F-4884-4692-94FB-75DDEB61E26F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quik.Media.Defaults", "Quik.Media.Defaults\Quik.Media.Defaults.csproj", "{B517D2BF-CB9D-4448-BE50-EA85E100EB47}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quik.FreeType", "Quik.FreeType\Quik.FreeType.csproj", "{D19734B9-E54F-4CED-B49A-998608801843}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Quik.Media.Defaults", "Quik.Media.Defaults\Quik.Media.Defaults.csproj", "{B517D2BF-CB9D-4448-BE50-EA85E100EB47}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -51,30 +47,6 @@ Global
|
||||
{586E5E28-1D07-4CC2-B04F-0BC420564F57}.Release|x64.Build.0 = Release|Any CPU
|
||||
{586E5E28-1D07-4CC2-B04F-0BC420564F57}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{586E5E28-1D07-4CC2-B04F-0BC420564F57}.Release|x86.Build.0 = Release|Any CPU
|
||||
{B1D7A987-F50A-4B6C-943D-F74525431BF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B1D7A987-F50A-4B6C-943D-F74525431BF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B1D7A987-F50A-4B6C-943D-F74525431BF5}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{B1D7A987-F50A-4B6C-943D-F74525431BF5}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{B1D7A987-F50A-4B6C-943D-F74525431BF5}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{B1D7A987-F50A-4B6C-943D-F74525431BF5}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{B1D7A987-F50A-4B6C-943D-F74525431BF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B1D7A987-F50A-4B6C-943D-F74525431BF5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B1D7A987-F50A-4B6C-943D-F74525431BF5}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{B1D7A987-F50A-4B6C-943D-F74525431BF5}.Release|x64.Build.0 = Release|Any CPU
|
||||
{B1D7A987-F50A-4B6C-943D-F74525431BF5}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{B1D7A987-F50A-4B6C-943D-F74525431BF5}.Release|x86.Build.0 = Release|Any CPU
|
||||
{BC7D3002-B79B-4141-B6CC-74FB2175B474}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BC7D3002-B79B-4141-B6CC-74FB2175B474}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BC7D3002-B79B-4141-B6CC-74FB2175B474}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{BC7D3002-B79B-4141-B6CC-74FB2175B474}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{BC7D3002-B79B-4141-B6CC-74FB2175B474}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{BC7D3002-B79B-4141-B6CC-74FB2175B474}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{BC7D3002-B79B-4141-B6CC-74FB2175B474}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BC7D3002-B79B-4141-B6CC-74FB2175B474}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BC7D3002-B79B-4141-B6CC-74FB2175B474}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{BC7D3002-B79B-4141-B6CC-74FB2175B474}.Release|x64.Build.0 = Release|Any CPU
|
||||
{BC7D3002-B79B-4141-B6CC-74FB2175B474}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{BC7D3002-B79B-4141-B6CC-74FB2175B474}.Release|x86.Build.0 = Release|Any CPU
|
||||
{79CBF97F-4884-4692-94FB-75DDEB61E26F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{79CBF97F-4884-4692-94FB-75DDEB61E26F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{79CBF97F-4884-4692-94FB-75DDEB61E26F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
@ -99,21 +71,14 @@ Global
|
||||
{B517D2BF-CB9D-4448-BE50-EA85E100EB47}.Release|x64.Build.0 = Release|Any CPU
|
||||
{B517D2BF-CB9D-4448-BE50-EA85E100EB47}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{B517D2BF-CB9D-4448-BE50-EA85E100EB47}.Release|x86.Build.0 = Release|Any CPU
|
||||
{D19734B9-E54F-4CED-B49A-998608801843}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D19734B9-E54F-4CED-B49A-998608801843}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D19734B9-E54F-4CED-B49A-998608801843}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{D19734B9-E54F-4CED-B49A-998608801843}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{D19734B9-E54F-4CED-B49A-998608801843}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D19734B9-E54F-4CED-B49A-998608801843}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{D19734B9-E54F-4CED-B49A-998608801843}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D19734B9-E54F-4CED-B49A-998608801843}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D19734B9-E54F-4CED-B49A-998608801843}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{D19734B9-E54F-4CED-B49A-998608801843}.Release|x64.Build.0 = Release|Any CPU
|
||||
{D19734B9-E54F-4CED-B49A-998608801843}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D19734B9-E54F-4CED-B49A-998608801843}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{BC7D3002-B79B-4141-B6CC-74FB2175B474} = {AE05ADE5-A809-479F-97D5-BEAFE7604285}
|
||||
{79CBF97F-4884-4692-94FB-75DDEB61E26F} = {AE05ADE5-A809-479F-97D5-BEAFE7604285}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {EF011093-DA56-4E14-B2AB-D565B64F73E1}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@ -1,79 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="46.12664pt"
|
||||
height="18.818359pt"
|
||||
viewBox="0 0 16.272453 6.6386992"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||
sodipodi:docname="quik.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#ffffff"
|
||||
borderopacity="1"
|
||||
inkscape:pageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="1"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
fit-margin-top="2"
|
||||
fit-margin-left="2"
|
||||
fit-margin-right="2"
|
||||
fit-margin-bottom="2"
|
||||
inkscape:zoom="8.2344211"
|
||||
inkscape:cx="30.846127"
|
||||
inkscape:cy="13.965766"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1015"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1"
|
||||
lock-margins="true"
|
||||
units="pt" />
|
||||
<defs
|
||||
id="defs2" />
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-29.294981,-112.71488)">
|
||||
<g
|
||||
id="g25273">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:6.35px;line-height:1.25;font-family:sans-serif;stroke-width:0.264583"
|
||||
x="29.445532"
|
||||
y="118.04341"
|
||||
id="text2725"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2723"
|
||||
style="font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:'Arial Bold Italic';stroke-width:0.264583"
|
||||
x="29.445532"
|
||||
y="118.04341">Q</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:italic;font-weight:bold;font-size:5.99722px;line-height:1.25;font-family:Arial;-inkscape-font-specification:'Arial Bold Italic';stroke-width:0.264583"
|
||||
x="34.059269"
|
||||
y="117.71337"
|
||||
id="text16833"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan16831"
|
||||
style="font-size:5.99722px;stroke-width:0.264583"
|
||||
x="34.059269"
|
||||
y="117.71337">UIK</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 34.395642,118.32379 H 44.759014"
|
||||
id="path20974"
|
||||
sodipodi:nodetypes="cc" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.7 KiB |
@ -1,99 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="32"
|
||||
height="32"
|
||||
viewBox="0 0 32 32"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
sodipodi:docname="quik_ico.svg"
|
||||
inkscape:export-filename="quik_ico_16.png"
|
||||
inkscape:export-xdpi="48"
|
||||
inkscape:export-ydpi="48"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#111111"
|
||||
borderopacity="1"
|
||||
inkscape:showpageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="1"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="px"
|
||||
showgrid="false"
|
||||
inkscape:zoom="5.9736381"
|
||||
inkscape:cx="20.088261"
|
||||
inkscape:cy="37.163283"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1011"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="32"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs2" />
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<rect
|
||||
style="fill:#2b7171;fill-opacity:1;stroke-width:3.77953;stroke-linecap:round;stroke-linejoin:round;stop-color:#000000"
|
||||
id="rect234"
|
||||
width="32"
|
||||
height="32"
|
||||
x="0"
|
||||
y="0"
|
||||
rx="4" />
|
||||
<g
|
||||
id="g7146"
|
||||
transform="matrix(0.7997283,0,0,0.7997283,3.2043471,3.2043471)">
|
||||
<rect
|
||||
style="fill:#ececec;fill-opacity:1;stroke:#b3b3b3;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stop-color:#000000"
|
||||
id="rect3812"
|
||||
width="26.564432"
|
||||
height="26.564432"
|
||||
x="2.7177837"
|
||||
y="2.7177837" />
|
||||
<rect
|
||||
style="fill:#0055e0;fill-opacity:1;stroke:#b3b3b3;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stop-color:#000000"
|
||||
id="rect4126"
|
||||
width="26.564432"
|
||||
height="3.411391"
|
||||
x="2.7177837"
|
||||
y="2.7177837" />
|
||||
<rect
|
||||
style="fill:#f9f9f9;fill-opacity:1;stroke:#b3b3b3;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stop-color:#000000;font-variation-settings:normal;opacity:1;vector-effect:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-opacity:1"
|
||||
id="rect7200"
|
||||
width="6.5566258"
|
||||
height="3.411391"
|
||||
x="22.725592"
|
||||
y="2.7177839" />
|
||||
<path
|
||||
style="fill:none;stroke:#fefefe;stroke-width:1.25042;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 4.582004,4.4234793 h 9.179619"
|
||||
id="path7392" />
|
||||
<path
|
||||
style="fill:none;stroke:#999999;stroke-width:1.25042;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 24.672729,4.4234794 h 2.662352"
|
||||
id="path7394"
|
||||
sodipodi:nodetypes="cc" />
|
||||
</g>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:18px;line-height:1.25;font-family:Arial;-inkscape-font-specification:'Arial Bold Italic';fill:#0055e0;fill-opacity:1"
|
||||
x="15.160645"
|
||||
y="23.162577"
|
||||
id="text6366"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan6364"
|
||||
x="15.160645"
|
||||
y="23.162577"
|
||||
style="font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:'Arial Bold Italic';text-align:center;text-anchor:middle;fill:#0055e0;fill-opacity:1">Q</tspan></text>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 543 B |
Before Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.9 KiB |
@ -1,13 +0,0 @@
|
||||
# QUIK Toolchain file for Linux-arm systems.
|
||||
# Copyright (C) 2023
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
|
||||
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
|
||||
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH "/usr/arm-linux-gnueabihf")
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
@ -1,13 +0,0 @@
|
||||
# QUIK Toolchain file for Linux-arm64 (aarch64) systems.
|
||||
# Copyright (C) 2023
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
|
||||
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
|
||||
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH "/usr/aarch64-linux-gnu")
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
@ -1,9 +0,0 @@
|
||||
# QUIK Toolchain file for Linux-x64 (amd64) systems.
|
||||
# Copyright (C) 2023
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
|
||||
set(CMAKE_C_COMPILER gcc)
|
||||
set(CMAKE_CXX_COMPILER g++)
|
||||
|
||||
add_compile_options(-m64)
|
@ -1,14 +0,0 @@
|
||||
# QUIK Toolchain file for Linux-x86 (i386) systems.
|
||||
# Copyright (C) 2023
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
|
||||
set(CMAKE_C_COMPILER i686-linux-gnu-gcc)
|
||||
set(CMAKE_CXX_COMPILER i686-linux-gnu-g++)
|
||||
|
||||
add_compile_options(-m32 -march=i686)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH "/usr/i686-linux-gnu")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
@ -1,14 +0,0 @@
|
||||
# QUIK Toolchain file for Windows-x64 systems.
|
||||
# Copyright (C) 2023
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
|
||||
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32")
|
||||
add_compile_options(-m64)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
@ -1,14 +0,0 @@
|
||||
# QUIK Toolchain file for Windows-x86 systems.
|
||||
# Copyright (C) 2023
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
set(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
|
||||
set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32")
|
||||
add_compile_options(-m32)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
@ -1,47 +0,0 @@
|
||||
#ifndef _QUIK_COMMON_H_
|
||||
#define _QUIK_COMMON_H_
|
||||
|
||||
#include "stdlib.h"
|
||||
|
||||
#if __GNUC__ || __MSC_VER
|
||||
#define __QUIK_FUNCTION__ __FUNCTION__
|
||||
#define QEXTERN extern
|
||||
#else
|
||||
#define __QUIK_FUNCTION__ NULL
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Callback for failed assert function for QUIK redist libraries.
|
||||
* @param[in] expr The expression that failed.
|
||||
* @param[in] file The failing file (if available)
|
||||
* @param[in] line The failing line number (if available)
|
||||
* @param[in] func The failing function (if available)
|
||||
*/
|
||||
typedef void (*quik_failed_assert_cb_t)(const char *expr, const char *file, int line, const char* func);
|
||||
|
||||
#define DECLARE_ASSERT_CB(NAME) \
|
||||
QEXTERN quik_failed_assert_cb_t NAME##_failed_assert
|
||||
#define DECLARE_ASSERT_STORE(NAME) \
|
||||
QEXTERN void NAME##_failed_assert_store(quik_failed_assert_cb_t cb)
|
||||
|
||||
#define DEFINE_ASSERT_CB(NAME) \
|
||||
quik_failed_assert_cb_t NAME##_failed_assert
|
||||
#define DEFINE_ASSERT_STORE(NAME) \
|
||||
void NAME##_failed_assert_store(quik_failed_assert_cb_t cb) { \
|
||||
NAME##_failed_assert = cb != NULL ? cb : quik_default_assert; \
|
||||
}
|
||||
|
||||
#define QUIK_DECLARE_LIB(NAME) \
|
||||
DECLARE_ASSERT_CB(NAME); \
|
||||
DECLARE_ASSERT_STORE(NAME);
|
||||
|
||||
#define QUIK_DEFINE_LIB(NAME) \
|
||||
DEFINE_ASSERT_CB(NAME); \
|
||||
DEFINE_ASSERT_STORE(NAME);
|
||||
|
||||
inline static void quik_default_assert(const char *expr, const char *file, int line, const char *function)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
#endif
|
@ -1,5 +0,0 @@
|
||||
source $HOME/src/sh/init.sh
|
||||
echo QUIK Project Copyright \(C\) 2023
|
||||
echo
|
||||
echo This is an interactive shell for QUIK build image.
|
||||
echo SuperUser \(su/sudo\) commands are enabled without a password. Beware.
|
13
sh/init.sh
@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Change to source directory
|
||||
cd $HOME/src
|
||||
|
||||
export QUIK_SRC=$PWD
|
||||
export QNUGET_LOCAL=QuikLocal
|
||||
export QNUGET_LOCAL_PATH=$QUIK_SRC/nuget_repo
|
||||
# export QNUGET_REMOTE=nuget
|
||||
|
||||
# Create nuget repository.
|
||||
mkdir -p $QUIK_SRC/nuget_repo
|
||||
nuget sources Add -Name $QNUGET_LOCAL -Source $QNUGET_LOCAL_PATH -NonInteractive
|
@ -1,49 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# $1 Source path of the project.
|
||||
# $2 Target architecture list.
|
||||
# DST is the destination directory.
|
||||
|
||||
SRC=$1
|
||||
ARCHS=$2
|
||||
|
||||
if [ -z "$SRC" ]
|
||||
then
|
||||
echo You need to provide a source path.
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$ARCHS" ]
|
||||
then
|
||||
ARCHS="linux-arm linux-arm64 linux-x64 win-x64 win-x86"
|
||||
fi
|
||||
|
||||
if [ -z "$DST" ]
|
||||
then
|
||||
DST=$PWD
|
||||
fi
|
||||
|
||||
for ARCH in $ARCHS; do
|
||||
# Output directory.
|
||||
PREFIX=$DST/runtimes/$ARCH/native
|
||||
# Build directory.
|
||||
BUILD=$DST/out/$ARCH
|
||||
# Cmake toolchain file.
|
||||
TOOLCHAIN=$DST/../cmake/$ARCH.cmake
|
||||
|
||||
# Create directories.
|
||||
mkdir -p $PREFIX $BUILD
|
||||
# Configure CMAKE.
|
||||
cmake -B $BUILD -S $SRC \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_FLAGS=-static-libgcc \
|
||||
-DCMAKE_CXX_FLAGS=-static-libgcc \
|
||||
-DCMAKE_INSTALL_PREFIX=$PREFIX \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN \
|
||||
$QUIK_ADDITIONAL_CMAKE
|
||||
|
||||
# Build and install.
|
||||
ninja -C $BUILD all
|
||||
ninja -C $BUILD install
|
||||
done
|
@ -1,72 +0,0 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Quik.Stb;
|
||||
|
||||
namespace Quik.Stb
|
||||
{
|
||||
[TestClass]
|
||||
[TestCategory("Load Font")]
|
||||
public class LoadFont
|
||||
{
|
||||
StbFont? font;
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
using (Stream? str = GetType().Assembly.GetManifestResourceStream("Quik.Stb.Tests.res.Varicka.ttf"))
|
||||
{
|
||||
Assert.IsNotNull(str, "Test font file not packed.");
|
||||
font = StbFont.Load(str);
|
||||
}
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void Deinitialize()
|
||||
{
|
||||
font?.Dispose();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AscendIsValid()
|
||||
{
|
||||
Assert.AreNotEqual(-1, font!.Ascend);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DescendIsValid()
|
||||
{
|
||||
Assert.AreNotEqual(-1, font!.Descend);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void VLineGapIsValid()
|
||||
{
|
||||
Assert.AreNotEqual(-1, font!.VerticalLineGap);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void BBoxIsValid()
|
||||
{
|
||||
Assert.AreNotEqual(default, font!.BoundingBox);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void KerningTableIsValid()
|
||||
{
|
||||
Assert.IsNotNull(font!.KerningTable);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetGlyphsForAscii()
|
||||
{
|
||||
for (int i = 0; i < 128; i++)
|
||||
{
|
||||
int glyph = font!.FindGlyphIndex(i);
|
||||
|
||||
Assert.AreNotEqual(-1, glyph);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.IO;
|
||||
|
||||
namespace Quik.Stb.Tests
|
||||
{
|
||||
[TestClass]
|
||||
[TestCategory("Load Image")]
|
||||
public class LoadImage
|
||||
{
|
||||
[TestMethod("Set Global Options")]
|
||||
public void SetGlobals()
|
||||
{
|
||||
Quik.Stb.StbImage.FlipVerticallyOnLoad = true;
|
||||
Quik.Stb.StbImage.UnpremultiplyOnLoad = true;
|
||||
}
|
||||
|
||||
private Stream GetImage(string path)
|
||||
{
|
||||
Stream? str = GetType().Assembly.GetManifestResourceStream(path);
|
||||
Assert.IsNotNull(str, $"Could not find test image resource {path}.");
|
||||
return str;
|
||||
}
|
||||
|
||||
private unsafe void TestImage(string path, int width, int height)
|
||||
{
|
||||
StbImage image = StbImage.Load(GetImage(path));
|
||||
|
||||
Assert.IsNotNull(image);
|
||||
|
||||
Assert.AreEqual(width, image.Width, "Width does not match.");
|
||||
Assert.AreEqual(height, image.Height, "Height does not match.");
|
||||
|
||||
image.Dispose();
|
||||
}
|
||||
|
||||
const int WIDTH = 768;
|
||||
const int HEIGHT = 512;
|
||||
|
||||
[TestMethod("Load a single frame GIF")]
|
||||
public unsafe void LoadGif() => TestImage("Quik.Stb.Tests.res.kodim.kodim23.gif", WIDTH, HEIGHT);
|
||||
[TestMethod("Load a JPEG")]
|
||||
public unsafe void LoadJpg() => TestImage("Quik.Stb.Tests.res.kodim.kodim23.jpg", WIDTH, HEIGHT);
|
||||
[TestMethod("Load a PNG")] public unsafe void LoadPng() => TestImage("Quik.Stb.Tests.res.kodim.kodim23.png", WIDTH, HEIGHT);
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="res/**"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Quik.StbImage\Quik.StbImage.csproj" />
|
||||
<ProjectReference Include="..\..\Quik.StbTrueType\Quik.StbTrueType.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,12 +0,0 @@
|
||||
Varicka (Truetype and Opentype with no OT features)
|
||||
|
||||
Based on 'Varick', from "Decorative Condensed Alphabets", by Dan Solo, Page 94.
|
||||
|
||||
Letter spacing is set to balance the letterforms themselves; the space between most adjacent letters is identical to the horizontal space inside such letters as 'O' and 'H'. Kerning is supplied as needed for certain letter combinations, particularly those that have a letter with a projection on the left, such as A, E, F, H, K, P, and R.
|
||||
|
||||
Varicka is superficially similar to Red Rooster's Triple Gothic Condensed, but the Solo book's font has different features and some very different letterforms.
|
||||
|
||||
This font is free and available for all use, personal and commercial, with no restrictions.
|
||||
|
||||
Character
|
||||
February 13, 2010
|
@ -1,3 +0,0 @@
|
||||
Kodak Image Suite Test Images owned by Kodak. Image 23 was taken by Steve Kelly.
|
||||
The original image file kodim23.png and its derivatives are only included for
|
||||
test purposes only and should not be redistributed with the software.
|
Before Width: | Height: | Size: 156 KiB |
Before Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 544 KiB |
Before Width: | Height: | Size: 55 KiB |