ScCommon.h
Go to the documentation of this file.
1
11#ifndef SC_COMMON_H_
12#define SC_COMMON_H_
13
14#include <stddef.h>
15
16#include <Scandit/ScConfig.h>
18
20
26typedef struct {
30 int32_t x;
34 int32_t y;
35} ScPoint;
36
49inline ScPoint sc_point_make(int x, int y) {
50 ScPoint point;
51 point.x = x;
52 point.y = y;
53 return point;
54}
55
61typedef struct {
79
91SC_EXPORT
93
99typedef struct {
103 float x;
107 float y;
108} ScPointF;
109
122inline ScPointF sc_point_f_make(float x, float y) {
123 ScPointF point;
124 point.x = x;
125 point.y = y;
126 return point;
127}
128
134typedef struct {
135 uint32_t width;
136 uint32_t height;
137} ScSize;
138
144typedef struct {
145 float width;
146 float height;
147} ScSizeF;
148
158typedef struct {
168
177typedef struct {
195
207SC_EXPORT
209
222SC_EXPORT
223ScRectangleF sc_rectangle_f_make(float position_x, float position_y, float width, float height);
224
234SC_EXPORT
236
242typedef enum {
246 2,
249
256SC_EXPORT
257void sc_free(void *pointer);
258
264typedef struct {
268 char const *message;
269
273 uint32_t code;
274} ScError;
275
281typedef enum {
282 SC_NO_ERROR = 0,
283 SC_ERROR_UNKNOWN = 1,
284 SC_ERROR_NOT_IMPLEMENTED = 2,
285 SC_ERROR_INVALID_INPUT = 3,
286 SC_ERROR_INTERNAL_ERROR = 4
288
298SC_EXPORT
300
309typedef enum {
310 SC_INFORMATION_KEY_SOFTWARE_LICENSES = 0,
311 SC_INFORMATION_KEY_SDK_VERSION = 1,
312 SC_INFORMATION_KEY_SDK_BUILD = 2,
314
324SC_EXPORT
326
332typedef struct {
334 uint8_t *data;
335 size_t data_size;
337
349SC_EXPORT
351
353
354#endif // SC_COMMON_H_
ScCameraFocusMode
Describes the focus mode of a camera.
Definition: ScCommon.h:242
@ SC_CAMERA_FOCUS_MODE_AUTO
the camera automatically adjusts the focus to create a sharp image
Definition: ScCommon.h:245
@ SC_CAMERA_FOCUS_MODE_UNKNOWN
the focus capabilities are not known
Definition: ScCommon.h:243
@ SC_CAMERA_FOCUS_MODE_MANUAL
the camera is controlled by the user
Definition: ScCommon.h:247
@ SC_CAMERA_FOCUS_MODE_FIXED
the camera cannot change its focus
Definition: ScCommon.h:244
char const * message
error message. Set to NULL in case there is no error
Definition: ScCommon.h:268
uint32_t width
x dimension
Definition: ScCommon.h:135
float height
y dimension
Definition: ScCommon.h:146
uint32_t code
error code, 0 if there is no error, a positive value otherwise.
Definition: ScCommon.h:273
ScErrorType
Enumeration of different error types.
Definition: ScCommon.h:281
void sc_error_free(ScError *error)
free's any memory associated with the error
void sc_free(void *pointer)
Deallocates the memory allocation pointed to by pointer.
float width
x dimension
Definition: ScCommon.h:145
uint32_t height
y dimension
Definition: ScCommon.h:136
char const * sc_get_information_string(ScInformationKey key)
Get information string.
ScInformationKey
Enumeration of different information strings.
Definition: ScCommon.h:309
Structure for holding error information.
Definition: ScCommon.h:264
A 2-dimensional unsigned size.
Definition: ScCommon.h:134
A 2-dimensional size with floating point precision.
Definition: ScCommon.h:144
Common definitions used throughout the ScanditSDK API.
#define SC_EXTERN_C_BEGIN
Start of external C code.
Definition: ScConfig.h:19
#define SC_EXTERN_C_END
End of external C code.
Definition: ScConfig.h:28
Image description interface.
A 2-dimensional bitmap/image.
Definition: ScCommon.h:332
void sc_image_buffer_free(ScImageBuffer *image)
Frees the data contained in the image.
size_t data_size
total size of the data, including padding
Definition: ScCommon.h:335
ScImageDescription * description
pointer to the image description
Definition: ScCommon.h:333
uint8_t * data
pointer to the memory of the image
Definition: ScCommon.h:334
Describes dimensions as well as internal memory layout of an image buffer.
A 2-dimensional point with floating point precision.
Definition: ScCommon.h:99
ScPointF sc_point_f_make(float x, float y)
Helper function to initialize a point with x, y coordinates.
Definition: ScCommon.h:122
float x
X-coordinate.
Definition: ScCommon.h:103
float y
Y-coordinate.
Definition: ScCommon.h:107
A 2-dimensional point with integer precision.
Definition: ScCommon.h:26
int32_t x
X-coordinate.
Definition: ScCommon.h:30
ScPoint sc_point_make(int x, int y)
Helper function to initialize a point with x, y coordinates.
Definition: ScCommon.h:49
int32_t y
Y-coordinate.
Definition: ScCommon.h:34
A 2-dimensional polygon with 4 corners described as relative float coordinates.
Definition: ScCommon.h:177
ScQuadrilateralF sc_quadrilateral_float_make(ScPointF tl, ScPointF tr, ScPointF br, ScPointF bl)
Helper function to initialize a quadrilateral with float precision and 4 corners.
ScPointF bottom_right
Bottom right corner of the quadrilateral.
Definition: ScCommon.h:189
ScPointF bottom_left
Bottom left corner of the quadrilateral.
Definition: ScCommon.h:193
ScPointF top_right
Top right corner of the quadrilateral.
Definition: ScCommon.h:185
ScPointF top_left
Top left corner of the quadrilateral.
Definition: ScCommon.h:181
A 2-dimensional polygon with 4 corners.
Definition: ScCommon.h:61
ScPoint bottom_left
Bottom left corner of the quadrilateral.
Definition: ScCommon.h:77
ScQuadrilateral sc_quadrilateral_make(ScPoint tl, ScPoint tr, ScPoint br, ScPoint bl)
Helper function to initialize a quadrilateral with 4 corners.
ScPoint top_right
Top right corner of the quadrilateral.
Definition: ScCommon.h:69
ScPoint bottom_right
Bottom right corner of the quadrilateral.
Definition: ScCommon.h:73
ScPoint top_left
Top left corner of the quadrilateral.
Definition: ScCommon.h:65
A 2-dimensional rectangle with floating point precision.
Definition: ScCommon.h:158
ScRectangleF sc_rectangle_f_make(float position_x, float position_y, float width, float height)
Helper function to initialize a rectangle.
ScSizeF size
Width and height of the rectangle. Both must larger or equal than zero.
Definition: ScCommon.h:166
ScPointF position
Upper-left corner of the rectangle.
Definition: ScCommon.h:162
ScPointF sc_rectangle_f_get_center(ScRectangleF rectangle)
Calculates and returns the center of the rectangle.