Ultralight C API 1.3.0
Loading...
Searching...
No Matches
CAPI_Defines.h
Go to the documentation of this file.
1/******************************************************************************
2 * This file is a part of Ultralight, an ultra-portable web-browser engine. *
3 * *
4 * See <https://ultralig.ht> for licensing and more. *
5 * *
6 * (C) 2023 Ultralight, Inc. *
7 *****************************************************************************/
8#ifndef ULTRALIGHT_CAPI_DEFINES_H
9#define ULTRALIGHT_CAPI_DEFINES_H
10
11#include <stddef.h>
13#ifdef __OBJC__
14#import <AppKit/NSEvent.h>
15#endif
16
17#if defined(ULTRALIGHT_STATIC_BUILD)
18#define ULExport
19#else
20#if defined(__WIN32__) || defined(_WIN32)
21#if defined(ULTRALIGHT_IMPLEMENTATION)
22#define ULExport __declspec(dllexport)
23#else
24#define ULExport __declspec(dllimport)
25#endif
26#else
27#define ULExport __attribute__((visibility("default")))
28#endif
29#endif
30
31#if defined(__WIN32__) || defined(_WIN32)
32#define _thread_local __declspec(thread)
33#ifndef _NATIVE_WCHAR_T_DEFINED
34#define DISABLE_NATIVE_WCHAR_T
35typedef unsigned short ULChar16;
36#else
37typedef wchar_t ULChar16;
38#endif
39#else
40#define _thread_local __thread
41typedef unsigned short ULChar16;
42#endif
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48typedef struct C_Config* ULConfig;
49typedef struct C_Renderer* ULRenderer;
50typedef struct C_Session* ULSession;
51typedef struct C_ViewConfig* ULViewConfig;
52typedef struct C_View* ULView;
53typedef struct C_Bitmap* ULBitmap;
54typedef struct C_String* ULString;
55typedef struct C_Buffer* ULBuffer;
56typedef struct C_KeyEvent* ULKeyEvent;
57typedef struct C_MouseEvent* ULMouseEvent;
58typedef struct C_ScrollEvent* ULScrollEvent;
59typedef struct C_GamepadEvent* ULGamepadEvent;
60typedef struct C_GamepadAxisEvent* ULGamepadAxisEvent;
61typedef struct C_GamepadButtonEvent* ULGamepadButtonEvent;
62typedef struct C_Surface* ULSurface;
63typedef struct C_Surface* ULBitmapSurface;
64typedef struct C_FontFile* ULFontFile;
65
66typedef enum {
79
80typedef enum {
87
88typedef enum {
134
135typedef enum {
136 ///
137 /// Alpha channel only, 8-bits per pixel.
138 ///
139 /// Encoding: 8-bits per channel, unsigned normalized.
140 ///
141 /// Color-space: Linear (no gamma), alpha-coverage only.
142 ///
144
145 ///
146 /// Blue Green Red Alpha channels, 32-bits per pixel.
147 ///
148 /// Encoding: 8-bits per channel, unsigned normalized.
149 ///
150 /// Color-space: sRGB gamma with premultiplied linear alpha channel.
151 ///
154
155typedef enum {
156 ///
157 /// Key-Down event type. (Does not trigger accelerator commands in WebCore)
158 ///
159 /// @NOTE: You should probably use RawKeyDown instead when a physical key
160 /// is pressed. This member is only here for historic compatibility
161 /// with WebCore's key event types.
162 ///
164
165 ///
166 /// Key-Up event type. Use this when a physical key is released.
167 ///
169
170 ///
171 /// Raw Key-Down type. Use this when a physical key is pressed.
172 ///
173 /// @NOTE: You should use RawKeyDown for physical key presses since it
174 /// allows WebCore to do additional command translation.
175 ///
177
178 ///
179 /// Character input event type. Use this when the OS generates text from
180 /// a physical key being pressed (eg, WM_CHAR on Windows).
181 ///
184
185typedef enum {
190
191typedef enum {
197
198typedef enum {
202
203typedef enum {
207
208typedef enum {
212
213typedef enum {
214 ///
215 /// Lighter hinting algorithm-- glyphs are slightly fuzzier but better
216 /// resemble their original shape. This is achieved by snapping glyphs to the
217 /// pixel grid only vertically which better preserves inter-glyph spacing.
218 ///
220
221 ///
222 /// Default hinting algorithm-- offers a good balance between sharpness and
223 /// shape at smaller font sizes.
224 ///
226
227 ///
228 /// Strongest hinting algorithm-- outputs only black/white glyphs. The result
229 /// is usually unpleasant if the underlying TTF does not contain hints for
230 /// this type of rendering.
231 ///
234
235typedef struct {
236 float left;
237 float top;
238 float right;
239 float bottom;
240} ULRect;
241
242typedef struct {
243 int left;
244 int top;
245 int right;
247} ULIntRect;
248
249typedef struct {
251 unsigned int width;
252 unsigned int height;
253 unsigned int texture_id;
254 unsigned int texture_width;
255 unsigned int texture_height;
258 unsigned int render_buffer_id;
260
261/******************************************************************************
262 * Version
263 *****************************************************************************/
264
265///
266/// Get the version string of the library in MAJOR.MINOR.PATCH format.
267///
269
270///
271/// Get the numeric major version of the library.
272///
274
275///
276/// Get the numeric minor version of the library.
277///
279
280///
281/// Get the numeric patch version of the library.
282///
284
285///
286/// Get the full WebKit version string.
287///
289
290#ifdef __cplusplus
291} // extern "C"
292#endif
293
294#endif // ULTRALIGHT_CAPI_DEFINES_H
ULExport unsigned int ulVersionMinor()
Get the numeric minor version of the library.
ULExport unsigned int ulVersionMajor()
Get the numeric major version of the library.
ULExport const char * ulWebKitVersionString()
Get the full WebKit version string.
ULMessageSource
Definition CAPI_Defines.h:66
@ kMessageSource_CSS
Definition CAPI_Defines.h:74
@ kMessageSource_JS
Definition CAPI_Defines.h:68
@ kMessageSource_Network
Definition CAPI_Defines.h:69
@ kMessageSource_AppCache
Definition CAPI_Defines.h:72
@ kMessageSource_ContentBlocker
Definition CAPI_Defines.h:76
@ kMessageSource_XML
Definition CAPI_Defines.h:67
@ kMessageSource_Rendering
Definition CAPI_Defines.h:73
@ kMessageSource_Security
Definition CAPI_Defines.h:75
@ kMessageSource_Storage
Definition CAPI_Defines.h:71
@ kMessageSource_ConsoleAPI
Definition CAPI_Defines.h:70
@ kMessageSource_Other
Definition CAPI_Defines.h:77
ULFaceWinding
Definition CAPI_Defines.h:208
@ kFaceWinding_Clockwise
Definition CAPI_Defines.h:209
@ kFaceWinding_CounterClockwise
Definition CAPI_Defines.h:210
struct C_GamepadButtonEvent * ULGamepadButtonEvent
Definition CAPI_Defines.h:61
struct C_View * ULView
Definition CAPI_Defines.h:52
unsigned short ULChar16
Definition CAPI_Defines.h:41
ULGamepadEventType
Definition CAPI_Defines.h:203
@ kGamepadEventType_Disconnected
Definition CAPI_Defines.h:205
@ kGamepadEventType_Connected
Definition CAPI_Defines.h:204
struct C_FontFile * ULFontFile
Definition CAPI_Defines.h:64
struct C_String * ULString
Definition CAPI_Defines.h:54
ULScrollEventType
Definition CAPI_Defines.h:198
@ kScrollEventType_ScrollByPixel
Definition CAPI_Defines.h:199
@ kScrollEventType_ScrollByPage
Definition CAPI_Defines.h:200
struct C_Session * ULSession
Definition CAPI_Defines.h:50
struct C_Surface * ULBitmapSurface
Definition CAPI_Defines.h:63
struct C_Config * ULConfig
Definition CAPI_Defines.h:48
#define ULExport
Definition CAPI_Defines.h:27
ULMouseEventType
Definition CAPI_Defines.h:185
@ kMouseEventType_MouseDown
Definition CAPI_Defines.h:187
@ kMouseEventType_MouseMoved
Definition CAPI_Defines.h:186
@ kMouseEventType_MouseUp
Definition CAPI_Defines.h:188
struct C_Surface * ULSurface
Definition CAPI_Defines.h:62
ULMessageLevel
Definition CAPI_Defines.h:80
@ kMessageLevel_Debug
Definition CAPI_Defines.h:84
@ kMessageLevel_Warning
Definition CAPI_Defines.h:82
@ kMessageLevel_Info
Definition CAPI_Defines.h:85
@ kMessageLevel_Error
Definition CAPI_Defines.h:83
@ kMessageLevel_Log
Definition CAPI_Defines.h:81
ULMouseButton
Definition CAPI_Defines.h:191
@ kMouseButton_Right
Definition CAPI_Defines.h:195
@ kMouseButton_None
Definition CAPI_Defines.h:192
@ kMouseButton_Left
Definition CAPI_Defines.h:193
@ kMouseButton_Middle
Definition CAPI_Defines.h:194
ULCursor
Definition CAPI_Defines.h:88
@ kCursor_NorthEastSouthWestResize
Definition CAPI_Defines.h:105
@ kCursor_NorthWestSouthEastResize
Definition CAPI_Defines.h:106
@ kCursor_Cell
Definition CAPI_Defines.h:120
@ kCursor_SouthWestPanning
Definition CAPI_Defines.h:116
@ kCursor_Cross
Definition CAPI_Defines.h:90
@ kCursor_Progress
Definition CAPI_Defines.h:123
@ kCursor_Copy
Definition CAPI_Defines.h:125
@ kCursor_SouthEastPanning
Definition CAPI_Defines.h:115
@ kCursor_ZoomIn
Definition CAPI_Defines.h:128
@ kCursor_SouthWestResize
Definition CAPI_Defines.h:101
@ kCursor_NorthWestResize
Definition CAPI_Defines.h:98
@ kCursor_MiddlePanning
Definition CAPI_Defines.h:109
@ kCursor_ContextMenu
Definition CAPI_Defines.h:121
@ kCursor_Hand
Definition CAPI_Defines.h:91
@ kCursor_ZoomOut
Definition CAPI_Defines.h:129
@ kCursor_Wait
Definition CAPI_Defines.h:93
@ kCursor_Grabbing
Definition CAPI_Defines.h:131
@ kCursor_NoDrop
Definition CAPI_Defines.h:124
@ kCursor_SouthPanning
Definition CAPI_Defines.h:114
@ kCursor_Grab
Definition CAPI_Defines.h:130
@ kCursor_VerticalText
Definition CAPI_Defines.h:119
@ kCursor_Move
Definition CAPI_Defines.h:118
@ kCursor_WestPanning
Definition CAPI_Defines.h:117
@ kCursor_SouthEastResize
Definition CAPI_Defines.h:100
@ kCursor_EastResize
Definition CAPI_Defines.h:95
@ kCursor_EastPanning
Definition CAPI_Defines.h:110
@ kCursor_None
Definition CAPI_Defines.h:126
@ kCursor_EastWestResize
Definition CAPI_Defines.h:104
@ kCursor_RowResize
Definition CAPI_Defines.h:108
@ kCursor_NorthEastPanning
Definition CAPI_Defines.h:112
@ kCursor_SouthResize
Definition CAPI_Defines.h:99
@ kCursor_ColumnResize
Definition CAPI_Defines.h:107
@ kCursor_NorthResize
Definition CAPI_Defines.h:96
@ kCursor_IBeam
Definition CAPI_Defines.h:92
@ kCursor_NorthEastResize
Definition CAPI_Defines.h:97
@ kCursor_WestResize
Definition CAPI_Defines.h:102
@ kCursor_NorthSouthResize
Definition CAPI_Defines.h:103
@ kCursor_Pointer
Definition CAPI_Defines.h:89
@ kCursor_NorthWestPanning
Definition CAPI_Defines.h:113
@ kCursor_Custom
Definition CAPI_Defines.h:132
@ kCursor_NotAllowed
Definition CAPI_Defines.h:127
@ kCursor_Alias
Definition CAPI_Defines.h:122
@ kCursor_NorthPanning
Definition CAPI_Defines.h:111
@ kCursor_Help
Definition CAPI_Defines.h:94
ULExport const char * ulVersionString()
Get the version string of the library in MAJOR.MINOR.PATCH format.
struct C_GamepadAxisEvent * ULGamepadAxisEvent
Definition CAPI_Defines.h:60
struct C_MouseEvent * ULMouseEvent
Definition CAPI_Defines.h:57
struct C_Bitmap * ULBitmap
Definition CAPI_Defines.h:53
struct C_ViewConfig * ULViewConfig
Definition CAPI_Defines.h:51
struct C_ScrollEvent * ULScrollEvent
Definition CAPI_Defines.h:58
ULKeyEventType
Definition CAPI_Defines.h:155
@ kKeyEventType_RawKeyDown
Raw Key-Down type.
Definition CAPI_Defines.h:176
@ kKeyEventType_KeyUp
Key-Up event type.
Definition CAPI_Defines.h:168
@ kKeyEventType_KeyDown
Key-Down event type.
Definition CAPI_Defines.h:163
@ kKeyEventType_Char
Character input event type.
Definition CAPI_Defines.h:182
struct C_Buffer * ULBuffer
Definition CAPI_Defines.h:55
struct C_Renderer * ULRenderer
Definition CAPI_Defines.h:49
ULFontHinting
Definition CAPI_Defines.h:213
@ kFontHinting_Normal
Default hinting algorithm– offers a good balance between sharpness and shape at smaller font sizes.
Definition CAPI_Defines.h:225
@ kFontHinting_Smooth
Lighter hinting algorithm– glyphs are slightly fuzzier but better resemble their original shape.
Definition CAPI_Defines.h:219
@ kFontHinting_Monochrome
Strongest hinting algorithm– outputs only black/white glyphs.
Definition CAPI_Defines.h:232
struct C_GamepadEvent * ULGamepadEvent
Definition CAPI_Defines.h:59
struct C_KeyEvent * ULKeyEvent
Definition CAPI_Defines.h:56
ULExport unsigned int ulVersionPatch()
Get the numeric patch version of the library.
ULBitmapFormat
Definition CAPI_Defines.h:135
@ kBitmapFormat_A8_UNORM
Alpha channel only, 8-bits per pixel.
Definition CAPI_Defines.h:143
@ kBitmapFormat_BGRA8_UNORM_SRGB
Blue Green Red Alpha channels, 32-bits per pixel.
Definition CAPI_Defines.h:152
Definition CAPI_Defines.h:242
int bottom
Definition CAPI_Defines.h:246
int top
Definition CAPI_Defines.h:244
int left
Definition CAPI_Defines.h:243
int right
Definition CAPI_Defines.h:245
Definition CAPI_Defines.h:235
float left
Definition CAPI_Defines.h:236
float right
Definition CAPI_Defines.h:238
float top
Definition CAPI_Defines.h:237
float bottom
Definition CAPI_Defines.h:239
Definition CAPI_Defines.h:249
bool is_empty
Definition CAPI_Defines.h:250
unsigned int texture_width
Definition CAPI_Defines.h:254
unsigned int render_buffer_id
Definition CAPI_Defines.h:258
unsigned int height
Definition CAPI_Defines.h:252
ULRect uv_coords
Definition CAPI_Defines.h:257
unsigned int width
Definition CAPI_Defines.h:251
unsigned int texture_id
Definition CAPI_Defines.h:253
unsigned int texture_height
Definition CAPI_Defines.h:255
ULBitmapFormat texture_format
Definition CAPI_Defines.h:256