Browse Source

* fixed library parameter (removed const where not needed)

* implemented header and example for c
* update submodle: TextSuite
master
Bergmann89 8 years ago
parent
commit
23dae69503
15 changed files with 1571 additions and 418 deletions
  1. +1
    -1
      TextSuite
  2. +169
    -0
      header/examples/c/example.c
  3. +10
    -0
      header/examples/c/example.h
  4. +11
    -0
      header/examples/c/helper.h
  5. +159
    -0
      header/examples/c/main.c
  6. +809
    -0
      header/libTextSuite.h
  7. +216
    -214
      header/ulibTextSuite.pas
  8. +6
    -6
      ultsChar.pas
  9. +6
    -6
      ultsContext.pas
  10. +30
    -30
      ultsFont.pas
  11. +16
    -16
      ultsFontCreator.pas
  12. +42
    -42
      ultsImage.pas
  13. +26
    -28
      ultsPostProcessor.pas
  14. +17
    -22
      ultsRenderer.pas
  15. +53
    -53
      ultsTextBlock.pas

+ 1
- 1
TextSuite

@@ -1 +1 @@
Subproject commit 9ad90b9f7ca02386ea5ee359638c556ca9f457b4
Subproject commit d9d1f100f3636836555e5a1aa0987b98d02c001f

+ 169
- 0
header/examples/c/example.c View File

@@ -0,0 +1,169 @@
#include <stdio.h>
#include <GL/gl.h>

#include "example.h"
#include "helper.h"
#include "..\..\libTextSuite.h"

#if _WIN64
# define LIB_NAME "..\\..\\..\\libTextSuite-x86_64-win64.dll"
#elif _WIN32
# define LIB_NAME "..\\..\\..\\libTextSuite-i386-win32.dll"
#elif __linux__ && (__amd64 || __x86_64 || _M_AMD64 || __ppc64__)
# define LIB_NAME "../../../libTextSuite-x86_64-linux.so"
#elif __linux__ && (__i386 || _X86_)
# define LIB_NAME "../../../libTextSuite-i386-linux.so"
#else
# error 'unknown operation system'
#endif

lts_context_handle_t context;
lts_font_creator_handle_t creator;
lts_renderer_handle_t renderer;
lts_font_handle_t font;
lts_post_processor_handle_t pp;
lts_post_processor_handle_t ppFillPattern;
lts_post_processor_handle_t ppFillColor;
lts_post_processor_handle_t ppBorder;

const char* TEST_TEXT = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";
const wchar_t CHAR_RANGE_LOREM[] = { 'L', 'o', 'r', 'e', 'm', 0 };
const wchar_t CHAR_RANGE_E[] = { 'e', 0 };

const uint8_t PATTER_DATA[] = {
0xFF, 0xBF, 0x7F, 0xBF,
0xBF, 0xFF, 0xBF, 0x7F,
0x7F, 0xBF, 0xFF, 0xBF,
0xBF, 0x7F, 0xBF, 0xFF
};

void WINAPI execute_post_proc(lts_char_handle_t charHandle, lts_image_handle_t imageHandle)
{
lts_post_processor_execute(ppFillPattern, charHandle, imageHandle);
lts_post_processor_execute(ppFillColor, charHandle, imageHandle);
lts_post_processor_execute(ppBorder, charHandle, imageHandle);
}

bool exampleInit()
{
if (lts_initialize(LIB_NAME) != ltsErrNone)
{
showMessage("unable to initialize library");
return false;
}
context = lts_context_create();
if (!context)
{
showMessage("unable to create text suite context");
return false;
}
renderer = lts_renderer_create(context, ltsRendererOpenGL, ltsFormatRGBA8);
if (!renderer)
{
showMessage("unable to create text suite renderer");
return false;
}
creator = lts_font_creator_create(context, ltsFontCreatorGDI);
if (!creator)
{
showMessage("unable to create text suite creator");
return false;
}
lts_post_processor_custom_data_t ppData;
ppData.args = NULL;
ppData.execute = &execute_post_proc;
pp = lts_post_processor_custom_create(context, &ppData);
if (!pp)
{
showMessage("unable to create custom post processor");
return false;
}
lts_image_handle_t img = lts_image_create(context);
lts_image_create_empty(img, ltsFormatAlpha8, 4, 4);
void* imgData = lts_image_get_data(img);
if (img) memcpy(imgData, &PATTER_DATA[0], 16);
ppFillPattern = lts_post_processor_fill_pattern_create(context, img, true, ltsPosition(0, 0), LTS_IMAGE_MODES_MODULATE_ALL, LTS_COLOR_CHANNELS_RGBA);
lts_post_processor_add_chars(ppFillPattern, ltsUsageInclude, &CHAR_RANGE_LOREM[0]);
ppFillColor = lts_post_processor_fill_color_create(context, ltsColor4f(0.0, 0.0, 0.5, 1.0), LTS_IMAGE_MODES_REPLACE_ALL, LTS_COLOR_CHANNELS_RGB);
lts_post_processor_add_chars(ppFillColor, ltsUsageExclude, &CHAR_RANGE_E[0]);
ppBorder = lts_post_processor_border_create(context, 3.0, 0.5, ltsColor4f(0.0, 0.5, 0.0, 1.0), true);
lts_post_processor_add_chars(ppBorder, ltsUsageInclude, &CHAR_RANGE_E[0]);
font = lts_font_creator_get_font_by_file(creator, "../Prototype.ttf", 40, 0, ltsAANormal);
if (!font)
{
showMessage("unable to create text suite font");
return false;
}
if (lts_font_set_post_processor(font, pp) != ltsErrNone)
{
showMessage("unable to set post processor");
return false;
}
return true;
}

bool exampleRender(int width, int height)
{
const lts_color4f_t color = { 1.0, 1.0, 1.0, 1.0 };
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
lts_block_flags_t flags = 0;
FLAGS_SET(flags, ltsBlockFlagWordWrap);
lts_text_block_handle_t textBlock = lts_renderer_begin_block(renderer, 10, 10, width-20, height-20, flags);
if (!textBlock)
{
showMessage(lts_get_last_error_msg());
return false;
}
if (lts_text_block_set_horz_align(textBlock, ltsHorzAlignJustify) != ltsErrNone)
{
showMessage("unable to set horizontal alignment");
return false;
}
if (lts_text_block_set_font(textBlock, font) != ltsErrNone)
{
showMessage("unable to set font");
return false;
}
if (lts_text_block_set_color(textBlock, color) != ltsErrNone)
{
showMessage("unable to set font");
return false;
}
if (lts_text_block_text_out_a(textBlock, TEST_TEXT) != ltsErrNone)
{
showMessage("unable to print text");
return false;
}
if (lts_renderer_end_block(renderer, textBlock) != ltsErrNone)
{
showMessage("unable to finish text block");
return false;
}
//lts_text_block_destroy(textBlock);
glDisable(GL_BLEND);
return true;
}

void exampleFinish()
{
lts_font_destroy(font);
lts_post_processor_destroy(ppBorder);
lts_post_processor_destroy(ppFillColor);
lts_post_processor_destroy(ppFillPattern);
lts_post_processor_destroy(pp);
lts_font_creator_destroy(creator);
lts_renderer_destroy(creator);
lts_context_destroy(context);
lts_finalize();
}

+ 10
- 0
header/examples/c/example.h View File

@@ -0,0 +1,10 @@
#ifndef EXAMPLE_H
#define EXAMPLE_H

#include <stdbool.h>

bool exampleInit();
bool exampleRender(int width, int height);
void exampleFinish();

#endif /* EXAMPLE_H */

+ 11
- 0
header/examples/c/helper.h View File

@@ -0,0 +1,11 @@
#ifndef HELPER_H
#define HELPER_H

#include <windows.h>

extern HWND hwnd;

inline void showMessage(const char* msg)
{ MessageBox(hwnd, msg, "TextSuiteExample Error", MB_OK); };

#endif /* HELPER_H */

+ 159
- 0
header/examples/c/main.c View File

@@ -0,0 +1,159 @@
#include <windows.h>
#include <Wingdi.h>
#include <GL/gl.h>

#include "example.h"

const char g_szClassName[] = "OpenGLWindowClass";

HDC hdc;
HGLRC hglrc;
HWND hwnd;
int done = 0;

int screenw, screenh;

void SysShutdown (void)
{
done = 1;
exampleFinish();
wglMakeCurrent(hdc, NULL);
wglDeleteContext(hglrc);
PostQuitMessage(0);
}

void setPixelFormat()
{
PIXELFORMATDESCRIPTOR pfd =
{
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
32,
0,0,0,0,0,0,0,0,0,0,0,0,0, // useles parameters
16,
0,0,0,0,0,0,0
};
int indexPixelFormat = ChoosePixelFormat(hdc, &pfd);
SetPixelFormat(hdc, indexPixelFormat, &pfd);
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CREATE:
if ((hdc = GetDC(hwnd)) == NULL) // get device context
{
MessageBox(hwnd, "Failed to Get the Window Device Context", "Device Context Error", MB_OK);
SysShutdown();
break;
}
setPixelFormat();
if ((hglrc = wglCreateContext(hdc)) == NULL)
{
MessageBox(hwnd, "Failed to Create the OpenGL Rendering Context", "OpenGL Rendering Context Error", MB_OK);
SysShutdown();
break;
}
if (!wglMakeCurrent(hdc, hglrc))
{
MessageBox(hwnd, "Failed to make OpenGL Rendering Context current", "OpenGL Rendering Context Error", MB_OK);
SysShutdown();
break;
}
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
if (!exampleInit())
{
SysShutdown();
break;
}
break;
case WM_SIZE:
screenw = LOWORD(lParam);
screenh = HIWORD(lParam);
break;
case WM_PAINT:
glClearColor(1.0, 1.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glViewport(0, 0, screenw, screenh);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, screenw, screenh, 0, -10, 10);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
if (!exampleRender(screenw, screenh))
SysShutdown();
SwapBuffers(hdc);
break;
case WM_CLOSE:
SysShutdown();
DestroyWindow(hwnd);
break;
case WM_DESTROY:
SysShutdown();
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
MSG Msg;

wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = g_szClassName;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);

if(!RegisterClassEx(&wc))
{
MessageBox(NULL, "Window Registration Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}

if ((hwnd = CreateWindowEx(
WS_EX_CLIENTEDGE,
g_szClassName,
"TextSuiteExample",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
NULL, NULL, hInstance, NULL)) == NULL)
{
MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
return 0;
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&Msg, NULL, 0, 0) > 0 && done == 0)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}

+ 809
- 0
header/libTextSuite.h View File

@@ -0,0 +1,809 @@
#ifndef LIB_TEXT_SUITE_H
#define LIB_TEXT_SUITE_H

#include <stdint.h>
#include <stdbool.h>
#include <wchar.h>

#if __MINGW32__
# define WINAPI __stdcall
#else
# define WINAPI
#endif

#define STATIC_ASSERT(cond, msg) typedef char static_assertion_##msg[(cond)?1:-1]

STATIC_ASSERT(sizeof(float) == 4, size_of_float_should_be_4);
STATIC_ASSERT(sizeof(wchar_t) == 2, size_of_wchar_t_should_be_4);

/**********************************************************************************************************************************/
/* public interface */
/**********************************************************************************************************************************/

/* enumerations *******************************************************************************************************************/
typedef enum
{
ltsErrUnknown = -1,
ltsErrNone = 0,

// misc
ltsErrNotInitialized = 1,
ltsErrInvalidEnum = 2,
ltsErrInvalidValue = 3,
ltsErrInvalidOperation = 4,
ltsErrInvalidType = 5,

// invalid handles
ltsErrInvalidContextHandle = 100,
ltsErrInvalidRendererHandle = 101,
ltsErrInvalidTextBlockHandle = 102,
ltsErrInvalidFontHandle = 103,
ltsErrInvalidFontCreatorHandle = 104,
ltsErrInvalidImageHandle = 105,
ltsErrInvalidPostProcHandle = 106,
// library
ltsErrInvalidLibName = 200,
ltsErrInvalidLibHandle = 201,
ltsErrInvalidMethodName = 202
}
lts_error_code_t;
STATIC_ASSERT(sizeof(lts_error_code_t) == 4, size_of_lts_error_code_t_should_be_4);

typedef enum
{
ltsUTF8,
ltsISO_8859_1,
ltsISO_8859_2,
ltsISO_8859_3,
ltsISO_8859_4,
ltsISO_8859_5,
ltsISO_8859_6,
ltsISO_8859_7,
ltsISO_8859_8,
ltsISO_8859_9,
ltsISO_8859_10,
ltsISO_8859_11,
ltsISO_8859_13,
ltsISO_8859_14,
ltsISO_8859_15,
ltsISO_8859_16,
ltsISO_037,
ltsISO_437,
ltsISO_500,
ltsISO_737,
ltsISO_775,
ltsISO_850,
ltsISO_852,
ltsISO_855,
ltsISO_857,
ltsISO_860,
ltsISO_861,
ltsISO_862,
ltsISO_863,
ltsISO_864,
ltsISO_865,
ltsISO_866,
ltsISO_869,
ltsISO_874,
ltsISO_875,
ltsISO_1026,
ltsISO_1250,
ltsISO_1251,
ltsISO_1252,
ltsISO_1253,
ltsISO_1254,
ltsISO_1255,
ltsISO_1256,
ltsISO_1257,
ltsISO_1258
}
lts_code_page_t;
STATIC_ASSERT(sizeof(lts_code_page_t) == 4, size_of_lts_code_page_t_should_be_4);

typedef enum
{
ltsFormatEmpty,
ltsFormatRGBA8,
ltsFormatLumAlpha8,
ltsFormatAlpha8,
ltsFormatLum8
}
lts_format_t;
STATIC_ASSERT(sizeof(lts_format_t) == 4, size_of_lts_format_t_should_be_4);

typedef enum
{
ltsRendererUnknown,
ltsRendererOpenGL,
ltsRendererOpenGLES
}
lts_renderer_type_t;
STATIC_ASSERT(sizeof(lts_renderer_type_t) == 4, size_of_lts_renderer_type_t_should_be_4);

typedef enum
{
ltsFontCreatorUnknown,
ltsFontCreatorFreeType,
ltsFontCreatorGDI,
ltsFontCreatorCustom
}
lts_font_creator_type_t;
STATIC_ASSERT(sizeof(lts_font_creator_type_t) == 4, size_of_lts_font_creator_type_t_should_be_4);

typedef enum
{
ltsVertAlignTop,
ltsVertAlignCenter,
ltsVertAlignBottom
}
lts_vert_align_t;
STATIC_ASSERT(sizeof(lts_vert_align_t) == 4, size_of_lts_vert_align_t_should_be_4);

typedef enum
{
ltsHorzAlignLeft,
ltsHorzAlignCenter,
ltsHorzAlignRight,
ltsHorzAlignJustify
}
lts_horz_align_t;
STATIC_ASSERT(sizeof(lts_horz_align_t) == 4, size_of_lts_horz_align_t_should_be_4);

typedef enum
{
ltsClipNone,
ltsClipWordBorder,
ltsClipCharBorder,
ltsClipWordComplete,
ltsClipCharComplete
}
lts_clipping_t;
STATIC_ASSERT(sizeof(lts_clipping_t) == 4, size_of_lts_clipping_t_should_be_4);

typedef enum
{
ltsAANone,
ltsAANormal
}
lts_anti_aliasing_t;
STATIC_ASSERT(sizeof(lts_anti_aliasing_t) == 4, size_of_lts_anti_aliasing_t_should_be_4);

typedef enum
{
ltsUsageInclude,
ltsUsageExclude
}
lts_char_range_usage_t;
STATIC_ASSERT(sizeof(lts_char_range_usage_t) == 4, size_of_lts_char_range_usage_t_should_be_4);

typedef enum
{
ltsStreamOriginBegin = 0,
ltsStreamOriginCurrent = 1,
ltsStreamOriginEnd = 2
}
lts_stream_origin_t;
STATIC_ASSERT(sizeof(lts_stream_origin_t) == 4, size_of_lts_stream_origin_t_should_be_4);

typedef enum
{
ltsModeIgnore,
ltsModeReplace,
ltsModeModulate
}
lts_image_mode_t;
STATIC_ASSERT(sizeof(lts_image_mode_t) == 4, size_of_lts_image_mode_t_should_be_4);

/* flags **************************************************************************************************************************/
#define FLAGS_MAKE(enum) (1 << enum)
#define FLAGS_SET(flags, enum) flags |= FLAGS_MAKE(enum)
#define FLAGS_UNSET(flags, enum) flags &= ~FLAGS_MAKE(enum)
#define FLAGS_CLEAR(flags) flags = 0
#define FLAGS_IS_SET(flags, enum) (flags & FLAGS_MAKE(enum))

typedef enum
{
ltsBlockFlagWordWrap
}
lts_block_flag_t;
typedef uint32_t lts_block_flags_t;
STATIC_ASSERT(sizeof(lts_block_flag_t) == 4, size_of_lts_block_flag_t_should_be_4);

typedef enum
{
ltsFontStyleBold,
ltsFontStyleItalic,
ltsFontStyleUnderline,
ltsFontStyleStrikeout,
}
lts_font_style_flag_t;
typedef uint32_t lts_font_style_flags_t;
STATIC_ASSERT(sizeof(lts_font_style_flag_t) == 4, size_of_lts_font_style_flag_t_should_be_4);

typedef enum
{
ltsColorChannelRed,
ltsColorChannelGreen,
ltsColorChannelBlue,
ltsColorChannelAlpha
}
lts_color_channel_flag_t;
typedef uint32_t lts_color_channel_flags_t;
STATIC_ASSERT(sizeof(lts_color_channel_flags_t) == 4, size_of_lts_color_channel_flag_t_should_be_4);

/* structures *********************************************************************************************************************/
typedef struct
{
int32_t x;
int32_t y;
}
lts_position_t;
STATIC_ASSERT(sizeof(lts_position_t) == 8, size_of_lts_position_t_should_be_8);

typedef union
{
struct { lts_position_t top_left, bottom_right; };
struct { int32_t left, top, right, bottom; };
}
lts_rect_t;
STATIC_ASSERT(sizeof(lts_rect_t) == 16, size_of_lts_rect_t_should_be_16);

typedef union
{
struct { float r, g, b, a; };
float arr[4];
}
lts_color4f_t;
STATIC_ASSERT(sizeof(lts_color4f_t) == 16, size_of_lts_color4f_t_should_be_16);

typedef struct
{
lts_position_t glyph_origin;
lts_rect_t glyph_rect;
int32_t advance;
}
lts_glyph_metric_t;
STATIC_ASSERT(sizeof(lts_glyph_metric_t) == 28, size_of_lts_glyph_metric_t_should_be_28);

