ScCommon.h
Go to the documentation of this file.
1 
11 #ifndef SC_COMMON_H_
12 #define SC_COMMON_H_
13 
14 
15 #include <Scandit/ScConfig.h>
17 
18 #if defined(__cplusplus)
19 extern "C" {
20 #endif
21 
22 
28 typedef struct {
32  int32_t x;
36  int32_t y;
37 } ScPoint;
38 
39 
52 inline ScPoint sc_point_make(int x, int y) {
53  ScPoint point;
54  point.x = x;
55  point.y = y;
56  return point;
57 }
58 
59 
65 typedef struct {
83 
95 SC_EXPORT ScQuadrilateral
97 
103 typedef struct {
107  float x;
111  float y;
112 } ScPointF;
113 
126 inline ScPointF sc_point_f_make(float x, float y) {
127  ScPointF point;
128  point.x = x;
129  point.y = y;
130  return point;
131 }
132 
138 typedef struct {
139  uint32_t width;
140  uint32_t height;
141 } ScSize;
142 
148 typedef struct {
149  float width;
150  float height;
151 } ScSizeF;
152 
162 typedef struct {
171 } ScRectangleF;
172 
181 typedef struct {
199 
212  ScPointF tr,
213  ScPointF br,
214  ScPointF bl);
215 
228 SC_EXPORT ScRectangleF
229 sc_rectangle_f_make(float position_x, float position_y, float width, float height);
230 
240 SC_EXPORT ScPointF
242 
248 typedef enum {
254 
261 SC_EXPORT void sc_free(void *pointer);
262 
268 typedef struct {
272  const char *message;
273 
277  uint32_t code;
278 } ScError;
279 
285 typedef enum {
286  SC_NO_ERROR = 0,
287  SC_ERROR_UNKNOWN = 1,
288  SC_ERROR_NOT_IMPLEMENTED = 2,
289  SC_ERROR_INVALID_INPUT = 3,
290  SC_ERROR_INTERNAL_ERROR = 4
291 } ScErrorType;
292 
293 
303 SC_EXPORT void sc_error_free(ScError *error);
304 
305 
314 typedef enum {
315  SC_INFORMATION_KEY_SOFTWARE_LICENSES = 0,
316  SC_INFORMATION_KEY_SDK_VERSION = 1,
317  SC_INFORMATION_KEY_SDK_BUILD = 2,
319 
329 SC_EXPORT const char* sc_get_information_string(ScInformationKey key);
330 
336 typedef struct {
337  ScImageDescription* description;
338  uint8_t* data;
339 } ScImageBuffer;
340 
351 SC_EXPORT void
353 
354 
355 #if defined(__cplusplus)
356 }
357 #endif
358 
359 #endif // SC_COMMON_H_
ScPointF top_right
Top right corner of the quadrilateral.
Definition: ScCommon.h:189
ScErrorType
Enumeration of different error types.
Definition: ScCommon.h:285
ScPointF top_left
Top left corner of the quadrilateral.
Definition: ScCommon.h:185
uint32_t height
y dimension
Definition: ScCommon.h:140
the camera cannot change its focus
Definition: ScCommon.h:250
const char * message
error message. Set to NULL in case there is no error
Definition: ScCommon.h:272
ScInformationKey
Enumeration of different information strings.
Definition: ScCommon.h:314
ScQuadrilateral sc_quadrilateral_make(ScPoint tl, ScPoint tr, ScPoint br, ScPoint bl)
Helper function to initialize a quadrilateral with 4 corners.
void sc_error_free(ScError *error)
free's any memory associated with the error
ScPointF bottom_left
Bottom left corner of the quadrilateral.
Definition: ScCommon.h:197
A 2-dimensional polygon with 4 corners described as relative float coordinates.
Definition: ScCommon.h:181
ScPointF position
Upper-left corner of the rectangle.
Definition: ScCommon.h:166
ScPoint bottom_right
Bottom right corner of the quadrilateral.
Definition: ScCommon.h:77
the focus capabilities are not known
Definition: ScCommon.h:249
A 2-dimensional polygon with 4 corners.
Definition: ScCommon.h:65
float y
Y-coordinate.
Definition: ScCommon.h:111
float width
x dimension
Definition: ScCommon.h:149
A 2-dimensional bitmap/image.
Definition: ScCommon.h:336
ScPoint top_right
Top right corner of the quadrilateral.
Definition: ScCommon.h:73
Describes dimensions as well as internal memory layout of an image buffer.
A 2-dimensional point with integer precision.
Definition: ScCommon.h:28
ScPointF sc_rectangle_f_get_center(ScRectangleF rectangle)
Calculates and returns the center of the rectangle.
float x
X-coordinate.
Definition: ScCommon.h:107
ScRectangleF sc_rectangle_f_make(float position_x, float position_y, float width, float height)
Helper function to initialize a rectangle.
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 sc_point_f_make(float x, float y)
Helper function to initialize a point with x, y coordinates.
Definition: ScCommon.h:126
Structure for holding error information.
Definition: ScCommon.h:268
void sc_free(void *pointer)
Deallocates the memory allocation pointed to by pointer.
the camera is controlled by the user
Definition: ScCommon.h:252
ScPoint sc_point_make(int x, int y)
Helper function to initialize a point with x, y coordinates.
Definition: ScCommon.h:52
Common definitions used throughout the ScanditSDK API.
const char * sc_get_information_string(ScInformationKey key)
Get information string.
int32_t x
X-coordinate.
Definition: ScCommon.h:32
A 2-dimensional unsigned size.
Definition: ScCommon.h:138
uint32_t code
error code, 0 if there is no error, a positive value otherwise.
Definition: ScCommon.h:277
A 2-dimensional rectangle with floating point precision.
Definition: ScCommon.h:162
ScCameraFocusMode
Describes the focus mode of a camera.
Definition: ScCommon.h:248
ScPoint bottom_left
Bottom left corner of the quadrilateral.
Definition: ScCommon.h:81
int32_t y
Y-coordinate.
Definition: ScCommon.h:36
the camera automatically adjusts the focus to create a sharp image
Definition: ScCommon.h:251
float height
y dimension
Definition: ScCommon.h:150
void sc_image_buffer_free(ScImageBuffer *image)
Frees the data contained in the image.
ScPoint top_left
Top left corner of the quadrilateral.
Definition: ScCommon.h:69
Image Description interface.
ScSizeF size
Width and height of the rectangle. Both must larger or equal than zero.
Definition: ScCommon.h:170
A 2-dimensional size with floating point precision.
Definition: ScCommon.h:148
uint32_t width
x dimension
Definition: ScCommon.h:139
ScPointF bottom_right
Bottom right corner of the quadrilateral.
Definition: ScCommon.h:193
A 2-dimensional point with floating point precision.
Definition: ScCommon.h:103