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