typedef struct
{
int32_t ascent;
int32_t descent;
int32_t external_leading;
int32_t base_line_offset;
int32_t char_spacing;
int32_t line_height;
int32_t line_spacing;
}
lts_text_metric_t;
STATIC_ASSERT(sizeof(lts_text_metric_t) == 28, size_of_lts_text_metric_t_should_be_28);

typedef struct
{
int32_t size;
lts_font_style_flags_t style;
lts_anti_aliasing_t anti_aliasing;
wchar_t default_char;
uint8_t __reserved[2];
int32_t ascent;
int32_t descent;
int32_t external_leading;
int32_t base_line_offset;
int32_t underline_pos;
int32_t underline_size;
int32_t strikeout_pos;
int32_t strikeout_size;
}
lts_font_metric_t;
STATIC_ASSERT(sizeof(lts_font_metric_t) == 48, size_of_lts_font_metric_t_should_be_48);

typedef float lts_vector4f_t[4];
STATIC_ASSERT(sizeof(lts_vector4f_t) == 16, size_of_lts_vector4f_t_should_be_16);

typedef lts_vector4f_t lts_matrix4f_t[4];
STATIC_ASSERT(sizeof(lts_matrix4f_t) == 64, size_of_lts_matrix4f_t_should_be_64);

typedef void* lts_handle_t;
typedef lts_handle_t lts_context_handle_t;
typedef lts_handle_t lts_renderer_handle_t;
typedef lts_handle_t lts_text_block_handle_t;
typedef lts_handle_t lts_font_creator_handle_t;
typedef lts_handle_t lts_font_handle_t;
typedef lts_handle_t lts_post_processor_handle_t;
typedef lts_handle_t lts_image_handle_t;
typedef lts_handle_t lts_char_handle_t;
typedef lts_image_mode_t lts_image_modes_t[4];

/* stream */
typedef int (WINAPI *lts_stream_func_read_t)(void* args, void* buffer, int count);
typedef int (WINAPI *lts_stream_func_seek_t)(void* args, lts_stream_origin_t origin, int offset);
typedef struct
{
void* args;
lts_stream_func_read_t read;
lts_stream_func_seek_t seek;
}
lts_stream_t;

/* custom post processor */
typedef void (WINAPI *lts_post_processor_execute_func_t)(lts_char_handle_t charHandle, lts_image_handle_t imageHandle);
typedef struct
{
void* args;
lts_post_processor_execute_func_t execute;
}
lts_post_processor_custom_data_t;

/* custom renderer */
typedef void (WINAPI *lts_renderer_custom_begin_render_t) (void* args);
typedef void (WINAPI *lts_renderer_custom_end_render_t) (void* args);
typedef lts_position_t (WINAPI *lts_renderer_custom_get_draw_pos_t) (void* args);
typedef void (WINAPI *lts_renderer_custom_set_draw_pos_t) (lts_position_t value, void* args);
typedef void (WINAPI *lts_renderer_custom_move_draw_pos_t) (lts_position_t value, void* args);
typedef void (WINAPI *lts_renderer_custom_set_color_t) (lts_color4f_t value, void* args);
typedef void (WINAPI *lts_renderer_custom_render) (void* ref, int forcedWidth, void* args);
typedef void* (WINAPI *lts_renderer_custom_create_ref) (lts_char_handle_t charHandle, lts_image_handle_t imageHandle, void* args);
typedef void (WINAPI *lts_renderer_custom_free_ref) (void* ref, void* args);
typedef struct
{
void* args;
lts_renderer_custom_begin_render_t beginRender;
lts_renderer_custom_end_render_t endRender;
lts_renderer_custom_get_draw_pos_t getDrawPos;
lts_renderer_custom_set_draw_pos_t setDrawPos;
lts_renderer_custom_move_draw_pos_t moveDrawPos;
lts_renderer_custom_set_color_t setColor;
lts_renderer_custom_render render;
lts_renderer_custom_create_ref createRef;
lts_renderer_custom_free_ref freeRef;
}
lts_renderer_custom_data_t;

/* image */
typedef void (WINAPI *lts_image_load_callback_t) (lts_image_handle_t handle, int x, int y, lts_color4f_t pixel, void* args);
typedef void (WINAPI *lts_image_blend_callback_t)(lts_image_handle_t handle, lts_color4f_t src, lts_color4f_t dst, lts_color4f_t result, void* args);

/* callbacks **********************************************************************************************************************/
lts_context_handle_t (WINAPI *lts_context_create) ();
lts_error_code_t (WINAPI *lts_context_get_code_page) (lts_context_handle_t handle, lts_code_page_t* value);
lts_error_code_t (WINAPI *lts_context_get_default_char) (lts_context_handle_t handle, wchar_t* value);
lts_error_code_t (WINAPI *lts_context_set_code_page) (lts_context_handle_t handle, lts_code_page_t value);
lts_error_code_t (WINAPI *lts_context_set_default_char) (lts_context_handle_t handle, wchar_t value);
wchar_t* (WINAPI *lts_context_ansi_to_wide) (lts_context_handle_t handle, const char* text);
lts_error_code_t (WINAPI *lts_context_destroy) (lts_context_handle_t handle);
lts_renderer_handle_t (WINAPI *lts_renderer_create) (lts_context_handle_t handle, lts_renderer_type_t type, lts_format_t format);
lts_renderer_handle_t (WINAPI *lts_renderer_create_custom) (lts_context_handle_t handle, lts_format_t format, const lts_renderer_custom_data_t* data);
lts_text_block_handle_t (WINAPI *lts_renderer_begin_block) (lts_renderer_handle_t handle, int top, int left, int width, int height, lts_block_flags_t flags);
lts_error_code_t (WINAPI *lts_renderer_end_block) (lts_renderer_handle_t handle, lts_text_block_handle_t block);
lts_error_code_t (WINAPI *lts_renderer_abort_block) (lts_renderer_handle_t handle, lts_text_block_handle_t block);
int (WINAPI *lts_renderer_get_text_width_a) (lts_renderer_handle_t handle, lts_font_handle_t font, const char* text);
int (WINAPI *lts_renderer_get_text_width_w) (lts_renderer_handle_t handle, lts_font_handle_t font, const wchar_t* text);
lts_error_code_t (WINAPI *lts_renderer_destroy) (lts_renderer_handle_t handle);

lts_font_creator_handle_t (WINAPI *lts_font_creator_create) (lts_context_handle_t handle, lts_font_creator_type_t type);
lts_font_handle_t (WINAPI *lts_font_creator_get_font_by_name) (lts_font_creator_handle_t handle, const char* fontname, int size, lts_font_style_flags_t style, lts_anti_aliasing_t antialiasing);
lts_font_handle_t (WINAPI *lts_font_creator_get_font_by_file) (lts_font_creator_handle_t handle, const char* filename, int size, lts_font_style_flags_t style, lts_anti_aliasing_t antialiasing);
lts_font_handle_t (WINAPI *lts_font_creator_get_font_by_stream) (lts_font_creator_handle_t handle, lts_stream_t* stream, int size, lts_font_style_flags_t style, lts_anti_aliasing_t antialiasing);
lts_error_code_t (WINAPI *lts_font_creator_destroy) (lts_font_creator_handle_t handle);

lts_post_processor_handle_t (WINAPI *lts_font_get_post_processor) (lts_font_handle_t handle);
lts_error_code_t (WINAPI *lts_font_get_tab_width) (lts_font_handle_t handle, int* value);
lts_error_code_t (WINAPI *lts_font_get_char_spacing) (lts_font_handle_t handle, int* value);
lts_error_code_t (WINAPI *lts_font_get_line_spacing) (lts_font_handle_t handle, float* value);
lts_error_code_t (WINAPI *lts_font_get_metric) (lts_font_handle_t handle, lts_font_metric_t* value);
const char* (WINAPI *lts_font_get_fontname) (lts_font_handle_t handle);
const char* (WINAPI *lts_font_get_facename) (lts_font_handle_t handle);
const char* (WINAPI *lts_font_get_stylename) (lts_font_handle_t handle);
const char* (WINAPI *lts_font_get_fillname) (lts_font_handle_t handle);
const char* (WINAPI *lts_font_get_copyright) (lts_font_handle_t handle);
lts_error_code_t (WINAPI *lts_font_set_post_processor) (lts_font_handle_t handle, lts_post_processor_handle_t pp);
lts_error_code_t (WINAPI *lts_font_set_tab_width) (lts_font_handle_t handle, int value);
lts_error_code_t (WINAPI *lts_font_set_char_spacing) (lts_font_handle_t handle, int value);
lts_error_code_t (WINAPI *lts_font_set_line_spacing) (lts_font_handle_t handle, float value);
lts_error_code_t (WINAPI *lts_font_destroy) (lts_font_handle_t handle);

lts_error_code_t (WINAPI *lts_text_block_get_rect) (lts_text_block_handle_t handle, lts_rect_t* value);
lts_error_code_t (WINAPI *lts_text_block_get_width) (lts_text_block_handle_t handle, int* value);
lts_error_code_t (WINAPI *lts_text_block_get_height) (lts_text_block_handle_t handle, int* value);
lts_error_code_t (WINAPI *lts_text_block_get_flags) (lts_text_block_handle_t handle, lts_block_flags_t* value);
lts_error_code_t (WINAPI *lts_text_block_get_top) (lts_text_block_handle_t handle, int* value);
lts_error_code_t (WINAPI *lts_text_block_get_left) (lts_text_block_handle_t handle, int* value);
lts_error_code_t (WINAPI *lts_text_block_get_vert_align) (lts_text_block_handle_t handle, lts_vert_align_t* value);
lts_error_code_t (WINAPI *lts_text_block_get_horz_align) (lts_text_block_handle_t handle, lts_horz_align_t* value);
lts_error_code_t (WINAPI *lts_text_block_get_clipping) (lts_text_block_handle_t handle, lts_clipping_t* value);
lts_error_code_t (WINAPI *lts_text_block_get_color) (lts_text_block_handle_t handle, lts_color4f_t value);
lts_error_code_t (WINAPI *lts_text_block_get_font) (lts_text_block_handle_t handle, lts_font_handle_t* value);
lts_error_code_t (WINAPI *lts_text_block_set_top) (lts_text_block_handle_t handle, int value);
lts_error_code_t (WINAPI *lts_text_block_set_left) (lts_text_block_handle_t handle, int value);
lts_error_code_t (WINAPI *lts_text_block_set_vert_align) (lts_text_block_handle_t handle, lts_vert_align_t value);
lts_error_code_t (WINAPI *lts_text_block_set_horz_align) (lts_text_block_handle_t handle, lts_horz_align_t value);
lts_error_code_t (WINAPI *lts_text_block_set_clipping) (lts_text_block_handle_t handle, lts_clipping_t value);
lts_error_code_t (WINAPI *lts_text_block_set_color) (lts_text_block_handle_t handle, lts_color4f_t value);
lts_error_code_t (WINAPI *lts_text_block_set_font) (lts_text_block_handle_t handle, lts_font_handle_t value);
int (WINAPI *lts_text_block_get_actual_height) (lts_text_block_handle_t handle);
int (WINAPI *lts_text_block_get_text_width_a) (lts_text_block_handle_t handle, const char* text);
int (WINAPI *lts_text_block_get_text_width_w) (lts_text_block_handle_t handle, const wchar_t* text);
lts_error_code_t (WINAPI *lts_text_block_text_out_a) (lts_text_block_handle_t handle, const char* text);
lts_error_code_t (WINAPI *lts_text_block_text_out_w) (lts_text_block_handle_t handle, const wchar_t* text);
lts_error_code_t (WINAPI *lts_text_block_destroy) (lts_text_block_handle_t handle);

lts_image_handle_t (WINAPI *lts_image_create) (lts_context_handle_t handle);
lts_error_code_t (WINAPI *lts_image_is_empty) (lts_image_handle_t handle, bool* value);
int (WINAPI *lts_image_get_width) (lts_image_handle_t handle);
int (WINAPI *lts_image_get_height) (lts_image_handle_t handle);
int (WINAPI *lts_image_get_line_size) (lts_image_handle_t handle);
int (WINAPI *lts_image_get_data_size) (lts_image_handle_t handle);
lts_error_code_t (WINAPI *lts_image_get_format) (lts_image_handle_t handle, lts_format_t* value);
void* (WINAPI *lts_image_get_data) (lts_image_handle_t handle);
void* (WINAPI *lts_image_get_scanline) (lts_image_handle_t handle, int index);
lts_error_code_t (WINAPI *lts_image_get_pixel_at) (lts_image_handle_t handle, int x, int y, lts_color4f_t pixel);
lts_error_code_t (WINAPI *lts_image_assign) (lts_image_handle_t handle, lts_image_handle_t source);
lts_error_code_t (WINAPI *lts_image_create_empty) (lts_image_handle_t handle, lts_format_t format, int width, int height);
lts_error_code_t (WINAPI *lts_image_load_from_func) (lts_image_handle_t handle, lts_image_load_callback_t callback, void* args);
lts_error_code_t (WINAPI *lts_image_resize) (lts_image_handle_t handle, int width, int height, int x, int y);
lts_error_code_t (WINAPI *lts_image_fill_color) (lts_image_handle_t handle, lts_color4f_t color, lts_color_channel_flags_t mask, lts_image_modes_t modes);
lts_error_code_t (WINAPI *lts_image_fill_pattern) (lts_image_handle_t handle, lts_image_handle_t pattern, int x, int y, lts_color_channel_flags_t mask, lts_image_modes_t modes);
lts_error_code_t (WINAPI *lts_image_blend) (lts_image_handle_t handle, lts_image_handle_t source, int x, int y, lts_image_blend_callback_t callback, void* args);
lts_error_code_t (WINAPI *lts_image_blur) (lts_image_handle_t handle, float horzRad, float horzStr, float vertRad, float vertStr, lts_color_channel_flags_t mask);
lts_error_code_t (WINAPI *lts_image_destroy) (lts_image_handle_t handle);

lts_error_code_t (WINAPI *lts_post_processor_add_range) (lts_post_processor_handle_t handle, lts_char_range_usage_t usage, wchar_t start, wchar_t stop);
lts_error_code_t (WINAPI *lts_post_processor_add_chars) (lts_post_processor_handle_t handle, lts_char_range_usage_t usage, const wchar_t* chars);
lts_error_code_t (WINAPI *lts_post_processor_clear_ranges) (lts_post_processor_handle_t handle);
lts_error_code_t (WINAPI *lts_post_processor_execute) (lts_post_processor_handle_t handle, lts_char_handle_t charHandle, lts_image_handle_t image);
lts_post_processor_handle_t (WINAPI *lts_post_processor_fill_color_create) (lts_post_processor_handle_t handle, lts_color4f_t color, lts_image_modes_t modes, lts_color_channel_flags_t channels);
lts_post_processor_handle_t (WINAPI *lts_post_processor_fill_pattern_create) (lts_post_processor_handle_t handle, lts_image_handle_t pattern, bool ownsPattern, lts_position_t position, lts_image_modes_t modes, lts_color_channel_flags_t channels);
lts_post_processor_handle_t (WINAPI *lts_post_processor_border_create) (lts_post_processor_handle_t handle, float width, float strength, lts_color4f_t color, bool keepSize);
lts_post_processor_handle_t (WINAPI *lts_post_processor_shadow_create) (lts_post_processor_handle_t handle, float radius, float strength, lts_position_t offset, lts_color4f_t color);
lts_post_processor_handle_t (WINAPI *lts_post_processor_custom_create) (lts_post_processor_handle_t handle, const lts_post_processor_custom_data_t* data);
lts_error_code_t (WINAPI *lts_post_processor_destroy) (lts_post_processor_handle_t handle);

lts_error_code_t (WINAPI *lts_char_get_char_code) (lts_char_handle_t handle, wchar_t* value);
lts_error_code_t (WINAPI *lts_char_get_glyph_metric) (lts_char_handle_t handle, lts_glyph_metric_t* value);
lts_error_code_t (WINAPI *lts_char_set_glyph_metric) (lts_char_handle_t handle, lts_glyph_metric_t value);

lts_error_code_t (WINAPI *lts_get_last_error_code) ();
const char* (WINAPI *lts_get_last_error_msg) ();

/* constants **********************************************************************************************************************/
lts_image_modes_t LTS_IMAGE_MODES_REPLACE_ALL = {
ltsModeReplace,
ltsModeReplace,
ltsModeReplace,
ltsModeReplace
};
lts_image_modes_t LTS_IMAGE_MODES_MODULATE_ALPHA = {
ltsModeReplace,
ltsModeReplace,
ltsModeReplace,
ltsModeModulate
};
lts_image_modes_t LTS_IMAGE_MODES_MODULATE_ALL = {
ltsModeModulate,
ltsModeModulate,
ltsModeModulate,
ltsModeModulate
};

lts_color_channel_flags_t LTS_COLOR_CHANNELS_RGB =
FLAGS_MAKE(ltsColorChannelRed) |
FLAGS_MAKE(ltsColorChannelGreen) |
FLAGS_MAKE(ltsColorChannelBlue);
lts_color_channel_flags_t LTS_COLOR_CHANNELS_RGBA =
FLAGS_MAKE(ltsColorChannelRed) |
FLAGS_MAKE(ltsColorChannelGreen) |
FLAGS_MAKE(ltsColorChannelBlue) |
FLAGS_MAKE(ltsColorChannelAlpha);

/* helper *************************************************************************************************************************/
inline lts_color4f_t ltsColor4f(float r, float g, float b, float a)
{ lts_color4f_t ret = { r, g, b, a }; return ret; };

inline lts_position_t ltsPosition(int x, int y)
{ lts_position_t ret = { x, y }; return ret; };
inline lts_rect_t ltsRect(int left, int top, int right, int bottom)
{ lts_rect_t ret = { left, top, right, bottom }; return ret; };

inline lts_rect_t ltsRectFromPos(lts_position_t leftTop, lts_position_t bottomRight)
{ lts_rect_t ret = { leftTop.x, leftTop.y, bottomRight.x, bottomRight.y }; return ret; };

/**********************************************************************************************************************************/
/* internal initialization code */
/**********************************************************************************************************************************/
//#define LSF_DEBUG
#ifdef LSF_DEBUG
# include <stdio.h>
#endif

#if WIN32 || WIN64 || _WIN32 || _WIN64
# include <windows.h>

typedef HMODULE lib_handle_t;

lib_handle_t open_lib(const char* name)
{ return LoadLibrary(name); };
void* get_addr(lib_handle_t handle, const char* name)
{ return GetProcAddress(handle, name); };

int close_lib(lib_handle_t handle)
{ return FreeLibrary(handle); };
#elif LINUX || __linux__
# include <dlfcn.h>

typedef void* lib_handle_t;

lib_handle_t open_lib(const char* name)
{ return dlopen(name, RTLD_LAZY); };
void* get_addr(lib_handle_t handle, const char* name)
{ return dlsym(handle, name); };

