ScCommon.h
Go to the documentation of this file.
1 
11 #ifndef SC_COMMON_H_
12 #define SC_COMMON_H_
13 
14 #include <Scandit/ScConfig.h>
15 
16 #if defined(__cplusplus)
17 extern "C" {
18 #endif
19 
20 
26 typedef struct {
30  int32_t x;
34  int32_t y;
35 } ScPoint;
36 
37 
50 inline ScPoint sc_point_make(int x, int y) {
51  ScPoint point;
52  point.x = x;
53  point.y = y;
54  return point;
55 }
56 
57 
63 typedef struct {
81 
82 
94 SC_EXPORT ScQuadrilateral
96 
102 typedef struct {
106  float x;
110  float y;
111 } ScPointF;
112 
125 inline ScPointF sc_point_f_make(float x, float y) {
126  ScPointF point;
127  point.x = x;
128  point.y = y;
129  return point;
130 }
131 
137 typedef struct {
138  uint32_t width;
139  uint32_t height;
140 } ScSize;
141 
147 typedef struct {
148  float width;
149  float height;
150 } ScSizeF;
151 
161 typedef struct {
170 } ScRectangleF;
171 
184 SC_EXPORT ScRectangleF
185 sc_rectangle_f_make(float position_x, float position_y, float width, float height);
186 
196 inline ScPointF
198  return sc_point_f_make(rectangle.position.x + rectangle.size.width * .5f,
199  rectangle.position.y + rectangle.size.height * .5f);
200 }
201 
207 typedef enum {
213 
214 
220 SC_EXPORT void sc_free(void *pointer);
221 
227 typedef struct {
231  const char *message;
232 
236  uint32_t code;
237 } ScError;
238 
239 
249 SC_EXPORT void sc_error_free(ScError *error);
250 
251 
260 typedef enum {
261  SC_INFORMATION_KEY_SOFTWARE_LICENSES,
263 
272 SC_EXPORT const char* sc_get_information_string(ScInformationKey key);
273 
274 #if defined(__cplusplus)
275 }
276 #endif
277 
278 
279 #endif //SC_COMMON_H_
280 
281 
uint32_t height
y dimension
Definition: ScCommon.h:139
the camera cannot change its focus
Definition: ScCommon.h:209
const char * message
error message. Set to NULL in case there is not error
Definition: ScCommon.h:231
ScInformationKey
Enumeration of different information strings.
Definition: ScCommon.h:260
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 position
Upper-left corner of the rectangle.
Definition: ScCommon.h:165
ScPoint bottom_right
Bottom right corner of the quadrilateral.
Definition: ScCommon.h:79
the focus capabilities are not known
Definition: ScCommon.h:208
A 2-dimensional polygon with 4 corners.
Definition: ScCommon.h:63
float y
Y-coordinate.
Definition: ScCommon.h:110
float width
x dimension
Definition: ScCommon.h:148
ScPoint top_right
Top right corner of the quadrilateral.
Definition: ScCommon.h:71
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.
Definition: ScCommon.h:197
float x
X-coordinate.
Definition: ScCommon.h:106
ScRectangleF sc_rectangle_f_make(float position_x, float position_y, float width, float height)
Helper function to initialize a rectangle.
ScPointF sc_point_f_make(float x, float y)
Helper function to initialize a point with x, y coordinates.
Definition: ScCommon.h:125
Structure for holding error information.
Definition: ScCommon.h:227
void sc_free(void *pointer)
Deallocates the memory allocation pointed to by pointer.
the camera is controlled by the user
Definition: ScCommon.h:211
ScPoint sc_point_make(int x, int y)
Helper function to initialize a point with x, y coordinates.
Definition: ScCommon.h:50
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:30
A 2-dimensional unsigned size.
Definition: ScCommon.h:137
uint32_t code
error code, 0 if there is no error, a positive value otherwise.
Definition: ScCommon.h:236
A 2-dimensional rectangle with floating point precision.
Definition: ScCommon.h:161
ScCameraFocusMode
Describes the focus mode of a camera.
Definition: ScCommon.h:207
ScPoint bottom_left
Bottom left corner of the quadrilateral.
Definition: ScCommon.h:75
int32_t y
Y-coordinate.
Definition: ScCommon.h:34
the camera automatically adjusts the focus to create a sharp image
Definition: ScCommon.h:210
float height
y dimension
Definition: ScCommon.h:149
ScPoint top_left
Top left corner of the quadrilateral.
Definition: ScCommon.h:67
ScSizeF size
Width and height of the rectangle. Both must larger or equal than zero.
Definition: ScCommon.h:169
A 2-dimensional size with floating point precision.
Definition: ScCommon.h:147
uint32_t width
x dimension
Definition: ScCommon.h:138
A 2-dimensional point with floating point precision.
Definition: ScCommon.h:102