using System;
using System.Runtime.InteropServices;

namespace SDL2
{
	public static class SDL_ttf
	{
		public static void SDL_TTF_VERSION(out SDL.SDL_version X)
		{
			X.major = 2;
			X.minor = 0;
			X.patch = 12;
		}

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl, EntryPoint = "TTF_LinkedVersion")]
		private static extern IntPtr INTERNAL_TTF_LinkedVersion();

		public static SDL.SDL_version TTF_LinkedVersion()
		{
			return (SDL.SDL_version)Marshal.PtrToStructure(SDL_ttf.INTERNAL_TTF_LinkedVersion(), typeof(SDL.SDL_version));
		}

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern void TTF_ByteSwappedUNICODE(int swapped);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_Init();

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl, EntryPoint = "TTF_OpenFont")]
		private static extern IntPtr INTERNAL_TTF_OpenFont(byte[] file, int ptsize);

		public static IntPtr TTF_OpenFont(string file, int ptsize)
		{
			return SDL_ttf.INTERNAL_TTF_OpenFont(SDL.UTF8_ToNative(file), ptsize);
		}

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr TTF_OpenFontRW(IntPtr src, int freesrc, int ptsize);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl, EntryPoint = "TTF_OpenFontIndex")]
		private static extern IntPtr INTERNAL_TTF_OpenFontIndex(byte[] file, int ptsize, long index);

		public static IntPtr TTF_OpenFontIndex(string file, int ptsize, long index)
		{
			return SDL_ttf.INTERNAL_TTF_OpenFontIndex(SDL.UTF8_ToNative(file), ptsize, index);
		}

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr TTF_OpenFontIndexRW(IntPtr src, int freesrc, int ptsize, long index);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_GetFontStyle(IntPtr font);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern void TTF_SetFontStyle(IntPtr font, int style);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_GetFontOutline(IntPtr font);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern void TTF_SetFontOutline(IntPtr font, int outline);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_GetFontHinting(IntPtr font);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern void TTF_SetFontHinting(IntPtr font, int hinting);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_FontHeight(IntPtr font);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_FontAscent(IntPtr font);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_FontDescent(IntPtr font);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_FontLineSkip(IntPtr font);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_GetFontKerning(IntPtr font);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern void TTF_SetFontKerning(IntPtr font, int allowed);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern long TTF_FontFaces(IntPtr font);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_FontFaceIsFixedWidth(IntPtr font);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl, EntryPoint = "TTF_FontFaceFamilyName")]
		private static extern IntPtr INTERNAL_TTF_FontFaceFamilyName(IntPtr font);

		public static string TTF_FontFaceFamilyName(IntPtr font)
		{
			return SDL.UTF8_ToManaged(SDL_ttf.INTERNAL_TTF_FontFaceFamilyName(font), false);
		}

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl, EntryPoint = "TTF_FontFaceStyleName")]
		private static extern IntPtr INTERNAL_TTF_FontFaceStyleName(IntPtr font);

		public static string TTF_FontFaceStyleName(IntPtr font)
		{
			return SDL.UTF8_ToManaged(SDL_ttf.INTERNAL_TTF_FontFaceStyleName(font), false);
		}

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_GlyphIsProvided(IntPtr font, ushort ch);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_GlyphMetrics(IntPtr font, ushort ch, out int minx, out int maxx, out int miny, out int maxy, out int advance);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_SizeText(IntPtr font, [MarshalAs(UnmanagedType.LPStr)] [In] string text, out int w, out int h);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl, EntryPoint = "TTF_SizeUTF8")]
		public static extern int INTERNAL_TTF_SizeUTF8(IntPtr font, byte[] text, out int w, out int h);

		public static int TTF_SizeUTF8(IntPtr font, string text, out int w, out int h)
		{
			return SDL_ttf.INTERNAL_TTF_SizeUTF8(font, SDL.UTF8_ToNative(text), out w, out h);
		}

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_SizeUNICODE(IntPtr font, [MarshalAs(UnmanagedType.LPWStr)] [In] string text, out int w, out int h);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr TTF_RenderText_Solid(IntPtr font, [MarshalAs(UnmanagedType.LPStr)] [In] string text, SDL.SDL_Color fg);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl, EntryPoint = "TTF_RenderUTF8_Solid")]
		private static extern IntPtr INTERNAL_TTF_RenderUTF8_Solid(IntPtr font, byte[] text, SDL.SDL_Color fg);

		public static IntPtr TTF_RenderUTF8_Solid(IntPtr font, string text, SDL.SDL_Color fg)
		{
			return SDL_ttf.INTERNAL_TTF_RenderUTF8_Solid(font, SDL.UTF8_ToNative(text), fg);
		}

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr TTF_RenderUNICODE_Solid(IntPtr font, [MarshalAs(UnmanagedType.LPWStr)] [In] string text, SDL.SDL_Color fg);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr TTF_RenderGlyph_Solid(IntPtr font, ushort ch, SDL.SDL_Color fg);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr TTF_RenderText_Shaded(IntPtr font, [MarshalAs(UnmanagedType.LPStr)] [In] string text, SDL.SDL_Color fg, SDL.SDL_Color bg);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl, EntryPoint = "TTF_RenderUTF8_Shaded")]
		private static extern IntPtr INTERNAL_TTF_RenderUTF8_Shaded(IntPtr font, byte[] text, SDL.SDL_Color fg, SDL.SDL_Color bg);

		public static IntPtr TTF_RenderUTF8_Shaded(IntPtr font, string text, SDL.SDL_Color fg, SDL.SDL_Color bg)
		{
			return SDL_ttf.INTERNAL_TTF_RenderUTF8_Shaded(font, SDL.UTF8_ToNative(text), fg, bg);
		}

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr TTF_RenderUNICODE_Shaded(IntPtr font, [MarshalAs(UnmanagedType.LPWStr)] [In] string text, SDL.SDL_Color fg, SDL.SDL_Color bg);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr TTF_RenderGlyph_Shaded(IntPtr font, ushort ch, SDL.SDL_Color fg, SDL.SDL_Color bg);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr TTF_RenderText_Blended(IntPtr font, [MarshalAs(UnmanagedType.LPStr)] [In] string text, SDL.SDL_Color fg);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl, EntryPoint = "TTF_RenderUTF8_Blended")]
		private static extern IntPtr INTERNAL_TTF_RenderUTF8_Blended(IntPtr font, byte[] text, SDL.SDL_Color fg);

		public static IntPtr TTF_RenderUTF8_Blended(IntPtr font, string text, SDL.SDL_Color fg)
		{
			return SDL_ttf.INTERNAL_TTF_RenderUTF8_Blended(font, SDL.UTF8_ToNative(text), fg);
		}

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr TTF_RenderUNICODE_Blended(IntPtr font, [MarshalAs(UnmanagedType.LPWStr)] [In] string text, SDL.SDL_Color fg);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr TTF_RenderText_Blended_Wrapped(IntPtr font, [MarshalAs(UnmanagedType.LPStr)] [In] string text, SDL.SDL_Color fg, uint wrapped);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl, EntryPoint = "TTF_RenderUTF8_Blended_Wrapped")]
		private static extern IntPtr INTERNAL_TTF_RenderUTF8_Blended_Wrapped(IntPtr font, byte[] text, SDL.SDL_Color fg, uint wrapped);

		public static IntPtr TTF_RenderUTF8_Blended_Wrapped(IntPtr font, string text, SDL.SDL_Color fg, uint wrapped)
		{
			return SDL_ttf.INTERNAL_TTF_RenderUTF8_Blended_Wrapped(font, SDL.UTF8_ToNative(text), fg, wrapped);
		}

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr TTF_RenderUNICODE_Blended_Wrapped(IntPtr font, [MarshalAs(UnmanagedType.LPWStr)] [In] string text, SDL.SDL_Color fg, uint wrapped);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr TTF_RenderGlyph_Blended(IntPtr font, ushort ch, SDL.SDL_Color fg);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern void TTF_CloseFont(IntPtr font);

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern void TTF_Quit();

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int TTF_WasInit();

		[DllImport("SDL2_ttf", CallingConvention = CallingConvention.Cdecl)]
		public static extern int SDL_GetFontKerningSize(IntPtr font, int prev_index, int index);

		private const string nativeLibName = "SDL2_ttf";

		public const int SDL_TTF_MAJOR_VERSION = 2;

		public const int SDL_TTF_MINOR_VERSION = 0;

		public const int SDL_TTF_PATCHLEVEL = 12;

		public const int UNICODE_BOM_NATIVE = 65279;

		public const int UNICODE_BOM_SWAPPED = 65534;

		public const int TTF_STYLE_NORMAL = 0;

		public const int TTF_STYLE_BOLD = 1;

		public const int TTF_STYLE_ITALIC = 2;

		public const int TTF_STYLE_UNDERLINE = 4;

		public const int TTF_STYLE_STRIKETHROUGH = 8;

		public const int TTF_HINTING_NORMAL = 0;

		public const int TTF_HINTING_LIGHT = 1;

		public const int TTF_HINTING_MONO = 2;

		public const int TTF_HINTING_NONE = 3;
	}
}