int close_lib(lib_handle_t handle)
{ return !dlclose(handle); };

#else
# error "unknown operation system"
#endif

#ifndef LSF_DEBUG
# define LoadProc(proc, name) \
proc = get_addr(handle, name); \
if (!proc) \
return ltsErrInvalidMethodName
#else
# define LoadProc(proc, name) \
proc = get_addr(handle, name); \
printf("load method '%s' (addr=0x%016x)\n", name, proc); \
if (!proc) \
return ltsErrInvalidMethodName
#endif

lts_error_code_t (WINAPI *lts_initialize_intern)();
lts_error_code_t (WINAPI *lts_finalize_intern) ();

lib_handle_t handle = NULL;

lts_error_code_t lts_initialize(const char* libname)
{
#ifdef LSF_DEBUG
printf("loading library '%s'\n", libname);
#endif
handle = open_lib(libname);
if (!handle)
return ltsErrInvalidLibName;
#ifdef LSF_DEBUG
printf(" done (handle=0x%016x)\n", handle);
#endif
LoadProc(lts_context_create, "ltsContextCreate");
LoadProc(lts_context_get_code_page, "ltsContextGetCodePage");
LoadProc(lts_context_get_default_char, "ltsContextGetDefaultChar");
LoadProc(lts_context_set_code_page, "ltsContextSetCodePage");
LoadProc(lts_context_set_default_char, "ltsContextSetDefaultChar");
LoadProc(lts_context_ansi_to_wide, "ltsContextAnsiToWide");
LoadProc(lts_context_destroy, "ltsContextDestroy");
LoadProc(lts_renderer_create, "ltsRendererCreate");
LoadProc(lts_renderer_create_custom, "ltsRendererCustomCreate");
LoadProc(lts_renderer_begin_block, "ltsRendererBeginBlock");
LoadProc(lts_renderer_end_block, "ltsRendererEndBlock");
LoadProc(lts_renderer_abort_block, "ltsRendererAbortBlock");
LoadProc(lts_renderer_get_text_width_a, "ltsRendererGetTextWidthA");
LoadProc(lts_renderer_get_text_width_w, "ltsRendererGetTextWidthW");
LoadProc(lts_renderer_destroy, "ltsRendererDestroy");
LoadProc(lts_font_creator_create, "ltsFontCreatorCreate");
LoadProc(lts_font_creator_get_font_by_name, "ltsFontCreatorGetFontByName");
LoadProc(lts_font_creator_get_font_by_file, "ltsFontCreatorGetFontByFile");
LoadProc(lts_font_creator_get_font_by_stream, "ltsFontCreatorGetFontByStream");
LoadProc(lts_font_creator_destroy, "ltsFontCreatorDestroy");
LoadProc(lts_font_get_post_processor, "ltsFontGetPostProcessor");
LoadProc(lts_font_get_tab_width, "ltsFontGetTabWidth");
LoadProc(lts_font_get_char_spacing, "ltsFontGetCharSpacing");
LoadProc(lts_font_get_line_spacing, "ltsFontGetLineSpacing");
LoadProc(lts_font_get_metric, "ltsFontGetMetric");
LoadProc(lts_font_get_fontname, "ltsFontGetFontname");
LoadProc(lts_font_get_facename, "ltsFontGetFacename");
LoadProc(lts_font_get_stylename, "ltsFontGetStylename");
LoadProc(lts_font_get_fillname, "ltsFontGetFullname");
LoadProc(lts_font_get_copyright, "ltsFontGetCopyright");
LoadProc(lts_font_set_post_processor, "ltsFontSetPostProcessor");
LoadProc(lts_font_set_tab_width, "ltsFontSetTabWidth");
LoadProc(lts_font_set_char_spacing, "ltsFontSetCharSpacing");
LoadProc(lts_font_set_line_spacing, "ltsFontSetLineSpacing");
LoadProc(lts_font_destroy, "ltsFontDestroy");
LoadProc(lts_text_block_get_rect, "ltsTextBlockGetRect");
LoadProc(lts_text_block_get_width, "ltsTextBlockGetWidth");
LoadProc(lts_text_block_get_height, "ltsTextBlockGetHeight");
LoadProc(lts_text_block_get_flags, "ltsTextBlockGetFlags");
LoadProc(lts_text_block_get_top, "ltsTextBlockGetTop");
LoadProc(lts_text_block_get_left, "ltsTextBlockGetLeft");
LoadProc(lts_text_block_get_vert_align, "ltsTextBlockGetVertAlign");
LoadProc(lts_text_block_get_horz_align, "ltsTextBlockGetHorzAlign");
LoadProc(lts_text_block_get_clipping, "ltsTextBlockGetClipping");
LoadProc(lts_text_block_get_color, "ltsTextBlockGetColor");
LoadProc(lts_text_block_get_font, "ltsTextBlockGetFont");
LoadProc(lts_text_block_set_top, "ltsTextBlockSetTop");
LoadProc(lts_text_block_set_left, "ltsTextBlockSetLeft");
LoadProc(lts_text_block_set_vert_align, "ltsTextBlockSetVertAlign");
LoadProc(lts_text_block_set_horz_align, "ltsTextBlockSetHorzAlign");
LoadProc(lts_text_block_set_clipping, "ltsTextBlockSetClipping");
LoadProc(lts_text_block_set_color, "ltsTextBlockSetColor");
LoadProc(lts_text_block_set_font, "ltsTextBlockSetFont");
LoadProc(lts_text_block_get_actual_height, "ltsTextBlockGetActualHeight");
LoadProc(lts_text_block_get_text_width_a, "ltsTextBlockGetTextWidthA");
LoadProc(lts_text_block_get_text_width_w, "ltsTextBlockGetTextWidthW");
LoadProc(lts_text_block_text_out_a, "ltsTextBlockTextOutA");
LoadProc(lts_text_block_text_out_w, "ltsTextBlockTextOutW");
LoadProc(lts_text_block_destroy, "ltsTextBlockDestroy");
LoadProc(lts_image_create, "ltsImageCreate");
LoadProc(lts_image_is_empty, "ltsImageIsEmpty");
LoadProc(lts_image_get_width, "ltsImageGetWidth");
LoadProc(lts_image_get_height, "ltsImageGetHeight");
LoadProc(lts_image_get_line_size, "ltsImageGetLineSize");
LoadProc(lts_image_get_data_size, "ltsImageGetDataSize");
LoadProc(lts_image_get_format, "ltsImageGetFormat");
LoadProc(lts_image_get_data, "ltsImageGetData");
LoadProc(lts_image_get_scanline, "ltsImageGetScanline");
LoadProc(lts_image_get_pixel_at, "ltsImageGetPixelAt");
LoadProc(lts_image_assign, "ltsImageAssign");
LoadProc(lts_image_create_empty, "ltsImageCreateEmpty");
LoadProc(lts_image_load_from_func, "ltsImageLoadFromFunc");
LoadProc(lts_image_resize, "ltsImageResize");
LoadProc(lts_image_fill_color, "ltsImageFillColor");
LoadProc(lts_image_fill_pattern, "ltsImageFillPattern");
LoadProc(lts_image_blend, "ltsImageBlend");
LoadProc(lts_image_blur, "ltsImageBlur");
LoadProc(lts_image_destroy, "ltsImageDestroy");
LoadProc(lts_post_processor_add_range, "ltsPostProcessorAddRange");
LoadProc(lts_post_processor_add_chars, "ltsPostProcessorAddChars");
LoadProc(lts_post_processor_clear_ranges, "ltsPostProcessorClearRanges");
LoadProc(lts_post_processor_execute, "ltsPostProcessorExecute");
LoadProc(lts_post_processor_fill_color_create, "ltsPostProcessorFillColorCreate");
LoadProc(lts_post_processor_fill_pattern_create, "ltsPostProcessorFillPatterCreate");
LoadProc(lts_post_processor_border_create, "ltsPostProcessorBorderCreate");
LoadProc(lts_post_processor_shadow_create, "ltsPostProcessorShadowCreate");
LoadProc(lts_post_processor_custom_create, "ltsPostProcessorCustomCreate");
LoadProc(lts_post_processor_destroy, "ltsPostProcessorDestroy");
LoadProc(lts_char_get_char_code, "ltsCharGetCharCode");
LoadProc(lts_char_get_glyph_metric, "ltsCharGetGlyphMetric");
LoadProc(lts_char_set_glyph_metric, "ltsCharSetGlyphMetric");
LoadProc(lts_initialize_intern, "ltsInitialize");
LoadProc(lts_get_last_error_code, "ltsGetLastErrorCode");
LoadProc(lts_get_last_error_msg, "ltsGetLastErrorMsg");
LoadProc(lts_finalize_intern, "ltsFinalize");

return lts_initialize_intern();
}

int lts_finalize(void)
{
lts_error_code_t err = lts_finalize_intern();

lts_context_create = NULL;
lts_context_get_code_page = NULL;
lts_context_get_default_char = NULL;
lts_context_set_code_page = NULL;
lts_context_set_default_char = NULL;
lts_context_ansi_to_wide = NULL;
lts_context_destroy = NULL;
lts_renderer_create = NULL;
lts_renderer_create_custom = NULL;
lts_renderer_begin_block = NULL;
lts_renderer_end_block = NULL;
lts_renderer_abort_block = NULL;
lts_renderer_get_text_width_a = NULL;
lts_renderer_get_text_width_w = NULL;
lts_renderer_destroy = NULL;
lts_font_creator_create = NULL;
lts_font_creator_get_font_by_name = NULL;
lts_font_creator_get_font_by_file = NULL;
lts_font_creator_get_font_by_stream = NULL;
lts_font_creator_destroy = NULL;
lts_font_get_post_processor = NULL;
lts_font_get_tab_width = NULL;
lts_font_get_char_spacing = NULL;
lts_font_get_line_spacing = NULL;
lts_font_get_metric = NULL;
lts_font_get_fontname = NULL;
lts_font_get_facename = NULL;
lts_font_get_stylename = NULL;
lts_font_get_fillname = NULL;
lts_font_get_copyright = NULL;
lts_font_set_post_processor = NULL;
lts_font_set_tab_width = NULL;
lts_font_set_char_spacing = NULL;
lts_font_set_line_spacing = NULL;
lts_font_destroy = NULL;
lts_text_block_get_rect = NULL;
lts_text_block_get_width = NULL;
lts_text_block_get_height = NULL;
lts_text_block_get_flags = NULL;
lts_text_block_get_top = NULL;
lts_text_block_get_left = NULL;
lts_text_block_get_vert_align = NULL;
lts_text_block_get_horz_align = NULL;
lts_text_block_get_clipping = NULL;
lts_text_block_get_color = NULL;
lts_text_block_get_font = NULL;
lts_text_block_set_top = NULL;
lts_text_block_set_left = NULL;
lts_text_block_set_vert_align = NULL;
lts_text_block_set_horz_align = NULL;
lts_text_block_set_clipping = NULL;
lts_text_block_set_color = NULL;
lts_text_block_set_font = NULL;
lts_text_block_get_actual_height = NULL;
lts_text_block_get_text_width_a = NULL;
lts_text_block_get_text_width_w = NULL;
lts_text_block_text_out_a = NULL;
lts_text_block_text_out_w = NULL;
lts_text_block_destroy = NULL;
lts_image_create = NULL;
lts_image_is_empty = NULL;
lts_image_get_width = NULL;
lts_image_get_height = NULL;
lts_image_get_line_size = NULL;
lts_image_get_data_size = NULL;
lts_image_get_format = NULL;
lts_image_get_data = NULL;
lts_image_get_scanline = NULL;
lts_image_get_pixel_at = NULL;
lts_image_assign = NULL;
lts_image_create_empty = NULL;
lts_image_load_from_func = NULL;
lts_image_resize = NULL;
lts_image_fill_color = NULL;
lts_image_fill_pattern = NULL;
lts_image_blend = NULL;
lts_image_blur = NULL;
lts_image_destroy = NULL;
lts_post_processor_add_range = NULL;
lts_post_processor_add_chars = NULL;
lts_post_processor_clear_ranges = NULL;
lts_post_processor_execute = NULL;
lts_post_processor_fill_color_create = NULL;
lts_post_processor_fill_pattern_create = NULL;
lts_post_processor_border_create = NULL;
lts_post_processor_shadow_create = NULL;
lts_post_processor_custom_create = NULL;
lts_post_processor_destroy = NULL;
lts_char_get_char_code = NULL;
lts_char_get_glyph_metric = NULL;
lts_char_set_glyph_metric = NULL;
lts_initialize_intern = NULL;
lts_get_last_error_code = NULL;
lts_get_last_error_msg = NULL;
lts_finalize_intern = NULL;
if (!close_lib(handle))
return ltsErrInvalidLibHandle;
return err;
}

#endif /* LIB_TEXT_SUITE_H */

+ 216
- 214
header/ulibTextSuite.pas View File

@@ -228,6 +228,7 @@ type
Style: TltsFontStyles;
AntiAliasing: TltsAntiAliasing;
DefaultChar: WideChar;
__reserved: SmallInt;

Ascent: Integer;
Descent: Integer;
@@ -329,218 +330,218 @@ type
end;

TltsImage = class;
TltsImageLoadFunc = procedure(const aImage: TltsImage; X, Y: Integer; var aPixel: TltsColor4f; aArgs: Pointer);
TltsImageBlendFunc = function (const aSrc, aDst: TltsColor4f; aArgs: Pointer): TltsColor4f;
TltsImageLoadInternFunc = procedure(const aHandle: TltsImageHandle; const X, Y: Integer; var aPixel: TltsColor4f; aArgs: Pointer); stdcall;
TltsImageBlendInternFunc = function (const aHandle: TltsImageHandle; const aSrc, aDst: TltsColor4f; aArgs: Pointer): TltsColor4f; stdcall;
TltsContextCreate = function(): TltsContextHandle; stdcall;
TltsContextGetCodePage = function(const aHandle: TltsContextHandle; out aCodePage: TltsCodePage): TltsErrorCode; stdcall;
TltsContextGetDefaultChar = function(const aHandle: TltsContextHandle; out aValue: WideChar): TltsErrorCode; stdcall;
TltsContextSetCodePage = function(const aHandle: TltsContextHandle; const aCodePage: TltsCodePage): TltsErrorCode; stdcall;
TltsContextSetDefaultChar = function(const aHandle: TltsContextHandle; const aValue: WideChar): TltsErrorCode; stdcall;
TltsContextAnsiToWide = function(const aHandle: TltsContextHandle; const aText: PAnsiChar): PWideChar; stdcall;
TltsContextDestroy = function(const aHandle: TltsContextHandle): TltsErrorCode; stdcall;
TltsRendererCreate = function(const aHandle: TltsContextHandle; const aType: TltsRendererType; const aFormat: TltsFormat): TltsRendererHandle; stdcall;
TltsRendererCustomCreate = function(const aHandle: TltsContextHandle; const aFormat: TltsFormat; const aData: PltsRendererCustomData): TltsRendererHandle; stdcall;
TltsRendererBeginBlock = function(const aHandle: TltsRendererHandle; const aTop, aLeft, aWidth, aHeight: Integer; const aFlags: TltsBlockFlags): TltsTextBlockHandle; stdcall;
TltsRendererEndBlock = function(const aHandle: TltsRendererHandle; const aBlock: TltsTextBlockHandle): TltsErrorCode; stdcall;
TltsRendererAbortBlock = function(const aHandle: TltsRendererHandle; const aBlock: TltsTextBlockHandle): TltsErrorCode; stdcall;
TltsRendererGetTextWidthA = function(const aHandle: TltsRendererHandle; const aFont: TltsFontHandle; const aText: PAnsiChar): Integer; stdcall;
TltsRendererGetTextWidthW = function(const aHandle: TltsRendererHandle; const aFont: TltsFontHandle; const aText: PWideChar): Integer; stdcall;
TltsRendererDestroy = function(const aHandle: TltsRendererHandle): TltsErrorCode; stdcall;
TltsFontCreatorCreate = function(const aHandle: TltsContextHandle; const aType: TltsFontCreatorType): TltsFontCreatorHandle; stdcall;
TltsFontCreatorGetFontByName = function(const aHandle: TltsFontCreatorHandle; const aFontname: PAnsiChar; const aSize: Integer; const aStyle: TltsFontStyles; const aAntiAliasing: TltsAntiAliasing): TltsFontHandle; stdcall;
TltsFontCreatorGetFontByFile = function(const aHandle: TltsFontCreatorHandle; const aFilename: PAnsiChar; const aSize: Integer; const aStyle: TltsFontStyles; const aAntiAliasing: TltsAntiAliasing): TltsFontHandle; stdcall;
TltsFontCreatorGetFontByStream = function(const aHandle: TltsFontCreatorHandle; const aStream: PltsStream; const aSize: Integer; const aStyle: TltsFontStyles; const aAntiAliasing: TltsAntiAliasing): TltsFontHandle; stdcall;
TltsFontCreatorDestroy = function(const aHandle: TltsFontCreatorHandle): TltsErrorCode; stdcall;
TltsFontGetPostProcessor = function(const aHandle: TltsFontHandle): TltsPostProcessorHandle; stdcall;
TltsFontGetTabWidth = function(const aHandle: TltsFontHandle; out aValue: Integer): TltsErrorCode; stdcall;
TltsFontGetCharSpacing = function(const aHandle: TltsFontHandle; out aValue: Integer): TltsErrorCode; stdcall;
TltsFontGetLineSpacing = function(const aHandle: TltsFontHandle; out aValue: Single): TltsErrorCode; stdcall;
TltsFontGetMetric = function(const aHandle: TltsFontHandle; out aValue: TltsFontMetric): TltsErrorCode; stdcall;
TltsFontGetFontname = function(const aHandle: TltsFontHandle): PAnsiChar; stdcall;
TltsFontGetFacename = function(const aHandle: TltsFontHandle): PAnsiChar; stdcall;
TltsFontGetStylename = function(const aHandle: TltsFontHandle): PAnsiChar; stdcall;
TltsFontGetFullname = function(const aHandle: TltsFontHandle): PAnsiChar; stdcall;
TltsFontGetCopyright = function(const aHandle: TltsFontHandle): PAnsiChar; stdcall;
TltsFontSetPostProcessor = function(const aHandle: TltsFontHandle; const aValue: TltsPostProcessorHandle): TltsErrorCode; stdcall;
TltsFontSetTabWidth = function(const aHandle: TltsFontHandle; const aValue: Integer): TltsErrorCode; stdcall;
TltsFontSetCharSpacing = function(const aHandle: TltsFontHandle; const aValue: Integer): TltsErrorCode; stdcall;
TltsFontSetLineSpacing = function(const aHandle: TltsFontHandle; const aValue: Single): TltsErrorCode; stdcall;
TltsFontDestroy = function(const aHandle: TltsFontHandle): TltsErrorCode; stdcall;
TltsTextBlockGetRect = function(const aHandle: TltsTextBlockHandle; out aValue: TltsRect): TltsErrorCode; stdcall;
TltsTextBlockGetWidth = function(const aHandle: TltsTextBlockHandle; out aValue: Integer): TltsErrorCode; stdcall;
TltsTextBlockGetHeight = function(const aHandle: TltsTextBlockHandle; out aValue: Integer): TltsErrorCode; stdcall;
TltsTextBlockGetFlags = function(const aHandle: TltsTextBlockHandle; out aValue: TltsBlockFlags): TltsErrorCode; stdcall;
TltsTextBlockGetTop = function(const aHandle: TltsTextBlockHandle; out aValue: Integer): TltsErrorCode; stdcall;
TltsTextBlockGetLeft = function(const aHandle: TltsTextBlockHandle; out aValue: Integer): TltsErrorCode; stdcall;
TltsTextBlockGetVertAlign = function(const aHandle: TltsTextBlockHandle; out aValue: TltsVertAlignment): TltsErrorCode; stdcall;
TltsTextBlockGetHorzAlign = function(const aHandle: TltsTextBlockHandle; out aValue: TltsHorzAlignment): TltsErrorCode; stdcall;
TltsTextBlockGetClipping = function(const aHandle: TltsTextBlockHandle; out aValue: TltsClipping): TltsErrorCode; stdcall;
TltsTextBlockGetColor = function(const aHandle: TltsTextBlockHandle; out aValue: TltsColor4f): TltsErrorCode; stdcall;
TltsTextBlockGetFont = function(const aHandle: TltsTextBlockHandle; out aValue: TltsFontHandle): TltsErrorCode; stdcall;
TltsTextBlockSetTop = function(const aHandle: TltsTextBlockHandle; const aValue: Integer): TltsErrorCode; stdcall;
TltsTextBlockSetLeft = function(const aHandle: TltsTextBlockHandle; const aValue: Integer): TltsErrorCode; stdcall;
TltsTextBlockSetVertAlign = function(const aHandle: TltsTextBlockHandle; const aValue: TltsVertAlignment): TltsErrorCode; stdcall;
TltsTextBlockSetHorzAlign = function(const aHandle: TltsTextBlockHandle; const aValue: TltsHorzAlignment): TltsErrorCode; stdcall;
TltsTextBlockSetClipping = function(const aHandle: TltsTextBlockHandle; const aValue: TltsClipping): TltsErrorCode; stdcall;
TltsTextBlockSetColor = function(const aHandle: TltsTextBlockHandle; const aValue: TltsColor4f): TltsErrorCode; stdcall;
TltsTextBlockSetFont = function(const aHandle: TltsTextBlockHandle; const aValue: TltsFontHandle): TltsErrorCode; stdcall;
TltsTextBlockGetActualHeight = function(const aHandle: TltsTextBlockHandle): Integer; stdcall;
TltsTextBlockGetTextWidthA = function(const aHandle: TltsTextBlockHandle; const aText: PAnsiChar): Integer; stdcall;
TltsTextBlockGetTextWidthW = function(const aHandle: TltsTextBlockHandle; const aText: PWideChar): Integer; stdcall;
TltsTextBlockTextOutA = function(const aHandle: TltsTextBlockHandle; const aText: PAnsiChar): TltsErrorCode; stdcall;
TltsTextBlockTextOutW = function(const aHandle: TltsTextBlockHandle; const aText: PWideChar): TltsErrorCode; stdcall;
TltsTextBlockDestroy = function(const aHandle: TltsTextBlockHandle): TltsErrorCode; stdcall;
TltsImageCreate = function(const aContext: TltsContextHandle): TltsImageHandle; stdcall;
TltsImageIsEmpty = function(const aHandle: TltsImageHandle; out aValue: Boolean): TltsErrorCode; stdcall;
TltsImageGetWidth = function(const aHandle: TltsImageHandle): Integer; stdcall;
TltsImageGetHeight = function(const aHandle: TltsImageHandle): Integer; stdcall;
TltsImageGetLineSize = function(const aHandle: TltsImageHandle): Integer; stdcall;
TltsImageGetDataSize = function(const aHandle: TltsImageHandle): Integer; stdcall;
TltsImageGetFormat = function(const aHandle: TltsImageHandle; out aValue: TltsFormat): TltsErrorCode; stdcall;
TltsImageGetData = function(const aHandle: TltsImageHandle): Pointer; stdcall;
TltsImageGetScanline = function(const aHandle: TltsImageHandle; const aIndex: Integer): Pointer; stdcall;
TltsImageGetPixelAt = function(const aHandle: TltsImageHandle; const aX, aY: Integer; out aColor: TltsColor4f): TltsErrorCode; stdcall;
TltsImageAssign = function(const aHandle, aSource: TltsImageHandle): TltsErrorCode; stdcall;
TltsImageCreateEmpty = function(const aHandle: TltsImageHandle; const aFormat: TltsFormat; const aWidth, aHeight: Integer): TltsErrorCode; stdcall;
TltsImageLoadFromFunc = function(const aHandle: TltsImageHandle; const aCallback: TltsImageLoadInternFunc; aArgs: Pointer): TltsErrorCode; stdcall;
TltsImageResize = function(const aHandle: TltsImageHandle; const aWidth, aHeight, aX, aY: Integer): TltsErrorCode; stdcall;
TltsImageFillColor = function(const aHandle: TltsImageHandle; const aColor: TltsColor4f; const aMask: TltsColorChannels; const aModes: TltsImageModes): TltsErrorCode; stdcall;
TltsImageFillPattern = function(const aHandle, aPattern: TltsImageHandle; const aX, aY: Integer; const aMask: TltsColorChannels; const aModes: TltsImageModes): TltsErrorCode; stdcall;
TltsImageBlend = function(const aHandle, aSource: TltsImageHandle; const aX, aY: Integer; const aBlendFunc: TltsImageBlendInternFunc; aArgs: Pointer): TltsErrorCode; stdcall;
TltsImageBlur = function(const aHandle: TltsImageHandle; const aHorzRad, aHorzStr, aVertRad, aVertStr: Single; const aMask: TltsColorChannels): TltsErrorCode; stdcall;
TltsImageDestroy = function(const aHandle: TltsImageHandle): TltsErrorCode; stdcall;
TltsPostProcessorAddRange = function(const aHandle: TltsPostProcessorHandle; const aUsage: TltsCharRangeUsage; const aStart, aStop: WideChar): TltsErrorCode; stdcall;
TltsPostProcessorAddChars = function(const aHandle: TltsPostProcessorHandle; const aUsage: TltsCharRangeUsage; const aChars: PWideChar): TltsErrorCode; stdcall;
TltsPostProcessorClearRanges = function(const aHandle: TltsPostProcessorHandle): TltsErrorCode; stdcall;
TltsPostProcessorExecute = function (const aHandle: TltsPostProcessorHandle; const aChar: TltsCharHandle; const aImage: TltsImageHandle): TltsErrorCode; stdcall;
TltsPostProcessorFillColorCreate = function(const aContext: TltsContextHandle; const aColor: TltsColor4f; const aModes: TltsImageModes; const aChannels: TltsColorChannels): TltsPostProcessorHandle; stdcall;
TltsPostProcessorFillPatterCreate = function(const aContext: TltsContextHandle; const aPattern: TltsImageHandle; const aOwnsPatter: Boolean; const aPosition: TltsPosition; const aModes: TltsImageModes; const aChannels: TltsColorChannels): TltsPostProcessorHandle; stdcall;
TltsPostProcessorBorderCreate = function(const aContext: TltsContextHandle; const aWidth, aStrength: Single; const aColor: TltsColor4f; const aKeepSize: Boolean): TltsPostProcessorHandle; stdcall;
TltsPostProcessorShadowCreate = function(const aContext: TltsContextHandle; const aRadius, aStrength: Single; const aOffset: TltsPosition; const aColor: TltsColor4f): TltsPostProcessorHandle; stdcall;
TltsPostProcessorCustomCreate = function(const aContext: TltsContextHandle; const aData: PltsPostProcessorCustomData): TltsPostProcessorHandle; stdcall;
TltsPostProcessorDestroy = function(const aHandle: TltsPostProcessorHandle): TltsErrorCode; stdcall;
TltsCharGetCharCode = function(const aHandle: TltsCharHandle; out aValue: WideChar): TltsErrorCode; stdcall;
TltsCharGetGlyphMetric = function(const aHandle: TltsCharHandle; out aValue: TltsGlyphMetric): TltsErrorCode; stdcall;
TltsCharSetGlyphMetric = function(const aHandle: TltsCharHandle; const aValue: TltsGlyphMetric): TltsErrorCode; stdcall;
TltsInitialize = function(): TltsErrorCode; stdcall;
TltsGetLastErrorCode = function(): TltsErrorCode; stdcall;
TltsGetLastErrorMsg = function(): PAnsiChar; stdcall;
TltsFinalize = function(): TltsErrorCode; stdcall;
var
ltsContextCreate: TltsContextCreate;
ltsContextGetCodePage: TltsContextGetCodePage;
ltsContextGetDefaultChar: TltsContextGetDefaultChar;
ltsContextSetCodePage: TltsContextSetCodePage;
ltsContextSetDefaultChar: TltsContextSetDefaultChar;
ltsContextAnsiToWide: TltsContextAnsiToWide;
ltsContextDestroy: TltsContextDestroy;
ltsRendererCreate: TltsRendererCreate;
ltsRendererCustomCreate: TltsRendererCustomCreate;
ltsRendererBeginBlock: TltsRendererBeginBlock;
ltsRendererEndBlock: TltsRendererEndBlock;
ltsRendererAbortBlock: TltsRendererAbortBlock;
ltsRendererGetTextWidthA: TltsRendererGetTextWidthA;
ltsRendererGetTextWidthW: TltsRendererGetTextWidthW;
ltsRendererDestroy: TltsRendererDestroy;
ltsFontCreatorCreate: TltsFontCreatorCreate;
ltsFontCreatorGetFontByName: TltsFontCreatorGetFontByName;
ltsFontCreatorGetFontByFile: TltsFontCreatorGetFontByFile;
ltsFontCreatorGetFontByStream: TltsFontCreatorGetFontByStream;
ltsFontCreatorDestroy: TltsFontCreatorDestroy;
ltsFontGetPostProcessor: TltsFontGetPostProcessor;
ltsFontGetTabWidth: TltsFontGetTabWidth;
ltsFontGetCharSpacing: TltsFontGetCharSpacing;
ltsFontGetLineSpacing: TltsFontGetLineSpacing;
ltsFontGetMetric: TltsFontGetMetric;
ltsFontGetFontname: TltsFontGetFontname;
ltsFontGetFacename: TltsFontGetFacename;
ltsFontGetStylename: TltsFontGetStylename;
ltsFontGetFullname: TltsFontGetFullname;
ltsFontGetCopyright: TltsFontGetCopyright;
ltsFontSetPostProcessor: TltsFontSetPostProcessor;
ltsFontSetTabWidth: TltsFontSetTabWidth;
ltsFontSetCharSpacing: TltsFontSetCharSpacing;
ltsFontSetLineSpacing: TltsFontSetLineSpacing;
ltsFontDestroy: TltsFontDestroy;
ltsTextBlockGetRect: TltsTextBlockGetRect;
ltsTextBlockGetWidth: TltsTextBlockGetWidth;
ltsTextBlockGetHeight: TltsTextBlockGetHeight;
ltsTextBlockGetFlags: TltsTextBlockGetFlags;
ltsTextBlockGetTop: TltsTextBlockGetTop;
ltsTextBlockGetLeft: TltsTextBlockGetLeft;
ltsTextBlockGetVertAlign: TltsTextBlockGetVertAlign;
ltsTextBlockGetHorzAlign: TltsTextBlockGetHorzAlign;
ltsTextBlockGetClipping: TltsTextBlockGetClipping;
ltsTextBlockGetColor: TltsTextBlockGetColor;
ltsTextBlockGetFont: TltsTextBlockGetFont;
ltsTextBlockSetTop: TltsTextBlockSetTop;
ltsTextBlockSetLeft: TltsTextBlockSetLeft;
ltsTextBlockSetVertAlign: TltsTextBlockSetVertAlign;
ltsTextBlockSetHorzAlign: TltsTextBlockSetHorzAlign;
ltsTextBlockSetClipping: TltsTextBlockSetClipping;
ltsTextBlockSetColor: TltsTextBlockSetColor;
ltsTextBlockSetFont: TltsTextBlockSetFont;
ltsTextBlockGetActualHeight: TltsTextBlockGetActualHeight;
ltsTextBlockGetTextWidthA: TltsTextBlockGetTextWidthA;
ltsTextBlockGetTextWidthW: TltsTextBlockGetTextWidthW;
ltsTextBlockTextOutA: TltsTextBlockTextOutA;
ltsTextBlockTextOutW: TltsTextBlockTextOutW;
ltsTextBlockDestroy: TltsTextBlockDestroy;
ltsImageCreate: TltsImageCreate;
ltsImageIsEmpty: TltsImageIsEmpty;
ltsImageGetWidth: TltsImageGetWidth;
ltsImageGetHeight: TltsImageGetHeight;
ltsImageGetLineSize: TltsImageGetLineSize;
ltsImageGetDataSize: TltsImageGetDataSize;
ltsImageGetFormat: TltsImageGetFormat;
ltsImageGetData: TltsImageGetData;
ltsImageGetScanline: TltsImageGetScanline;
ltsImageGetPixelAt: TltsImageGetPixelAt;
ltsImageAssign: TltsImageAssign;
ltsImageCreateEmpty: TltsImageCreateEmpty;
ltsImageLoadFromFunc: TltsImageLoadFromFunc;
ltsImageResize: TltsImageResize;
ltsImageFillColor: TltsImageFillColor;
ltsImageFillPattern: TltsImageFillPattern;
ltsImageBlend: TltsImageBlend;
ltsImageBlur: TltsImageBlur;
ltsImageDestroy: TltsImageDestroy;
ltsPostProcessorAddRange: TltsPostProcessorAddRange;
ltsPostProcessorAddChars: TltsPostProcessorAddChars;
ltsPostProcessorClearRanges: TltsPostProcessorClearRanges;
ltsPostProcessorExecute: TltsPostProcessorExecute;
ltsPostProcessorFillColorCreate: TltsPostProcessorFillColorCreate;
TltsImageLoadFunc = procedure(aImage: TltsImage; X, Y: Integer; var aPixel: TltsColor4f; aArgs: Pointer);
TltsImageBlendFunc = function (aSrc, aDst: TltsColor4f; aArgs: Pointer): TltsColor4f;
TltsImageLoadInternFunc = procedure(aHandle: TltsImageHandle; X, Y: Integer; var aPixel: TltsColor4f; aArgs: Pointer); stdcall;
TltsImageBlendInternFunc = function (aHandle: TltsImageHandle; aSrc, aDst: TltsColor4f; aArgs: Pointer): TltsColor4f; stdcall;
TltsContextCreate = function(): TltsContextHandle; stdcall;
TltsContextGetCodePage = function(aHandle: TltsContextHandle; out aCodePage: TltsCodePage): TltsErrorCode; stdcall;
TltsContextGetDefaultChar = function(aHandle: TltsContextHandle; out aValue: WideChar): TltsErrorCode; stdcall;
TltsContextSetCodePage = function(aHandle: TltsContextHandle; aCodePage: TltsCodePage): TltsErrorCode; stdcall;
TltsContextSetDefaultChar = function(aHandle: TltsContextHandle; aValue: WideChar): TltsErrorCode; stdcall;
TltsContextAnsiToWide = function(aHandle: TltsContextHandle; aText: PAnsiChar): PWideChar; stdcall;
TltsContextDestroy = function(aHandle: TltsContextHandle): TltsErrorCode; stdcall;
TltsRendererCreate = function(aHandle: TltsContextHandle; aType: TltsRendererType; aFormat: TltsFormat): TltsRendererHandle; stdcall;
TltsRendererCustomCreate = function(aHandle: TltsContextHandle; aFormat: TltsFormat; constref aData: TltsRendererCustomData): TltsRendererHandle; stdcall;
TltsRendererBeginBlock = function(aHandle: TltsRendererHandle; aTop, aLeft, aWidth, aHeight: Integer; aFlags: TltsBlockFlags): TltsTextBlockHandle; stdcall;
TltsRendererEndBlock = function(aHandle: TltsRendererHandle; aBlock: TltsTextBlockHandle): TltsErrorCode; stdcall;
TltsRendererAbortBlock = function(aHandle: TltsRendererHandle; aBlock: TltsTextBlockHandle): TltsErrorCode; stdcall;
TltsRendererGetTextWidthA = function(aHandle: TltsRendererHandle; aFont: TltsFontHandle; aText: PAnsiChar): Integer; stdcall;
TltsRendererGetTextWidthW = function(aHandle: TltsRendererHandle; aFont: TltsFontHandle; aText: PWideChar): Integer; stdcall;
TltsRendererDestroy = function(aHandle: TltsRendererHandle): TltsErrorCode; stdcall;
TltsFontCreatorCreate = function(aHandle: TltsContextHandle; aType: TltsFontCreatorType): TltsFontCreatorHandle; stdcall;
TltsFontCreatorGetFontByName = function(aHandle: TltsFontCreatorHandle; aFontname: PAnsiChar; aSize: Integer; aStyle: TltsFontStyles; aAntiAliasing: TltsAntiAliasing): TltsFontHandle; stdcall;
TltsFontCreatorGetFontByFile = function(aHandle: TltsFontCreatorHandle; aFilename: PAnsiChar; aSize: Integer; aStyle: TltsFontStyles; aAntiAliasing: TltsAntiAliasing): TltsFontHandle; stdcall;
TltsFontCreatorGetFontByStream = function(aHandle: TltsFontCreatorHandle; aStream: PltsStream; aSize: Integer; aStyle: TltsFontStyles; aAntiAliasing: TltsAntiAliasing): TltsFontHandle; stdcall;
TltsFontCreatorDestroy = function(aHandle: TltsFontCreatorHandle): TltsErrorCode; stdcall;
TltsFontGetPostProcessor = function(aHandle: TltsFontHandle): TltsPostProcessorHandle; stdcall;
TltsFontGetTabWidth = function(aHandle: TltsFontHandle; out aValue: Integer): TltsErrorCode; stdcall;
TltsFontGetCharSpacing = function(aHandle: TltsFontHandle; out aValue: Integer): TltsErrorCode; stdcall;
TltsFontGetLineSpacing = function(aHandle: TltsFontHandle; out aValue: Single): TltsErrorCode; stdcall;
TltsFontGetMetric = function(aHandle: TltsFontHandle; out aValue: TltsFontMetric): TltsErrorCode; stdcall;
TltsFontGetFontname = function(aHandle: TltsFontHandle): PAnsiChar; stdcall;
TltsFontGetFacename = function(aHandle: TltsFontHandle): PAnsiChar; stdcall;
TltsFontGetStylename = function(aHandle: TltsFontHandle): PAnsiChar; stdcall;
TltsFontGetFullname = function(aHandle: TltsFontHandle): PAnsiChar; stdcall;
TltsFontGetCopyright = function(aHandle: TltsFontHandle): PAnsiChar; stdcall;
TltsFontSetPostProcessor = function(aHandle: TltsFontHandle; aValue: TltsPostProcessorHandle): TltsErrorCode; stdcall;
TltsFontSetTabWidth = function(aHandle: TltsFontHandle; aValue: Integer): TltsErrorCode; stdcall;
TltsFontSetCharSpacing = function(aHandle: TltsFontHandle; aValue: Integer): TltsErrorCode; stdcall;
TltsFontSetLineSpacing = function(aHandle: TltsFontHandle; aValue: Single): TltsErrorCode; stdcall;
TltsFontDestroy = function(aHandle: TltsFontHandle): TltsErrorCode; stdcall;
TltsTextBlockGetRect = function(aHandle: TltsTextBlockHandle; out aValue: TltsRect): TltsErrorCode; stdcall;
TltsTextBlockGetWidth = function(aHandle: TltsTextBlockHandle; out aValue: Integer): TltsErrorCode; stdcall;
TltsTextBlockGetHeight = function(aHandle: TltsTextBlockHandle; out aValue: Integer): TltsErrorCode; stdcall;
TltsTextBlockGetFlags = function(aHandle: TltsTextBlockHandle; out aValue: TltsBlockFlags): TltsErrorCode; stdcall;
TltsTextBlockGetTop = function(aHandle: TltsTextBlockHandle; out aValue: Integer): TltsErrorCode; stdcall;
TltsTextBlockGetLeft = function(aHandle: TltsTextBlockHandle; out aValue: Integer): TltsErrorCode; stdcall;
TltsTextBlockGetVertAlign = function(aHandle: TltsTextBlockHandle; out aValue: TltsVertAlignment): TltsErrorCode; stdcall;
TltsTextBlockGetHorzAlign = function(aHandle: TltsTextBlockHandle; out aValue: TltsHorzAlignment): TltsErrorCode; stdcall;
TltsTextBlockGetClipping = function(aHandle: TltsTextBlockHandle; out aValue: TltsClipping): TltsErrorCode; stdcall;
TltsTextBlockGetColor = function(aHandle: TltsTextBlockHandle; out aValue: TltsColor4f): TltsErrorCode; stdcall;
TltsTextBlockGetFont = function(aHandle: TltsTextBlockHandle; out aValue: TltsFontHandle): TltsErrorCode; stdcall;
TltsTextBlockSetTop = function(aHandle: TltsTextBlockHandle; aValue: Integer): TltsErrorCode; stdcall;
TltsTextBlockSetLeft = function(aHandle: TltsTextBlockHandle; aValue: Integer): TltsErrorCode; stdcall;
TltsTextBlockSetVertAlign = function(aHandle: TltsTextBlockHandle; aValue: TltsVertAlignment): TltsErrorCode; stdcall;
TltsTextBlockSetHorzAlign = function(aHandle: TltsTextBlockHandle; aValue: TltsHorzAlignment): TltsErrorCode; stdcall;
TltsTextBlockSetClipping = function(aHandle: TltsTextBlockHandle; aValue: TltsClipping): TltsErrorCode; stdcall;
TltsTextBlockSetColor = function(aHandle: TltsTextBlockHandle; aValue: TltsColor4f): TltsErrorCode; stdcall;
TltsTextBlockSetFont = function(aHandle: TltsTextBlockHandle; aValue: TltsFontHandle): TltsErrorCode; stdcall;
TltsTextBlockGetActualHeight = function(aHandle: TltsTextBlockHandle): Integer; stdcall;
TltsTextBlockGetTextWidthA = function(aHandle: TltsTextBlockHandle; aText: PAnsiChar): Integer; stdcall;
TltsTextBlockGetTextWidthW = function(aHandle: TltsTextBlockHandle; aText: PWideChar): Integer; stdcall;
TltsTextBlockTextOutA = function(aHandle: TltsTextBlockHandle; aText: PAnsiChar): TltsErrorCode; stdcall;
TltsTextBlockTextOutW = function(aHandle: TltsTextBlockHandle; aText: PWideChar): TltsErrorCode; stdcall;
TltsTextBlockDestroy = function(aHandle: TltsTextBlockHandle): TltsErrorCode; stdcall;
TltsImageCreate = function(aContext: TltsContextHandle): TltsImageHandle; stdcall;
TltsImageIsEmpty = function(aHandle: TltsImageHandle; out aValue: Boolean): TltsErrorCode; stdcall;
TltsImageGetWidth = function(aHandle: TltsImageHandle): Integer; stdcall;
TltsImageGetHeight = function(aHandle: TltsImageHandle): Integer; stdcall;
TltsImageGetLineSize = function(aHandle: TltsImageHandle): Integer; stdcall;
TltsImageGetDataSize = function(aHandle: TltsImageHandle): Integer; stdcall;
TltsImageGetFormat = function(aHandle: TltsImageHandle; out aValue: TltsFormat): TltsErrorCode; stdcall;
TltsImageGetData = function(aHandle: TltsImageHandle): Pointer; stdcall;
TltsImageGetScanline = function(aHandle: TltsImageHandle; aIndex: Integer): Pointer; stdcall;
TltsImageGetPixelAt = function(aHandle: TltsImageHandle; aX, aY: Integer; out aColor: TltsColor4f): TltsErrorCode; stdcall;
TltsImageAssign = function(aHandle, aSource: TltsImageHandle): TltsErrorCode; stdcall;
TltsImageCreateEmpty = function(aHandle: TltsImageHandle; aFormat: TltsFormat; aWidth, aHeight: Integer): TltsErrorCode; stdcall;
TltsImageLoadFromFunc = function(aHandle: TltsImageHandle; aCallback: TltsImageLoadInternFunc; aArgs: Pointer): TltsErrorCode; stdcall;
TltsImageResize = function(aHandle: TltsImageHandle; aWidth, aHeight, aX, aY: Integer): TltsErrorCode; stdcall;
TltsImageFillColor = function(aHandle: TltsImageHandle; aColor: TltsColor4f; aMask: TltsColorChannels; aModes: TltsImageModes): TltsErrorCode; stdcall;
TltsImageFillPattern = function(aHandle, aPattern: TltsImageHandle; aX, aY: Integer; aMask: TltsColorChannels; aModes: TltsImageModes): TltsErrorCode; stdcall;
TltsImageBlend = function(aHandle, aSource: TltsImageHandle; aX, aY: Integer; aBlendFunc: TltsImageBlendInternFunc; aArgs: Pointer): TltsErrorCode; stdcall;
TltsImageBlur = function(aHandle: TltsImageHandle; aHorzRad, aHorzStr, aVertRad, aVertStr: Single; aMask: TltsColorChannels): TltsErrorCode; stdcall;
TltsImageDestroy = function(aHandle: TltsImageHandle): TltsErrorCode; stdcall;
TltsPostProcessorAddRange = function(aHandle: TltsPostProcessorHandle; aUsage: TltsCharRangeUsage; aStart, aStop: WideChar): TltsErrorCode; stdcall;
TltsPostProcessorAddChars = function(aHandle: TltsPostProcessorHandle; aUsage: TltsCharRangeUsage; aChars: PWideChar): TltsErrorCode; stdcall;
TltsPostProcessorClearRanges = function(aHandle: TltsPostProcessorHandle): TltsErrorCode; stdcall;
TltsPostProcessorExecute = function(aHandle: TltsPostProcessorHandle; aChar: TltsCharHandle; aImage: TltsImageHandle): TltsErrorCode; stdcall;
TltsPostProcessorFillColorCreate = function(aContext: TltsContextHandle; aColor: TltsColor4f; aModes: TltsImageModes; aChannels: TltsColorChannels): TltsPostProcessorHandle; stdcall;
TltsPostProcessorFillPatterCreate = function(aContext: TltsContextHandle; aPattern: TltsImageHandle; aOwnsPatter: Boolean; aPosition: TltsPosition; aModes: TltsImageModes; aChannels: TltsColorChannels): TltsPostProcessorHandle; stdcall;
TltsPostProcessorBorderCreate = function(aContext: TltsContextHandle; aWidth, aStrength: Single; aColor: TltsColor4f; aKeepSize: Boolean): TltsPostProcessorHandle; stdcall;
TltsPostProcessorShadowCreate = function(aContext: TltsContextHandle; aRadius, aStrength: Single; aOffset: TltsPosition; aColor: TltsColor4f): TltsPostProcessorHandle; stdcall;
TltsPostProcessorCustomCreate = function(aContext: TltsContextHandle; constref aData: TltsPostProcessorCustomData): TltsPostProcessorHandle; stdcall;
TltsPostProcessorDestroy = function(aHandle: TltsPostProcessorHandle): TltsErrorCode; stdcall;
TltsCharGetCharCode = function(aHandle: TltsCharHandle; out aValue: WideChar): TltsErrorCode; stdcall;
TltsCharGetGlyphMetric = function(aHandle: TltsCharHandle; out aValue: TltsGlyphMetric): TltsErrorCode; stdcall;
TltsCharSetGlyphMetric = function(aHandle: TltsCharHandle; aValue: TltsGlyphMetric): TltsErrorCode; stdcall;
TltsInitialize = function(): TltsErrorCode; stdcall;
TltsGetLastErrorCode = function(): TltsErrorCode; stdcall;
TltsGetLastErrorMsg = function(): PAnsiChar; stdcall;
TltsFinalize = function(): TltsErrorCode; stdcall;
var
ltsContextCreate: TltsContextCreate;
ltsContextGetCodePage: TltsContextGetCodePage;
ltsContextGetDefaultChar: TltsContextGetDefaultChar;
ltsContextSetCodePage: TltsContextSetCodePage;
ltsContextSetDefaultChar: TltsContextSetDefaultChar;
ltsContextAnsiToWide: TltsContextAnsiToWide;
ltsContextDestroy: TltsContextDestroy;
ltsRendererCreate: TltsRendererCreate;
ltsRendererCustomCreate: TltsRendererCustomCreate;
ltsRendererBeginBlock: TltsRendererBeginBlock;
ltsRendererEndBlock: TltsRendererEndBlock;
ltsRendererAbortBlock: TltsRendererAbortBlock;
ltsRendererGetTextWidthA: TltsRendererGetTextWidthA;
ltsRendererGetTextWidthW: TltsRendererGetTextWidthW;
ltsRendererDestroy: TltsRendererDestroy;
ltsFontCreatorCreate: TltsFontCreatorCreate;
ltsFontCreatorGetFontByName: TltsFontCreatorGetFontByName;
ltsFontCreatorGetFontByFile: TltsFontCreatorGetFontByFile;
ltsFontCreatorGetFontByStream: TltsFontCreatorGetFontByStream;
ltsFontCreatorDestroy: TltsFontCreatorDestroy;
ltsFontGetPostProcessor: TltsFontGetPostProcessor;
ltsFontGetTabWidth: TltsFontGetTabWidth;
ltsFontGetCharSpacing: TltsFontGetCharSpacing;
ltsFontGetLineSpacing: TltsFontGetLineSpacing;
ltsFontGetMetric: TltsFontGetMetric;
ltsFontGetFontname: TltsFontGetFontname;
ltsFontGetFacename: TltsFontGetFacename;
ltsFontGetStylename: TltsFontGetStylename;
ltsFontGetFullname: TltsFontGetFullname;
ltsFontGetCopyright: TltsFontGetCopyright;
ltsFontSetPostProcessor: TltsFontSetPostProcessor;
ltsFontSetTabWidth: TltsFontSetTabWidth;
ltsFontSetCharSpacing: TltsFontSetCharSpacing;
ltsFontSetLineSpacing: TltsFontSetLineSpacing;
ltsFontDestroy: TltsFontDestroy;
ltsTextBlockGetRect: TltsTextBlockGetRect;
ltsTextBlockGetWidth: TltsTextBlockGetWidth;
ltsTextBlockGetHeight: TltsTextBlockGetHeight;
ltsTextBlockGetFlags: TltsTextBlockGetFlags;
ltsTextBlockGetTop: TltsTextBlockGetTop;
ltsTextBlockGetLeft: TltsTextBlockGetLeft;
ltsTextBlockGetVertAlign: TltsTextBlockGetVertAlign;
ltsTextBlockGetHorzAlign: TltsTextBlockGetHorzAlign;
ltsTextBlockGetClipping: TltsTextBlockGetClipping;
ltsTextBlockGetColor: TltsTextBlockGetColor;
ltsTextBlockGetFont: TltsTextBlockGetFont;
ltsTextBlockSetTop: TltsTextBlockSetTop;
ltsTextBlockSetLeft: TltsTextBlockSetLeft;
ltsTextBlockSetVertAlign: TltsTextBlockSetVertAlign;
ltsTextBlockSetHorzAlign: TltsTextBlockSetHorzAlign;
ltsTextBlockSetClipping: TltsTextBlockSetClipping;
ltsTextBlockSetColor: TltsTextBlockSetColor;
ltsTextBlockSetFont: TltsTextBlockSetFont;
ltsTextBlockGetActualHeight: TltsTextBlockGetActualHeight;
ltsTextBlockGetTextWidthA: TltsTextBlockGetTextWidthA;
ltsTextBlockGetTextWidthW: TltsTextBlockGetTextWidthW;
ltsTextBlockTextOutA: TltsTextBlockTextOutA;
ltsTextBlockTextOutW: TltsTextBlockTextOutW;
ltsTextBlockDestroy: TltsTextBlockDestroy;
ltsImageCreate: TltsImageCreate;
ltsImageIsEmpty: TltsImageIsEmpty;
ltsImageGetWidth: TltsImageGetWidth;
ltsImageGetHeight: TltsImageGetHeight;
ltsImageGetLineSize: TltsImageGetLineSize;
ltsImageGetDataSize: TltsImageGetDataSize;
ltsImageGetFormat: TltsImageGetFormat;
ltsImageGetData: TltsImageGetData;
ltsImageGetScanline: TltsImageGetScanline;
ltsImageGetPixelAt: TltsImageGetPixelAt;
ltsImageAssign: TltsImageAssign;
ltsImageCreateEmpty: TltsImageCreateEmpty;
ltsImageLoadFromFunc: TltsImageLoadFromFunc;
ltsImageResize: TltsImageResize;
ltsImageFillColor: TltsImageFillColor;
ltsImageFillPattern: TltsImageFillPattern;
ltsImageBlend: TltsImageBlend;
ltsImageBlur: TltsImageBlur;
ltsImageDestroy: TltsImageDestroy;
ltsPostProcessorAddRange: TltsPostProcessorAddRange;
ltsPostProcessorAddChars: TltsPostProcessorAddChars;
ltsPostProcessorClearRanges: TltsPostProcessorClearRanges;
ltsPostProcessorExecute: TltsPostProcessorExecute;
ltsPostProcessorFillColorCreate: TltsPostProcessorFillColorCreate;
ltsPostProcessorFillPatterCreate: TltsPostProcessorFillPatterCreate;
ltsPostProcessorBorderCreate: TltsPostProcessorBorderCreate;
ltsPostProcessorShadowCreate: TltsPostProcessorShadowCreate;
ltsPostProcessorCustomCreate: TltsPostProcessorCustomCreate;
ltsPostProcessorDestroy: TltsPostProcessorDestroy;
ltsPostProcessorBorderCreate: TltsPostProcessorBorderCreate;
ltsPostProcessorShadowCreate: TltsPostProcessorShadowCreate;
ltsPostProcessorCustomCreate: TltsPostProcessorCustomCreate;
ltsPostProcessorDestroy: TltsPostProcessorDestroy;

ltsCharGetCharCode: TltsCharGetCharCode;
ltsCharGetGlyphMetric: TltsCharGetGlyphMetric;
ltsCharSetGlyphMetric: TltsCharSetGlyphMetric;
ltsCharGetCharCode: TltsCharGetCharCode;
ltsCharGetGlyphMetric: TltsCharGetGlyphMetric;
ltsCharSetGlyphMetric: TltsCharSetGlyphMetric;

ltsGetLastErrorCode: TltsGetLastErrorCode;
ltsGetLastErrorMsg: TltsGetLastErrorMsg;
ltsGetLastErrorCode: TltsGetLastErrorCode;
ltsGetLastErrorMsg: TltsGetLastErrorMsg;

procedure ltsInitialize(const aLibName: String);
procedure ltsFinalize;
@@ -1033,7 +1034,7 @@ type
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure ltsImageLoadCallback(const aHandle: TltsImageHandle; const X, Y: Integer; var aPixel: TltsColor4f; aArgs: Pointer); stdcall;
procedure ltsImageLoadCallback(aHandle: TltsImageHandle; X, Y: Integer; var aPixel: TltsColor4f; aArgs: Pointer); stdcall;
var
p: PImageLoadArgs;
begin
@@ -1042,12 +1043,12 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageBlendCallback(const aHandle: TltsImageHandle; const aSrc, aDst: TltsColor4f; aArgs: Pointer): TltsColor4f; stdcall;
procedure ltsImageBlendCallback(aHandle: TltsImageHandle; aSrc, aDst: TltsColor4f; out aResult: TltsColor4f; aArgs: Pointer); stdcall;
var
p: PImageBlendArgs;
begin
p := PImageBlendArgs(aArgs);
result := p^.callback(aSrc, aDst, p^.args);
aResult := p^.callback(aSrc, aDst, p^.args);
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1092,6 +1093,7 @@ begin
ltsFontCreatorGetFontByFile := TltsFontCreatorGetFontByFile( LoadProc('ltsFontCreatorGetFontByFile'));
ltsFontCreatorGetFontByStream := TltsFontCreatorGetFontByStream( LoadProc('ltsFontCreatorGetFontByStream'));
ltsFontCreatorDestroy := TltsFontCreatorDestroy( LoadProc('ltsFontCreatorDestroy'));

ltsFontGetPostProcessor := TltsFontGetPostProcessor( LoadProc('ltsFontGetPostProcessor'));
ltsFontGetTabWidth := TltsFontGetTabWidth( LoadProc('ltsFontGetTabWidth'));
ltsFontGetCharSpacing := TltsFontGetCharSpacing( LoadProc('ltsFontGetCharSpacing'));
@@ -1615,7 +1617,7 @@ var
begin
p.args := self;
p.execute := @ltsPostProcessorExecuteCallback;
h := ltsPostProcessorCustomCreate(aContext.Handle, @p);
h := ltsPostProcessorCustomCreate(aContext.Handle, p);
if not Assigned(h) then
raise TltsException.Create(ltsGetLastErrorMsg(), ltsGetLastErrorCode());
inherited Create(h);
@@ -2570,7 +2572,7 @@ begin
d.Render := @ltsRendererCustomRender;
d.CreatRef := @ltsRendererCustomCreateRef;
d.FreeRef := @ltsRendererCustomFreeRef;
h := ltsRendererCustomCreate(aContext.Handle, aFormat, @d);
h := ltsRendererCustomCreate(aContext.Handle, aFormat, d);
if not Assigned(h) then
raise TltsException.Create(ltsGetLastErrorMsg(), ltsGetLastErrorCode());
inherited Create(h);


+ 6
- 6
ultsChar.pas View File

@@ -8,9 +8,9 @@ uses
Classes, SysUtils,
utsTextSuite, ultsTypes;

function ltsCharGetCharCode (const aHandle: TltsCharHandle; var aValue: WideChar): TltsErrorCode; stdcall;
function ltsCharGetGlyphMetric(const aHandle: TltsCharHandle; var aValue: TtsGlyphMetric): TltsErrorCode; stdcall;
function ltsCharSetGlyphMetric(const aHandle: TltsCharHandle; const aValue: TtsGlyphMetric): TltsErrorCode; stdcall;
function ltsCharGetCharCode (aHandle: TltsCharHandle; var aValue: WideChar): TltsErrorCode; stdcall;
function ltsCharGetGlyphMetric(aHandle: TltsCharHandle; var aValue: TtsGlyphMetric): TltsErrorCode; stdcall;
function ltsCharSetGlyphMetric(aHandle: TltsCharHandle; aValue: TtsGlyphMetric): TltsErrorCode; stdcall;

implementation

@@ -20,7 +20,7 @@ uses
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ltsChar///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsCharGetCharCode(const aHandle: TltsCharHandle; var aValue: WideChar): TltsErrorCode; stdcall;
function ltsCharGetCharCode(aHandle: TltsCharHandle; var aValue: WideChar): TltsErrorCode; stdcall;
var
c: TtsChar;
begin
@@ -38,7 +38,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsCharGetGlyphMetric(const aHandle: TltsCharHandle; var aValue: TtsGlyphMetric): TltsErrorCode; stdcall;
function ltsCharGetGlyphMetric(aHandle: TltsCharHandle; var aValue: TtsGlyphMetric): TltsErrorCode; stdcall;
var
c: TtsChar;
begin
@@ -56,7 +56,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsCharSetGlyphMetric(const aHandle: TltsCharHandle; const aValue: TtsGlyphMetric): TltsErrorCode; stdcall;
function ltsCharSetGlyphMetric(aHandle: TltsCharHandle; aValue: TtsGlyphMetric): TltsErrorCode; stdcall;
var
c: TtsChar;
begin


+ 6
- 6
ultsContext.pas View File

@@ -19,9 +19,9 @@ type
function ltsContextCreate (): TltsContextHandle; stdcall;
function ltsContextGetCodePage (const aHandle: TltsContextHandle; var aCodePage: TtsCodePage): TltsErrorCode; stdcall;
function ltsContextGetDefaultChar (const aHandle: TltsContextHandle; var aValue: WideChar): TltsErrorCode; stdcall;
function ltsContextSetCodePage (const aHandle: TltsContextHandle; const aCodePage: TtsCodePage): TltsErrorCode; stdcall;
function ltsContextSetDefaultChar (const aHandle: TltsContextHandle; const aValue: WideChar): TltsErrorCode; stdcall;
function ltsContextAnsiToWide (const aHandle: TltsContextHandle; const aText: PAnsiChar): PWideChar; stdcall;
function ltsContextSetCodePage (const aHandle: TltsContextHandle; aCodePage: TtsCodePage): TltsErrorCode; stdcall;
function ltsContextSetDefaultChar (const aHandle: TltsContextHandle; aValue: WideChar): TltsErrorCode; stdcall;
function ltsContextAnsiToWide (const aHandle: TltsContextHandle; aText: PAnsiChar): PWideChar; stdcall;
function ltsContextDestroy (const aHandle: TltsContextHandle): TltsErrorCode; stdcall;

implementation
@@ -100,7 +100,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsContextSetCodePage(const aHandle: TltsContextHandle; const aCodePage: TtsCodePage): TltsErrorCode; stdcall;
function ltsContextSetCodePage(const aHandle: TltsContextHandle; aCodePage: TtsCodePage): TltsErrorCode; stdcall;
var
c: TtsContext;
begin
@@ -123,7 +123,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsContextSetDefaultChar(const aHandle: TltsContextHandle; const aValue: WideChar): TltsErrorCode; stdcall;
function ltsContextSetDefaultChar(const aHandle: TltsContextHandle; aValue: WideChar): TltsErrorCode; stdcall;
var
c: TtsContext;
begin
@@ -141,7 +141,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsContextAnsiToWide(const aHandle: TltsContextHandle; const aText: PAnsiChar): PWideChar; stdcall;
function ltsContextAnsiToWide(const aHandle: TltsContextHandle; aText: PAnsiChar): PWideChar; stdcall;
var
c: TtsContext;
w: PWideChar;


+ 30
- 30
ultsFont.pas View File

@@ -9,24 +9,24 @@ uses
utsTextSuite,
ultsTypes;

function ltsFontGetPostProcessor (const aHandle: TltsFontHandle): TltsPostProcessorHandle; stdcall;
function ltsFontGetTabWidth (const aHandle: TltsFontHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsFontGetCharSpacing (const aHandle: TltsFontHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsFontGetLineSpacing (const aHandle: TltsFontHandle; var aValue: Single): TltsErrorCode; stdcall;
function ltsFontGetMetric (const aHandle: TltsFontHandle; var aValue: TtsFontMetric): TltsErrorCode; stdcall;
function ltsFontGetPostProcessor (aHandle: TltsFontHandle): TltsPostProcessorHandle; stdcall;
function ltsFontGetTabWidth (aHandle: TltsFontHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsFontGetCharSpacing (aHandle: TltsFontHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsFontGetLineSpacing (aHandle: TltsFontHandle; var aValue: Single): TltsErrorCode; stdcall;
function ltsFontGetMetric (aHandle: TltsFontHandle; var aValue: TtsFontMetric): TltsErrorCode; stdcall;

function ltsFontGetFontname (const aHandle: TltsFontHandle): PAnsiChar; stdcall;
function ltsFontGetFacename (const aHandle: TltsFontHandle): PAnsiChar; stdcall;
function ltsFontGetStylename (const aHandle: TltsFontHandle): PAnsiChar; stdcall;
function ltsFontGetFullname (const aHandle: TltsFontHandle): PAnsiChar; stdcall;
function ltsFontGetCopyright (const aHandle: TltsFontHandle): PAnsiChar; stdcall;
function ltsFontGetFontname (aHandle: TltsFontHandle): PAnsiChar; stdcall;
function ltsFontGetFacename (aHandle: TltsFontHandle): PAnsiChar; stdcall;
function ltsFontGetStylename (aHandle: TltsFontHandle): PAnsiChar; stdcall;
function ltsFontGetFullname (aHandle: TltsFontHandle): PAnsiChar; stdcall;
function ltsFontGetCopyright (aHandle: TltsFontHandle): PAnsiChar; stdcall;

function ltsFontSetPostProcessor (const aHandle: TltsFontHandle; const aValue: TltsPostProcessorHandle): TltsErrorCode; stdcall;
function ltsFontSetTabWidth (const aHandle: TltsFontHandle; const aValue: Integer): TltsErrorCode; stdcall;
function ltsFontSetCharSpacing (const aHandle: TltsFontHandle; const aValue: Integer): TltsErrorCode; stdcall;
function ltsFontSetLineSpacing (const aHandle: TltsFontHandle; const aValue: Single): TltsErrorCode; stdcall;
function ltsFontSetPostProcessor (aHandle: TltsFontHandle; aValue: TltsPostProcessorHandle): TltsErrorCode; stdcall;
function ltsFontSetTabWidth (aHandle: TltsFontHandle; aValue: Integer): TltsErrorCode; stdcall;
function ltsFontSetCharSpacing (aHandle: TltsFontHandle; aValue: Integer): TltsErrorCode; stdcall;
function ltsFontSetLineSpacing (aHandle: TltsFontHandle; aValue: Single): TltsErrorCode; stdcall;

function ltsFontDestroy (const aHandle: TltsFontHandle): TltsErrorCode; stdcall;
function ltsFontDestroy (aHandle: TltsFontHandle): TltsErrorCode; stdcall;

implementation

@@ -36,7 +36,7 @@ uses
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Font//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontGetPostProcessor(const aHandle: TltsFontHandle): TltsPostProcessorHandle; stdcall;
function ltsFontGetPostProcessor(aHandle: TltsFontHandle): TltsPostProcessorHandle; stdcall;
var
f: TtsFont;
begin
@@ -53,7 +53,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontGetTabWidth(const aHandle: TltsFontHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsFontGetTabWidth(aHandle: TltsFontHandle; var aValue: Integer): TltsErrorCode; stdcall;
var
f: TtsFont;
begin
@@ -71,7 +71,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontGetCharSpacing(const aHandle: TltsFontHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsFontGetCharSpacing(aHandle: TltsFontHandle; var aValue: Integer): TltsErrorCode; stdcall;
var
f: TtsFont;
begin
@@ -89,7 +89,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontGetLineSpacing(const aHandle: TltsFontHandle; var aValue: Single): TltsErrorCode; stdcall;
function ltsFontGetLineSpacing(aHandle: TltsFontHandle; var aValue: Single): TltsErrorCode; stdcall;
var
f: TtsFont;
begin
@@ -107,7 +107,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontGetMetric(const aHandle: TltsFontHandle; var aValue: TtsFontMetric): TltsErrorCode; stdcall;
function ltsFontGetMetric(aHandle: TltsFontHandle; var aValue: TtsFontMetric): TltsErrorCode; stdcall;
var
f: TtsFont;
begin
@@ -125,7 +125,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontGetFontname(const aHandle: TltsFontHandle): PAnsiChar; stdcall;
function ltsFontGetFontname(aHandle: TltsFontHandle): PAnsiChar; stdcall;
var
f: TtsFont;
begin
@@ -142,7 +142,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontGetFacename(const aHandle: TltsFontHandle): PAnsiChar; stdcall;
function ltsFontGetFacename(aHandle: TltsFontHandle): PAnsiChar; stdcall;
var
f: TtsFont;
begin
@@ -159,7 +159,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontGetStylename(const aHandle: TltsFontHandle): PAnsiChar; stdcall;
function ltsFontGetStylename(aHandle: TltsFontHandle): PAnsiChar; stdcall;
var
f: TtsFont;
begin
@@ -176,7 +176,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontGetFullname(const aHandle: TltsFontHandle): PAnsiChar; stdcall;
function ltsFontGetFullname(aHandle: TltsFontHandle): PAnsiChar; stdcall;
var
f: TtsFont;
begin
@@ -193,7 +193,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontGetCopyright(const aHandle: TltsFontHandle): PAnsiChar; stdcall;
function ltsFontGetCopyright(aHandle: TltsFontHandle): PAnsiChar; stdcall;
var
f: TtsFont;
begin
@@ -210,7 +210,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontSetPostProcessor(const aHandle: TltsFontHandle; const aValue: TltsPostProcessorHandle): TltsErrorCode; stdcall;
function ltsFontSetPostProcessor(aHandle: TltsFontHandle; aValue: TltsPostProcessorHandle): TltsErrorCode; stdcall;
var
f: TtsFont;
p: TtsPostProcessor;
@@ -229,7 +229,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontSetTabWidth(const aHandle: TltsFontHandle; const aValue: Integer): TltsErrorCode; stdcall;
function ltsFontSetTabWidth(aHandle: TltsFontHandle; aValue: Integer): TltsErrorCode; stdcall;
var
f: TtsFont;
begin
@@ -247,7 +247,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontSetCharSpacing(const aHandle: TltsFontHandle; const aValue: Integer): TltsErrorCode; stdcall;
function ltsFontSetCharSpacing(aHandle: TltsFontHandle; aValue: Integer): TltsErrorCode; stdcall;
var
f: TtsFont;
begin
@@ -265,7 +265,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontSetLineSpacing(const aHandle: TltsFontHandle; const aValue: Single): TltsErrorCode; stdcall;
function ltsFontSetLineSpacing(aHandle: TltsFontHandle; aValue: Single): TltsErrorCode; stdcall;
var
f: TtsFont;
begin
@@ -283,7 +283,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontDestroy(const aHandle: TltsFontHandle): TltsErrorCode; stdcall;
function ltsFontDestroy(aHandle: TltsFontHandle): TltsErrorCode; stdcall;
var
f: TtsFont;
begin


+ 16
- 16
ultsFontCreator.pas View File

@@ -9,14 +9,14 @@ uses
utsTextSuite,
ultsTypes;

function ltsFontCreatorCreate (const aHandle: TltsContextHandle; const aType: TltsFontCreatorType): TltsFontCreatorHandle; stdcall;
function ltsFontCreatorGetFontByName (const aHandle: TltsFontCreatorHandle; const aFontname: PAnsiChar; const aSize: Integer;
const aStyle: TtsFontStyles; const aAntiAliasing: TtsAntiAliasing): TltsFontHandle; stdcall;
function ltsFontCreatorGetFontByFile (const aHandle: TltsFontCreatorHandle; const aFilename: PAnsiChar; const aSize: Integer;
const aStyle: TtsFontStyles; const aAntiAliasing: TtsAntiAliasing): TltsFontHandle; stdcall;
function ltsFontCreatorGetFontByStream(const aHandle: TltsFontCreatorHandle; const aStream: PltsStream; const aSize: Integer;
const aStyle: TtsFontStyles; const aAntiAliasing: TtsAntiAliasing): TltsFontHandle; stdcall;
function ltsFontCreatorDestroy (const aHandle: TltsFontCreatorHandle): TltsErrorCode; stdcall;
function ltsFontCreatorCreate (aHandle: TltsContextHandle; aType: TltsFontCreatorType): TltsFontCreatorHandle; stdcall;
function ltsFontCreatorGetFontByName (aHandle: TltsFontCreatorHandle; aFontname: PAnsiChar; aSize: Integer;
aStyle: TtsFontStyles; aAntiAliasing: TtsAntiAliasing): TltsFontHandle; stdcall;
function ltsFontCreatorGetFontByFile (aHandle: TltsFontCreatorHandle; aFilename: PAnsiChar; aSize: Integer;
aStyle: TtsFontStyles; aAntiAliasing: TtsAntiAliasing): TltsFontHandle; stdcall;
function ltsFontCreatorGetFontByStream(aHandle: TltsFontCreatorHandle; aStream: PltsStream; aSize: Integer;
aStyle: TtsFontStyles; aAntiAliasing: TtsAntiAliasing): TltsFontHandle; stdcall;
function ltsFontCreatorDestroy (aHandle: TltsFontCreatorHandle): TltsErrorCode; stdcall;

implementation

@@ -58,7 +58,7 @@ end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//FontCreato///////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontCreatorCreate(const aHandle: TltsContextHandle; const aType: TltsFontCreatorType): TltsFontCreatorHandle; stdcall;
function ltsFontCreatorCreate(aHandle: TltsContextHandle; aType: TltsFontCreatorType): TltsFontCreatorHandle; stdcall;
var
c: TtsContext;
fc: TtsFontCreator;
@@ -87,8 +87,8 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontCreatorGetFontByName(const aHandle: TltsFontCreatorHandle; const aFontname: PAnsiChar;
const aSize: Integer; const aStyle: TtsFontStyles; const aAntiAliasing: TtsAntiAliasing): TltsFontHandle; stdcall;
function ltsFontCreatorGetFontByName(aHandle: TltsFontCreatorHandle; aFontname: PAnsiChar;
aSize: Integer; aStyle: TtsFontStyles; aAntiAliasing: TtsAntiAliasing): TltsFontHandle; stdcall;
var
fc: TtsFontCreator;
f: TtsFont;
@@ -113,8 +113,8 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontCreatorGetFontByFile(const aHandle: TltsFontCreatorHandle; const aFilename: PAnsiChar;
const aSize: Integer; const aStyle: TtsFontStyles; const aAntiAliasing: TtsAntiAliasing): TltsFontHandle; stdcall;
function ltsFontCreatorGetFontByFile(aHandle: TltsFontCreatorHandle; aFilename: PAnsiChar;
aSize: Integer; aStyle: TtsFontStyles; aAntiAliasing: TtsAntiAliasing): TltsFontHandle; stdcall;
var
fc: TtsFontCreator;
f: TtsFont;
@@ -139,8 +139,8 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontCreatorGetFontByStream(const aHandle: TltsFontCreatorHandle; const aStream: PltsStream;
const aSize: Integer; const aStyle: TtsFontStyles; const aAntiAliasing: TtsAntiAliasing): TltsFontHandle; stdcall;
function ltsFontCreatorGetFontByStream(aHandle: TltsFontCreatorHandle; aStream: PltsStream;
aSize: Integer; aStyle: TtsFontStyles; aAntiAliasing: TtsAntiAliasing): TltsFontHandle; stdcall;
var
fc: TtsFontCreator;
f: TtsFont;
@@ -173,7 +173,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsFontCreatorDestroy(const aHandle: TltsFontCreatorHandle): TltsErrorCode; stdcall;
function ltsFontCreatorDestroy(aHandle: TltsFontCreatorHandle): TltsErrorCode; stdcall;
var
fc: TtsFontCreator;
begin


+ 42
- 42
ultsImage.pas View File

@@ -10,28 +10,28 @@ uses
ultsTypes;

type
TltsImageLoadFunc = procedure(const aHandle: TltsImageHandle; const X, Y: Integer; var aPixel: TtsColor4f; aArgs: Pointer); stdcall;
TltsImageBlendFunc = function (const aHandle: TltsImageHandle; const aSrc, aDst: TtsColor4f; aArgs: Pointer): TtsColor4f; stdcall;
function ltsImageCreate (const aContext: TltsContextHandle): TltsImageHandle; stdcall;
function ltsImageIsEmpty (const aHandle: TltsImageHandle; var aValue: Boolean): TltsErrorCode; stdcall;
function ltsImageGetWidth (const aHandle: TltsImageHandle): Integer; stdcall;
function ltsImageGetHeight (const aHandle: TltsImageHandle): Integer; stdcall;
function ltsImageGetLineSize (const aHandle: TltsImageHandle): Integer; stdcall;
function ltsImageGetDataSize (const aHandle: TltsImageHandle): Integer; stdcall;
function ltsImageGetFormat (const aHandle: TltsImageHandle; var aValue: TtsFormat): TltsErrorCode; stdcall;
function ltsImageGetData (const aHandle: TltsImageHandle): Pointer; stdcall;
function ltsImageGetScanline (const aHandle: TltsImageHandle; const aIndex: Integer): Pointer; stdcall;
function ltsImageGetPixelAt (const aHandle: TltsImageHandle; const aX, aY: Integer; var aColor: TtsColor4f): TltsErrorCode; stdcall;
function ltsImageAssign (const aHandle, aSource: TltsImageHandle): TltsErrorCode; stdcall;
function ltsImageCreateEmpty (const aHandle: TltsImageHandle; const aFormat: TtsFormat; const aWidth, aHeight: Integer): TltsErrorCode; stdcall;
function ltsImageLoadFromFunc (const aHandle: TltsImageHandle; const aCallback: TltsImageLoadFunc; aArgs: Pointer): TltsErrorCode; stdcall;
function ltsImageResize (const aHandle: TltsImageHandle; const aWidth, aHeight, aX, aY: Integer): TltsErrorCode; stdcall;
function ltsImageFillColor (const aHandle: TltsImageHandle; const aColor: TtsColor4f; const aMask: TtsColorChannels; const aModes: TtsImageModes): TltsErrorCode; stdcall;
function ltsImageFillPattern (const aHandle, aPattern: TltsImageHandle; const aX, aY: Integer; const aMask: TtsColorChannels; const aModes: TtsImageModes): TltsErrorCode; stdcall;
function ltsImageBlend (const aHandle, aSource: TltsImageHandle; const aX, aY: Integer; const aBlendFunc: TltsImageBlendFunc; aArgs: Pointer): TltsErrorCode; stdcall;
function ltsImageBlur (const aHandle: TltsImageHandle; const aHorzRad, aHorzStr, aVertRad, aVertStr: Single; const aMask: TtsColorChannels): TltsErrorCode; stdcall;
function ltsImageDestroy (const aHandle: TltsImageHandle): TltsErrorCode; stdcall;
TltsImageLoadFunc = procedure(aHandle: TltsImageHandle; X, Y: Integer; var aPixel: TtsColor4f; aArgs: Pointer); stdcall;
TltsImageBlendFunc = procedure(aHandle: TltsImageHandle; aSrc, aDst: TtsColor4f; out aResult: TtsColor4f; aArgs: Pointer); stdcall;
function ltsImageCreate (aContext: TltsContextHandle): TltsImageHandle; stdcall;
function ltsImageIsEmpty (aHandle: TltsImageHandle; var aValue: Boolean): TltsErrorCode; stdcall;
function ltsImageGetWidth (aHandle: TltsImageHandle): Integer; stdcall;
function ltsImageGetHeight (aHandle: TltsImageHandle): Integer; stdcall;
function ltsImageGetLineSize (aHandle: TltsImageHandle): Integer; stdcall;
function ltsImageGetDataSize (aHandle: TltsImageHandle): Integer; stdcall;
function ltsImageGetFormat (aHandle: TltsImageHandle; var aValue: TtsFormat): TltsErrorCode; stdcall;
function ltsImageGetData (aHandle: TltsImageHandle): Pointer; stdcall;
function ltsImageGetScanline (aHandle: TltsImageHandle; aIndex: Integer): Pointer; stdcall;
function ltsImageGetPixelAt (aHandle: TltsImageHandle; aX, aY: Integer; var aColor: TtsColor4f): TltsErrorCode; stdcall;
function ltsImageAssign (aHandle, aSource: TltsImageHandle): TltsErrorCode; stdcall;
function ltsImageCreateEmpty (aHandle: TltsImageHandle; aFormat: TtsFormat; aWidth, aHeight: Integer): TltsErrorCode; stdcall;
function ltsImageLoadFromFunc (aHandle: TltsImageHandle; aCallback: TltsImageLoadFunc; aArgs: Pointer): TltsErrorCode; stdcall;
function ltsImageResize (aHandle: TltsImageHandle; aWidth, aHeight, aX, aY: Integer): TltsErrorCode; stdcall;
function ltsImageFillColor (aHandle: TltsImageHandle; aColor: TtsColor4f; aMask: TtsColorChannels; aModes: TtsImageModes): TltsErrorCode; stdcall;
function ltsImageFillPattern (aHandle, aPattern: TltsImageHandle; aX, aY: Integer; aMask: TtsColorChannels; aModes: TtsImageModes): TltsErrorCode; stdcall;
function ltsImageBlend (aHandle, aSource: TltsImageHandle; aX, aY: Integer; aBlendFunc: TltsImageBlendFunc; aArgs: Pointer): TltsErrorCode; stdcall;
function ltsImageBlur (aHandle: TltsImageHandle; aHorzRad, aHorzStr, aVertRad, aVertStr: Single; aMask: TtsColorChannels): TltsErrorCode; stdcall;
function ltsImageDestroy (aHandle: TltsImageHandle): TltsErrorCode; stdcall;

implementation

@@ -66,13 +66,13 @@ var
p: PBlendArgs;
begin
p := PBlendArgs(aArgs);
result := p^.callback(p^.handle, aSrc, aDst, p^.args);
p^.callback(p^.handle, aSrc, aDst, result, p^.args);
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ltsImage//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageCreate(const aContext: TltsContextHandle): TltsImageHandle; stdcall;
function ltsImageCreate(aContext: TltsContextHandle): TltsImageHandle; stdcall;
var
img: TtsImage;
c: TtsContext;
@@ -93,7 +93,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageIsEmpty(const aHandle: TltsImageHandle; var aValue: Boolean): TltsErrorCode; stdcall;
function ltsImageIsEmpty(aHandle: TltsImageHandle; var aValue: Boolean): TltsErrorCode; stdcall;
var
img: TtsImage;
begin
@@ -111,7 +111,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageGetWidth(const aHandle: TltsImageHandle): Integer; stdcall;
function ltsImageGetWidth(aHandle: TltsImageHandle): Integer; stdcall;
var
img: TtsImage;
begin
@@ -128,7 +128,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageGetHeight(const aHandle: TltsImageHandle): Integer; stdcall;
function ltsImageGetHeight(aHandle: TltsImageHandle): Integer; stdcall;
var
img: TtsImage;
begin
@@ -145,7 +145,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageGetLineSize(const aHandle: TltsImageHandle): Integer; stdcall;
function ltsImageGetLineSize(aHandle: TltsImageHandle): Integer; stdcall;
var
img: TtsImage;
begin
@@ -162,7 +162,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageGetDataSize(const aHandle: TltsImageHandle): Integer; stdcall;
function ltsImageGetDataSize(aHandle: TltsImageHandle): Integer; stdcall;
var
img: TtsImage;
begin
@@ -179,7 +179,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageGetFormat(const aHandle: TltsImageHandle; var aValue: TtsFormat): TltsErrorCode; stdcall;
function ltsImageGetFormat(aHandle: TltsImageHandle; var aValue: TtsFormat): TltsErrorCode; stdcall;
var
img: TtsImage;
begin
@@ -197,7 +197,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageGetData(const aHandle: TltsImageHandle): Pointer; stdcall;
function ltsImageGetData(aHandle: TltsImageHandle): Pointer; stdcall;
var
img: TtsImage;
begin
@@ -214,7 +214,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageGetScanline(const aHandle: TltsImageHandle; const aIndex: Integer): Pointer; stdcall;
function ltsImageGetScanline(aHandle: TltsImageHandle; aIndex: Integer): Pointer; stdcall;
var
img: TtsImage;
begin
@@ -234,7 +234,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageGetPixelAt(const aHandle: TltsImageHandle; const aX, aY: Integer; var aColor: TtsColor4f): TltsErrorCode; stdcall;
function ltsImageGetPixelAt(aHandle: TltsImageHandle; aX, aY: Integer; var aColor: TtsColor4f): TltsErrorCode; stdcall;
var
img: TtsImage;
begin
@@ -256,7 +256,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageAssign(const aHandle, aSource: TltsImageHandle): TltsErrorCode; stdcall;
function ltsImageAssign(aHandle, aSource: TltsImageHandle): TltsErrorCode; stdcall;
var
img, src: TtsImage;
begin
@@ -274,7 +274,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageCreateEmpty(const aHandle: TltsImageHandle; const aFormat: TtsFormat; const aWidth, aHeight: Integer): TltsErrorCode; stdcall;
function ltsImageCreateEmpty(aHandle: TltsImageHandle; aFormat: TtsFormat; aWidth, aHeight: Integer): TltsErrorCode; stdcall;
var
img: TtsImage;
begin
@@ -301,7 +301,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageLoadFromFunc(const aHandle: TltsImageHandle; const aCallback: TltsImageLoadFunc; aArgs: Pointer): TltsErrorCode; stdcall;
function ltsImageLoadFromFunc(aHandle: TltsImageHandle; aCallback: TltsImageLoadFunc; aArgs: Pointer): TltsErrorCode; stdcall;
var
img: TtsImage;
la: TLoadArgs;
@@ -324,7 +324,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageResize(const aHandle: TltsImageHandle; const aWidth, aHeight, aX, aY: Integer): TltsErrorCode; stdcall;
function ltsImageResize(aHandle: TltsImageHandle; aWidth, aHeight, aX, aY: Integer): TltsErrorCode; stdcall;
var
img: TtsImage;
begin
@@ -349,7 +349,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageFillColor(const aHandle: TltsImageHandle; const aColor: TtsColor4f; const aMask: TtsColorChannels; const aModes: TtsImageModes): TltsErrorCode; stdcall;
function ltsImageFillColor(aHandle: TltsImageHandle; aColor: TtsColor4f; aMask: TtsColorChannels; aModes: TtsImageModes): TltsErrorCode; stdcall;
var
img: TtsImage;
begin
@@ -367,7 +367,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageFillPattern(const aHandle, aPattern: TltsImageHandle; const aX, aY: Integer; const aMask: TtsColorChannels; const aModes: TtsImageModes): TltsErrorCode; stdcall;
function ltsImageFillPattern(aHandle, aPattern: TltsImageHandle; aX, aY: Integer; aMask: TtsColorChannels; aModes: TtsImageModes): TltsErrorCode; stdcall;
var
img, pattern: TtsImage;
begin
@@ -385,7 +385,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageBlend(const aHandle, aSource: TltsImageHandle; const aX, aY: Integer; const aBlendFunc: TltsImageBlendFunc; aArgs: Pointer): TltsErrorCode; stdcall;
function ltsImageBlend(aHandle, aSource: TltsImageHandle; aX, aY: Integer; aBlendFunc: TltsImageBlendFunc; aArgs: Pointer): TltsErrorCode; stdcall;
var
img, src: TtsImage;
ba: TBlendArgs;
@@ -408,7 +408,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageBlur(const aHandle: TltsImageHandle; const aHorzRad, aHorzStr, aVertRad, aVertStr: Single; const aMask: TtsColorChannels): TltsErrorCode; stdcall;
function ltsImageBlur(aHandle: TltsImageHandle; aHorzRad, aHorzStr, aVertRad, aVertStr: Single; aMask: TtsColorChannels): TltsErrorCode; stdcall;
var
img: TtsImage;
horz, vert: TtsKernel1D;
@@ -435,7 +435,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsImageDestroy(const aHandle: TltsImageHandle): TltsErrorCode; stdcall;
function ltsImageDestroy(aHandle: TltsImageHandle): TltsErrorCode; stdcall;
var
img: TtsImage;
begin


+ 26
- 28
ultsPostProcessor.pas View File

@@ -25,21 +25,21 @@ type
constructor Create(const aContext: TtsContext; const aData: TltsPostProcessorCustomData);
end;

function ltsPostProcessorAddRange (const aHandle: TltsPostProcessorHandle; const aUsage: TtsCharRangeUsage; const aStart, aStop: WideChar): TltsErrorCode; stdcall;
function ltsPostProcessorAddChars (const aHandle: TltsPostProcessorHandle; const aUsage: TtsCharRangeUsage; const aChars: PWideChar): TltsErrorCode; stdcall;
function ltsPostProcessorClearRanges (const aHandle: TltsPostProcessorHandle): TltsErrorCode; stdcall;
function ltsPostProcessorExecute (const aHandle: TltsPostProcessorHandle; const aChar: TltsCharHandle; const aImage: TltsImageHandle): TltsErrorCode; stdcall;
function ltsPostProcessorAddRange (aHandle: TltsPostProcessorHandle; aUsage: TtsCharRangeUsage; aStart, aStop: WideChar): TltsErrorCode; stdcall;
function ltsPostProcessorAddChars (aHandle: TltsPostProcessorHandle; aUsage: TtsCharRangeUsage; aChars: PWideChar): TltsErrorCode; stdcall;
function ltsPostProcessorClearRanges (aHandle: TltsPostProcessorHandle): TltsErrorCode; stdcall;
function ltsPostProcessorExecute (aHandle: TltsPostProcessorHandle; aChar: TltsCharHandle; aImage: TltsImageHandle): TltsErrorCode; stdcall;

function ltsPostProcessorFillColorCreate (const aContext: TltsContextHandle; const aColor: TtsColor4f;
const aModes: TtsImageModes; const aChannels: TtsColorChannels): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorFillPatterCreate (const aContext: TltsContextHandle; const aPattern: TltsImageHandle; const aOwnsPatter: Boolean;
const aPosition: TtsPosition; const aModes: TtsImageModes; const aChannels: TtsColorChannels): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorBorderCreate (const aContext: TltsContextHandle; const aWidth, aStrength: Single;
const aColor: TtsColor4f; const aKeepSize: Boolean): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorShadowCreate (const aContext: TltsContextHandle; const aRadius, aStrength: Single;
const aOffset: TtsPosition; const aColor: TtsColor4f): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorCustomCreate (const aContext: TltsContextHandle; const aData: PltsPostProcessorCustomData): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorDestroy (const aHandle: TltsPostProcessorHandle): TltsErrorCode; stdcall;
function ltsPostProcessorFillColorCreate (aContext: TltsContextHandle; aColor: TtsColor4f;
aModes: TtsImageModes; aChannels: TtsColorChannels): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorFillPatterCreate (aContext: TltsContextHandle; aPattern: TltsImageHandle; aOwnsPatter: Boolean;
aPosition: TtsPosition; aModes: TtsImageModes; aChannels: TtsColorChannels): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorBorderCreate (aContext: TltsContextHandle; aWidth, aStrength: Single;
aColor: TtsColor4f; aKeepSize: Boolean): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorShadowCreate (aContext: TltsContextHandle; aRadius, aStrength: Single;
aOffset: TtsPosition; aColor: TtsColor4f): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorCustomCreate (aContext: TltsContextHandle; constref aData: TltsPostProcessorCustomData): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorDestroy (aHandle: TltsPostProcessorHandle): TltsErrorCode; stdcall;

implementation

@@ -49,7 +49,7 @@ uses
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ltsPostProcessor//////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsPostProcessorAddRange(const aHandle: TltsPostProcessorHandle; const aUsage: TtsCharRangeUsage; const aStart, aStop: WideChar): TltsErrorCode; stdcall;
function ltsPostProcessorAddRange(aHandle: TltsPostProcessorHandle; aUsage: TtsCharRangeUsage; aStart, aStop: WideChar): TltsErrorCode; stdcall;
var
pp: TtsPostProcessor;
begin
@@ -67,7 +67,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsPostProcessorAddChars(const aHandle: TltsPostProcessorHandle; const aUsage: TtsCharRangeUsage; const aChars: PWideChar): TltsErrorCode; stdcall;
function ltsPostProcessorAddChars(aHandle: TltsPostProcessorHandle; aUsage: TtsCharRangeUsage; aChars: PWideChar): TltsErrorCode; stdcall;
var
pp: TtsPostProcessor;
begin
@@ -85,7 +85,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsPostProcessorClearRanges(const aHandle: TltsPostProcessorHandle): TltsErrorCode; stdcall;
function ltsPostProcessorClearRanges(aHandle: TltsPostProcessorHandle): TltsErrorCode; stdcall;
var
pp: TtsPostProcessor;
begin
@@ -103,7 +103,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsPostProcessorExecute(const aHandle: TltsPostProcessorHandle; const aChar: TltsCharHandle; const aImage: TltsImageHandle): TltsErrorCode; stdcall;
function ltsPostProcessorExecute(aHandle: TltsPostProcessorHandle; aChar: TltsCharHandle; aImage: TltsImageHandle): TltsErrorCode; stdcall;
var
pp: TtsPostProcessor;
c: TtsChar;
@@ -125,7 +125,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsPostProcessorFillColorCreate(const aContext: TltsContextHandle; const aColor: TtsColor4f; const aModes: TtsImageModes; const aChannels: TtsColorChannels): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorFillColorCreate(aContext: TltsContextHandle; aColor: TtsColor4f; aModes: TtsImageModes; aChannels: TtsColorChannels): TltsPostProcessorHandle; stdcall;
var
c: TtsContext;
pp: TtsPostProcessor;
@@ -146,7 +146,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsPostProcessorFillPatterCreate(const aContext: TltsContextHandle; const aPattern: TltsImageHandle; const aOwnsPatter: Boolean; const aPosition: TtsPosition; const aModes: TtsImageModes; const aChannels: TtsColorChannels): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorFillPatterCreate(aContext: TltsContextHandle; aPattern: TltsImageHandle; aOwnsPatter: Boolean; aPosition: TtsPosition; aModes: TtsImageModes; aChannels: TtsColorChannels): TltsPostProcessorHandle; stdcall;
var
c: TtsContext;
img: TtsImage;
@@ -169,7 +169,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsPostProcessorBorderCreate(const aContext: TltsContextHandle; const aWidth, aStrength: Single; const aColor: TtsColor4f; const aKeepSize: Boolean): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorBorderCreate(aContext: TltsContextHandle; aWidth, aStrength: Single; aColor: TtsColor4f; aKeepSize: Boolean): TltsPostProcessorHandle; stdcall;
var
c: TtsContext;
pp: TtsPostProcessor;
@@ -190,7 +190,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsPostProcessorShadowCreate(const aContext: TltsContextHandle; const aRadius, aStrength: Single; const aOffset: TtsPosition; const aColor: TtsColor4f): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorShadowCreate(aContext: TltsContextHandle; aRadius, aStrength: Single; aOffset: TtsPosition; aColor: TtsColor4f): TltsPostProcessorHandle; stdcall;
var
c: TtsContext;
pp: TtsPostProcessor;
@@ -211,17 +211,15 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsPostProcessorCustomCreate(const aContext: TltsContextHandle; const aData: PltsPostProcessorCustomData): TltsPostProcessorHandle; stdcall;
function ltsPostProcessorCustomCreate(aContext: TltsContextHandle; constref aData: TltsPostProcessorCustomData): TltsPostProcessorHandle; stdcall;
var
c: TtsContext;
pp: TtsPostProcessor;
begin
try
result := nil;
if not Assigned(aData) then begin
SetLastError(ltsErrInvalidValue, 'parameter ''aData'' is not assigned');
end else if CheckContextHandle(aContext, c) then begin
pp := TltsPostProcessorCustom.Create(c, aData^);
if CheckContextHandle(aContext, c) then begin
pp := TltsPostProcessorCustom.Create(c, aData);
AddReference(ltsObjTypePostProcessor, pp);
result := pp;
end;
@@ -234,7 +232,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsPostProcessorDestroy(const aHandle: TltsPostProcessorHandle): TltsErrorCode; stdcall;
function ltsPostProcessorDestroy(aHandle: TltsPostProcessorHandle): TltsErrorCode; stdcall;
var
pp: TtsPostProcessor;
begin


+ 17
- 22
ultsRenderer.pas View File

@@ -37,14 +37,14 @@ type
FreeRef: TltsRendererCustomFreeRef;
end;

function ltsRendererCreate (const aHandle: TltsContextHandle; const aType: TltsRendererType; const aFormat: TtsFormat): TltsRendererHandle; stdcall;
function ltsRendererCustomCreate (const aHandle: TltsContextHandle; const aFormat: TtsFormat; const aData: PltsRendererCustomData): TltsRendererHandle; stdcall;
function ltsRendererBeginBlock (const aHandle: TltsRendererHandle; const aTop, aLeft, aWidth, aHeight: Integer; const aFlags: TtsBlockFlags): TltsTextBlockHandle; stdcall;
function ltsRendererEndBlock (const aHandle: TltsRendererHandle; const aBlock: TltsTextBlockHandle): TltsErrorCode; stdcall;
function ltsRendererAbortBlock (const aHandle: TltsRendererHandle; const aBlock: TltsTextBlockHandle): TltsErrorCode; stdcall;
function ltsRendererGetTextWidthA(const aHandle: TltsRendererHandle; const aFont: TltsFontHandle; const aText: PAnsiChar): Integer; stdcall;
function ltsRendererGetTextWidthW(const aHandle: TltsRendererHandle; const aFont: TltsFontHandle; const aText: PWideChar): Integer; stdcall;
function ltsRendererDestroy (const aHandle: TltsRendererHandle): TltsErrorCode; stdcall;
function ltsRendererCreate (aHandle: TltsContextHandle; aType: TltsRendererType; aFormat: TtsFormat): TltsRendererHandle; stdcall;
function ltsRendererCustomCreate (aHandle: TltsContextHandle; aFormat: TtsFormat; constref aData: TltsRendererCustomData): TltsRendererHandle; stdcall;
function ltsRendererBeginBlock (aHandle: TltsRendererHandle; aTop, aLeft, aWidth, aHeight: Integer; aFlags: TtsBlockFlags): TltsTextBlockHandle; stdcall;
function ltsRendererEndBlock (aHandle: TltsRendererHandle; aBlock: TltsTextBlockHandle): TltsErrorCode; stdcall;
function ltsRendererAbortBlock (aHandle: TltsRendererHandle; aBlock: TltsTextBlockHandle): TltsErrorCode; stdcall;
function ltsRendererGetTextWidthA(aHandle: TltsRendererHandle; aFont: TltsFontHandle; aText: PAnsiChar): Integer; stdcall;
function ltsRendererGetTextWidthW(aHandle: TltsRendererHandle; aFont: TltsFontHandle; aText: PWideChar): Integer; stdcall;
function ltsRendererDestroy (aHandle: TltsRendererHandle): TltsErrorCode; stdcall;

implementation

@@ -212,7 +212,7 @@ end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Renderer//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsRendererCreate(const aHandle: TltsContextHandle; const aType: TltsRendererType; const aFormat: TtsFormat): TltsRendererHandle; stdcall;
function ltsRendererCreate(aHandle: TltsContextHandle; aType: TltsRendererType; aFormat: TtsFormat): TltsRendererHandle; stdcall;
var
c: TtsContext;
r: TtsRenderer;
@@ -245,7 +245,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsRendererCustomCreate(const aHandle: TltsContextHandle; const aFormat: TtsFormat; const aData: PltsRendererCustomData): TltsRendererHandle; stdcall;
function ltsRendererCustomCreate(aHandle: TltsContextHandle; aFormat: TtsFormat; constref aData: TltsRendererCustomData): TltsRendererHandle; stdcall;
var
c: TtsContext;
r: TtsRenderer;
@@ -255,17 +255,12 @@ begin
if not CheckContextHandle(aHandle, c) then
exit;

if not Assigned(aData) then begin
SetLastError(ltsErrInvalidValue, Format('prameter ''aData'' is not assigned', [aFormat]));
exit;
end;

if not ValidateFormat(aFormat) then begin
SetLastError(ltsErrInvalidEnum, Format('%d is not a valid format', [aFormat]));
exit;
end;

r := TltsRendererCustom.Create(c, aFormat, aData^);
r := TltsRendererCustom.Create(c, aFormat, aData);
AddReference(ltsObjTypeRenderer, r);
result := r;
except
@@ -277,7 +272,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsRendererBeginBlock(const aHandle: TltsRendererHandle; const aTop, aLeft, aWidth, aHeight: Integer; const aFlags: TtsBlockFlags): TltsTextBlockHandle; stdcall;
function ltsRendererBeginBlock(aHandle: TltsRendererHandle; aTop, aLeft, aWidth, aHeight: Integer; aFlags: TtsBlockFlags): TltsTextBlockHandle; stdcall;
var
r: TtsRenderer;
b: TtsTextBlock;
@@ -298,7 +293,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsRendererEndBlock(const aHandle: TltsRendererHandle; const aBlock: TltsTextBlockHandle): TltsErrorCode; stdcall;
function ltsRendererEndBlock(aHandle: TltsRendererHandle; aBlock: TltsTextBlockHandle): TltsErrorCode; stdcall;
var
r: TtsRenderer;
b: TtsTextBlock;
@@ -319,7 +314,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsRendererAbortBlock(const aHandle: TltsRendererHandle; const aBlock: TltsTextBlockHandle): TltsErrorCode; stdcall;
function ltsRendererAbortBlock(aHandle: TltsRendererHandle; aBlock: TltsTextBlockHandle): TltsErrorCode; stdcall;
var
r: TtsRenderer;
b: TtsTextBlock;
@@ -340,7 +335,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsRendererGetTextWidthA(const aHandle: TltsRendererHandle; const aFont: TltsFontHandle; const aText: PAnsiChar): Integer; stdcall;
function ltsRendererGetTextWidthA(aHandle: TltsRendererHandle; aFont: TltsFontHandle; aText: PAnsiChar): Integer; stdcall;
var
r: TtsRenderer;
f: TtsFont;
@@ -358,7 +353,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsRendererGetTextWidthW(const aHandle: TltsRendererHandle; const aFont: TltsFontHandle; const aText: PWideChar): Integer; stdcall;
function ltsRendererGetTextWidthW(aHandle: TltsRendererHandle; aFont: TltsFontHandle; aText: PWideChar): Integer; stdcall;
var
r: TtsRenderer;
f: TtsFont;
@@ -376,7 +371,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsRendererDestroy(const aHandle: TltsRendererHandle): TltsErrorCode; stdcall;
function ltsRendererDestroy(aHandle: TltsRendererHandle): TltsErrorCode; stdcall;
var
r: TtsRenderer;
begin


+ 53
- 53
ultsTextBlock.pas View File

@@ -9,35 +9,35 @@ uses
utsTextSuite,
ultsTypes;

function ltsTextBlockGetRect (const aHandle: TltsTextBlockHandle; var aValue: TtsRect): TltsErrorCode; stdcall;
function ltsTextBlockGetWidth (const aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockGetHeight (const aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockGetFlags (const aHandle: TltsTextBlockHandle; var aValue: TtsBlockFlags): TltsErrorCode; stdcall;
function ltsTextBlockGetTop (const aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockGetLeft (const aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockGetVertAlign (const aHandle: TltsTextBlockHandle; var aValue: TtsVertAlignment): TltsErrorCode; stdcall;
function ltsTextBlockGetHorzAlign (const aHandle: TltsTextBlockHandle; var aValue: TtsHorzAlignment): TltsErrorCode; stdcall;
function ltsTextBlockGetClipping (const aHandle: TltsTextBlockHandle; var aValue: TtsClipping): TltsErrorCode; stdcall;
function ltsTextBlockGetColor (const aHandle: TltsTextBlockHandle; var aValue: TtsColor4f): TltsErrorCode; stdcall;
function ltsTextBlockGetFont (const aHandle: TltsTextBlockHandle; var aValue: TltsFontHandle): TltsErrorCode; stdcall;
function ltsTextBlockSetTop (const aHandle: TltsTextBlockHandle; const aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockSetLeft (const aHandle: TltsTextBlockHandle; const aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockSetVertAlign (const aHandle: TltsTextBlockHandle; const aValue: TtsVertAlignment): TltsErrorCode; stdcall;
function ltsTextBlockSetHorzAlign (const aHandle: TltsTextBlockHandle; const aValue: TtsHorzAlignment): TltsErrorCode; stdcall;
function ltsTextBlockSetClipping (const aHandle: TltsTextBlockHandle; const aValue: TtsClipping): TltsErrorCode; stdcall;
function ltsTextBlockSetColor (const aHandle: TltsTextBlockHandle; const aValue: TtsColor4f): TltsErrorCode; stdcall;
function ltsTextBlockSetFont (const aHandle: TltsTextBlockHandle; const aValue: TltsFontHandle): TltsErrorCode; stdcall;
function ltsTextBlockGetActualHeight(const aHandle: TltsTextBlockHandle): Integer; stdcall;
function ltsTextBlockGetTextWidthA (const aHandle: TltsTextBlockHandle; const aText: PAnsiChar): Integer; stdcall;
function ltsTextBlockGetTextWidthW (const aHandle: TltsTextBlockHandle; const aText: PWideChar): Integer; stdcall;
function ltsTextBlockTextOutA (const aHandle: TltsTextBlockHandle; const aText: PAnsiChar): TltsErrorCode; stdcall;
function ltsTextBlockTextOutW (const aHandle: TltsTextBlockHandle; const aText: PWideChar): TltsErrorCode; stdcall;
function ltsTextBlockDestroy (const aHandle: TltsTextBlockHandle): TltsErrorCode; stdcall;
function ltsTextBlockGetRect (aHandle: TltsTextBlockHandle; var aValue: TtsRect): TltsErrorCode; stdcall;
function ltsTextBlockGetWidth (aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockGetHeight (aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockGetFlags (aHandle: TltsTextBlockHandle; var aValue: TtsBlockFlags): TltsErrorCode; stdcall;
function ltsTextBlockGetTop (aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockGetLeft (aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockGetVertAlign (aHandle: TltsTextBlockHandle; var aValue: TtsVertAlignment): TltsErrorCode; stdcall;
function ltsTextBlockGetHorzAlign (aHandle: TltsTextBlockHandle; var aValue: TtsHorzAlignment): TltsErrorCode; stdcall;
function ltsTextBlockGetClipping (aHandle: TltsTextBlockHandle; var aValue: TtsClipping): TltsErrorCode; stdcall;
function ltsTextBlockGetColor (aHandle: TltsTextBlockHandle; var aValue: TtsColor4f): TltsErrorCode; stdcall;
function ltsTextBlockGetFont (aHandle: TltsTextBlockHandle; var aValue: TltsFontHandle): TltsErrorCode; stdcall;
function ltsTextBlockSetTop (aHandle: TltsTextBlockHandle; aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockSetLeft (aHandle: TltsTextBlockHandle; aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockSetVertAlign (aHandle: TltsTextBlockHandle; aValue: TtsVertAlignment): TltsErrorCode; stdcall;
function ltsTextBlockSetHorzAlign (aHandle: TltsTextBlockHandle; aValue: TtsHorzAlignment): TltsErrorCode; stdcall;
function ltsTextBlockSetClipping (aHandle: TltsTextBlockHandle; aValue: TtsClipping): TltsErrorCode; stdcall;
function ltsTextBlockSetColor (aHandle: TltsTextBlockHandle; aValue: TtsColor4f): TltsErrorCode; stdcall;
function ltsTextBlockSetFont (aHandle: TltsTextBlockHandle; aValue: TltsFontHandle): TltsErrorCode; stdcall;
function ltsTextBlockGetActualHeight(aHandle: TltsTextBlockHandle): Integer; stdcall;
function ltsTextBlockGetTextWidthA (aHandle: TltsTextBlockHandle; aText: PAnsiChar): Integer; stdcall;
function ltsTextBlockGetTextWidthW (aHandle: TltsTextBlockHandle; aText: PWideChar): Integer; stdcall;
function ltsTextBlockTextOutA (aHandle: TltsTextBlockHandle; aText: PAnsiChar): TltsErrorCode; stdcall;
function ltsTextBlockTextOutW (aHandle: TltsTextBlockHandle; aText: PWideChar): TltsErrorCode; stdcall;
function ltsTextBlockDestroy (aHandle: TltsTextBlockHandle): TltsErrorCode; stdcall;

implementation

@@ -47,7 +47,7 @@ uses
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TextBlock/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockGetRect(const aHandle: TltsTextBlockHandle; var aValue: TtsRect): TltsErrorCode; stdcall;
function ltsTextBlockGetRect(aHandle: TltsTextBlockHandle; var aValue: TtsRect): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -65,7 +65,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockGetWidth(const aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockGetWidth(aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -83,7 +83,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockGetHeight(const aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockGetHeight(aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -101,7 +101,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockGetFlags(const aHandle: TltsTextBlockHandle; var aValue: TtsBlockFlags): TltsErrorCode; stdcall;
function ltsTextBlockGetFlags(aHandle: TltsTextBlockHandle; var aValue: TtsBlockFlags): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -119,7 +119,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockGetTop(const aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockGetTop(aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -137,7 +137,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockGetLeft(const aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockGetLeft(aHandle: TltsTextBlockHandle; var aValue: Integer): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -155,7 +155,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockGetVertAlign(const aHandle: TltsTextBlockHandle; var aValue: TtsVertAlignment): TltsErrorCode; stdcall;
function ltsTextBlockGetVertAlign(aHandle: TltsTextBlockHandle; var aValue: TtsVertAlignment): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -173,7 +173,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockGetHorzAlign(const aHandle: TltsTextBlockHandle; var aValue: TtsHorzAlignment): TltsErrorCode; stdcall;
function ltsTextBlockGetHorzAlign(aHandle: TltsTextBlockHandle; var aValue: TtsHorzAlignment): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -191,7 +191,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockGetClipping(const aHandle: TltsTextBlockHandle; var aValue: TtsClipping): TltsErrorCode; stdcall;
function ltsTextBlockGetClipping(aHandle: TltsTextBlockHandle; var aValue: TtsClipping): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -209,7 +209,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockGetColor(const aHandle: TltsTextBlockHandle; var aValue: TtsColor4f): TltsErrorCode; stdcall;
function ltsTextBlockGetColor(aHandle: TltsTextBlockHandle; var aValue: TtsColor4f): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -227,7 +227,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockGetFont(const aHandle: TltsTextBlockHandle; var aValue: TltsFontHandle): TltsErrorCode; stdcall;
function ltsTextBlockGetFont(aHandle: TltsTextBlockHandle; var aValue: TltsFontHandle): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -245,7 +245,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockSetTop(const aHandle: TltsTextBlockHandle; const aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockSetTop(aHandle: TltsTextBlockHandle; aValue: Integer): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -263,7 +263,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockSetLeft(const aHandle: TltsTextBlockHandle; const aValue: Integer): TltsErrorCode; stdcall;
function ltsTextBlockSetLeft(aHandle: TltsTextBlockHandle; aValue: Integer): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -281,7 +281,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockSetVertAlign(const aHandle: TltsTextBlockHandle; const aValue: TtsVertAlignment): TltsErrorCode; stdcall;
function ltsTextBlockSetVertAlign(aHandle: TltsTextBlockHandle; aValue: TtsVertAlignment): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -299,7 +299,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockSetHorzAlign(const aHandle: TltsTextBlockHandle; const aValue: TtsHorzAlignment): TltsErrorCode; stdcall;
function ltsTextBlockSetHorzAlign(aHandle: TltsTextBlockHandle; aValue: TtsHorzAlignment): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -317,7 +317,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockSetClipping(const aHandle: TltsTextBlockHandle; const aValue: TtsClipping): TltsErrorCode; stdcall;
function ltsTextBlockSetClipping(aHandle: TltsTextBlockHandle; aValue: TtsClipping): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -335,7 +335,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockSetColor(const aHandle: TltsTextBlockHandle; const aValue: TtsColor4f): TltsErrorCode; stdcall;
function ltsTextBlockSetColor(aHandle: TltsTextBlockHandle; aValue: TtsColor4f): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -353,7 +353,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockSetFont(const aHandle: TltsTextBlockHandle; const aValue: TltsFontHandle): TltsErrorCode; stdcall;
function ltsTextBlockSetFont(aHandle: TltsTextBlockHandle; aValue: TltsFontHandle): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
f: TtsFont;
@@ -372,7 +372,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockGetActualHeight(const aHandle: TltsTextBlockHandle): Integer; stdcall;
function ltsTextBlockGetActualHeight(aHandle: TltsTextBlockHandle): Integer; stdcall;
var
b: TtsTextBlock;
begin
@@ -389,7 +389,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockGetTextWidthA(const aHandle: TltsTextBlockHandle; const aText: PAnsiChar): Integer; stdcall;
function ltsTextBlockGetTextWidthA(aHandle: TltsTextBlockHandle; aText: PAnsiChar): Integer; stdcall;
var
b: TtsTextBlock;
begin
@@ -406,7 +406,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockGetTextWidthW(const aHandle: TltsTextBlockHandle; const aText: PWideChar): Integer; stdcall;
function ltsTextBlockGetTextWidthW(aHandle: TltsTextBlockHandle; aText: PWideChar): Integer; stdcall;
var
b: TtsTextBlock;
begin
@@ -423,7 +423,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockTextOutA(const aHandle: TltsTextBlockHandle; const aText: PAnsiChar): TltsErrorCode; stdcall;
function ltsTextBlockTextOutA(aHandle: TltsTextBlockHandle; aText: PAnsiChar): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -441,7 +441,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockTextOutW(const aHandle: TltsTextBlockHandle; const aText: PWideChar): TltsErrorCode; stdcall;
function ltsTextBlockTextOutW(aHandle: TltsTextBlockHandle; aText: PWideChar): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin
@@ -459,7 +459,7 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ltsTextBlockDestroy(const aHandle: TltsTextBlockHandle): TltsErrorCode; stdcall;
function ltsTextBlockDestroy(aHandle: TltsTextBlockHandle): TltsErrorCode; stdcall;
var
b: TtsTextBlock;
begin


Loading…
Cancel
Save