Enrollment 28.2.0
Loading...
Searching...
No Matches
ImageExecutor.h
Go to the documentation of this file.
1
9
10#pragma once
11
13#include "enrollment/Export.h"
14#include <cstdint>
15#include <memory>
16#include <mutex>
17#include <stddef.h>
18#include <string>
19
20namespace inno
21{
22 extern "C"
23 {
24 using ImageImplDestroyer = void (*)(void*);
25 using ImageMaskImplDestroyer = void (*)(void*);
26 }
27
28 class ImageExecutor
29 {
30 public:
31 virtual void* Create(const uint8_t* image,
32 size_t imageLength,
33 unsigned int dpi,
34 ErrorCallbacks errorCallbacks) const = 0;
35 virtual void* CreateRaw(unsigned int width,
36 unsigned int height,
37 unsigned int dpi,
38 unsigned int type,
39 const uint8_t* image,
40 ErrorCallbacks errorCallbacks) const = 0;
41 virtual void* Clone(const void*, ErrorCallbacks errorCallbacks) const = 0;
42 [[nodiscard]] virtual ImageImplDestroyer Destroy() const = 0;
43 virtual uint8_t DeduceType(const uint8_t* data, size_t length, ErrorCallbacks errorCallbacks) const = 0;
44 virtual bool IsEqual(const void* left, const void* right, ErrorCallbacks errorCallbacks) const = 0;
45 virtual size_t RawSize(const void* impl) const = 0;
46 virtual void ToRaw(const void* impl,
47 uint8_t* data,
48 size_t size,
49 unsigned int* type,
50 ErrorCallbacks errorCallbacks) const = 0;
51 virtual size_t RawTypeSize(const void* impl, unsigned int type, ErrorCallbacks errorCallbacks) const = 0;
52 virtual void ToRawType(const void* impl,
53 uint8_t* data,
54 size_t size,
55 unsigned int type,
56 ErrorCallbacks errorCallbacks) const = 0;
57 virtual unsigned int Width(const void* impl) const = 0;
58 virtual unsigned int Height(const void* impl) const = 0;
59 virtual unsigned int Dpi(const void* impl) const = 0;
60 virtual void DrawLine(void* impl,
61 int startX,
62 int startY,
63 int endX,
64 int endY,
65 unsigned char red,
66 unsigned char green,
67 unsigned char blue,
68 unsigned char transparency,
69 unsigned char thickness,
70 ErrorCallbacks errorCallbacks) const = 0;
71 virtual void DrawCircle(void* impl,
72 int centerX,
73 int centerY,
74 unsigned int radius,
75 unsigned char red,
76 unsigned char green,
77 unsigned char blue,
78 unsigned char transparency,
79 unsigned char thickness,
80 ErrorCallbacks errorCallbacks) const = 0;
81 virtual void DrawingFinished(const void* impl, ErrorCallbacks errorCallbacks) const = 0;
82 virtual void* CropAlignedRectangle(const void* impl,
83 int topLeftX,
84 int topLeftY,
85 int topRightX,
86 int topRightY,
87 int bottomRightX,
88 int bottomRightY,
89 int bottomLeftX,
90 int bottomLeftY,
91 float rectangleWidth,
92 float rectangleHeight,
93 unsigned int imageWidth,
94 unsigned int imageHeight,
95 unsigned char red,
96 unsigned char green,
97 unsigned char blue,
98 unsigned char transparency,
99 ErrorCallbacks errorCallbacks) const = 0;
100 virtual void* Resize(const void* impl, float factor, ErrorCallbacks errorCallbacks) const = 0;
101 virtual void* ChangeDpi(const void* impl, unsigned int targetDpi, ErrorCallbacks errorCallbacks) const = 0;
102 virtual void* ChangeDpiArea(const void* impl, unsigned int targetDpi, ErrorCallbacks errorCallbacks) const = 0;
103 virtual void* ChangeDpiNist(const void* impl, unsigned int targetDpi, ErrorCallbacks errorCallbacks) const = 0;
104 virtual void* ChangeDpiNistWithOptions(const void* impl,
105 unsigned int targetDpi,
106 uint8_t interpolationMethod,
107 uint8_t filterType,
108 ErrorCallbacks errorCallbacks) const = 0;
109 virtual void* CropRectangle(const void* impl,
110 int topLeftX,
111 int topLeftY,
112 int topRightX,
113 int topRightY,
114 int bottomRightX,
115 int bottomRightY,
116 int bottomLeftX,
117 int bottomLeftY,
118 unsigned int imageWidth,
119 unsigned int imageHeight,
120 unsigned char red,
121 unsigned char green,
122 unsigned char blue,
123 unsigned char transparency,
124 ErrorCallbacks errorCallbacks) const = 0;
125 virtual unsigned int IntersectionRectangle(const void* impl,
126 int topLeftX,
127 int topLeftY,
128 int topRightX,
129 int topRightY,
130 int bottomRightX,
131 int bottomRightY,
132 int bottomLeftX,
133 int bottomLeftY,
134 ErrorCallbacks errorCallbacks) const = 0;
135 virtual void* CropCircle(const void* impl,
136 int centerX,
137 int centerY,
138 unsigned int radius,
139 unsigned char red,
140 unsigned char green,
141 unsigned char blue,
142 unsigned char transparency,
143 ErrorCallbacks errorCallbacks) const = 0;
144 virtual unsigned int IntersectionCircle(const void* impl,
145 int centerX,
146 int centerY,
147 unsigned int radius,
148 ErrorCallbacks errorCallbacks) const = 0;
149 virtual unsigned int IntersectionPoint(const void* impl, int x, int y, ErrorCallbacks errorCallbacks) const = 0;
150 virtual void GetRectangleDimensions(float* width,
151 float* height,
152 int topLeftX,
153 int topLeftY,
154 int topRightX,
155 int topRightY,
156 int bottomRightX,
157 int bottomRightY,
158 int bottomLeftX,
159 int bottomLeftY,
160 ErrorCallbacks errorCallbacks) const = 0;
161 virtual void ResizeRectangle(float width,
162 float height,
163 int topLeftX,
164 int topLeftY,
165 int topRightX,
166 int topRightY,
167 int bottomRightX,
168 int bottomRightY,
169 int bottomLeftX,
170 int bottomLeftY,
171 int* newTopLeftX,
172 int* newTopLeftY,
173 int* newTopRightX,
174 int* newTopRightY,
175 int* newBottomRightX,
176 int* newBottomRightY,
177 int* newBottomLeftX,
178 int* newBottomLeftY,
179 ErrorCallbacks errorCallbacks) const = 0;
180 virtual void MaskCircle(void* impl,
181 int centerX,
182 int centerY,
183 unsigned int radius,
184 unsigned char red,
185 unsigned char green,
186 unsigned char blue,
187 unsigned char transparency,
188 unsigned int maskType,
189 ErrorCallbacks errorCallbacks) const = 0;
190 virtual void MaskPolygon(void* impl,
191 const int* x,
192 const int* y,
193 size_t size,
194 unsigned char red,
195 unsigned char green,
196 unsigned char blue,
197 unsigned char transparency,
198 unsigned int maskType,
199 ErrorCallbacks errorCallbacks) const = 0;
200 virtual void BlurCircle(void* impl,
201 int centerX,
202 int centerY,
203 unsigned int radius,
204 unsigned int maskType,
205 unsigned int blurType,
206 ErrorCallbacks errorCallbacks) const = 0;
207 virtual void BlurPolygon(void* impl,
208 const int* x,
209 const int* y,
210 size_t size,
211 unsigned int maskType,
212 unsigned int blurType,
213 ErrorCallbacks errorCallbacks) const = 0;
214 virtual void AddCircleToBlurMask(void* impl,
215 int centerX,
216 int centerY,
217 unsigned int radius,
218 unsigned int maskType,
219 ErrorCallbacks errorCallbacks) = 0;
220 virtual void AddPolygonToBlurMask(void* impl,
221 const int* x,
222 const int* y,
223 size_t size,
224 unsigned int maskType,
225 ErrorCallbacks errorCallbacks) = 0;
226 virtual void ApplyBlur(void* impl, unsigned int blurType, ErrorCallbacks errorCallbacks) = 0;
227 virtual void* MaskingFinished(void* impl, ErrorCallbacks errorCallbacks) const = 0;
228 virtual void* CreateMasker(void* impl, ErrorCallbacks errorCallbacks) const = 0;
229 [[nodiscard]] virtual ImageMaskImplDestroyer DestroyMask() const = 0;
230 [[nodiscard]] virtual size_t Channels(void* impl, ErrorCallbacks errorCallbacks) const = 0;
231
232 ImageExecutor() = default;
233 virtual ~ImageExecutor() = default;
234 ImageExecutor(const ImageExecutor&) = delete;
235 ImageExecutor(ImageExecutor&&) = delete;
236 ImageExecutor& operator=(const ImageExecutor&) = delete;
237 ImageExecutor& operator=(ImageExecutor&&) = delete;
238 };
239
240 extern "C"
241 {
242 INNO_ENROLLMENT_API void* inno_local_Image_Create(const uint8_t* image,
243 size_t imageLength,
244 unsigned int dpi,
245 ErrorCallbacks errorCallbacks);
246 INNO_ENROLLMENT_API void* inno_local_Image_Create_Raw(unsigned int width,
247 unsigned int height,
248 unsigned int dpi,
249 unsigned int type,
250 const uint8_t* image,
251 ErrorCallbacks errorCallbacks);
252 INNO_ENROLLMENT_API void* inno_local_Image_Clone(const void* impl, ErrorCallbacks errorCallbacks);
253 INNO_ENROLLMENT_API void inno_local_Image_Destroy(void* impl);
254 INNO_ENROLLMENT_API uint8_t inno_local_Image_DeduceType(const uint8_t* data,
255 size_t length,
256 ErrorCallbacks errorCallbacks);
257 INNO_ENROLLMENT_API bool inno_local_Image_IsEqual(const void* left,
258 const void* right,
259 ErrorCallbacks errorCallbacks);
260 INNO_ENROLLMENT_API size_t inno_local_Image_RawSize(const void* impl);
261 INNO_ENROLLMENT_API void inno_local_Image_ToRaw(const void* impl,
262 uint8_t* data,
263 size_t size,
264 unsigned int* type,
265 ErrorCallbacks errorCallbacks);
266 INNO_ENROLLMENT_API size_t inno_local_Image_RawTypeSize(const void* impl,
267 unsigned int type,
268 ErrorCallbacks errorCallbacks);
269 INNO_ENROLLMENT_API void inno_local_Image_ToRawType(const void* impl,
270 uint8_t* data,
271 size_t size,
272 unsigned int type,
273 ErrorCallbacks errorCallbacks);
274 INNO_ENROLLMENT_API unsigned int inno_local_Image_Width(const void* impl);
275 INNO_ENROLLMENT_API unsigned int inno_local_Image_Height(const void* impl);
276 INNO_ENROLLMENT_API unsigned int inno_local_Image_Dpi(const void* impl);
277 INNO_ENROLLMENT_API void inno_local_Image_DrawLine(void* impl,
278 int startX,
279 int startY,
280 int endX,
281 int endY,
282 unsigned char red,
283 unsigned char green,
284 unsigned char blue,
285 unsigned char transparency,
286 unsigned char thickness,
287 ErrorCallbacks errorCallbacks);
288 INNO_ENROLLMENT_API void inno_local_Image_DrawCircle(void* impl,
289 int centerX,
290 int centerY,
291 unsigned int radius,
292 unsigned char red,
293 unsigned char green,
294 unsigned char blue,
295 unsigned char transparency,
296 unsigned char thickness,
297 ErrorCallbacks errorCallbacks);
298 INNO_ENROLLMENT_API void inno_local_Image_DrawingFinished(const void* impl, ErrorCallbacks errorCallbacks);
299 INNO_ENROLLMENT_API void* inno_local_Image_GetAlignedRectangle(const void* impl,
300 int topLeftX,
301 int topLeftY,
302 int topRightX,
303 int topRightY,
304 int bottomRightX,
305 int bottomRightY,
306 int bottomLeftX,
307 int bottomLeftY,
308 float rectangleWidth,
309 float rectangleHeight,
310 unsigned int imageWidth,
311 unsigned int imageHeight,
312 unsigned char red,
313 unsigned char green,
314 unsigned char blue,
315 unsigned char transparency,
316 ErrorCallbacks errorCallbacks);
317 INNO_ENROLLMENT_API void* inno_local_Image_Resize(const void* impl,
318 float factor,
319 ErrorCallbacks errorCallbacks);
320 INNO_ENROLLMENT_API void* inno_local_Image_ChangeDpi(const void* impl,
321 unsigned int targetDpi,
322 ErrorCallbacks errorCallbacks);
323 INNO_ENROLLMENT_API void* inno_local_Image_ChangeDpiArea(const void* impl,
324 unsigned int targetDpi,
325 ErrorCallbacks errorCallbacks);
326 INNO_ENROLLMENT_API void* inno_local_Image_ChangeDpiNist(const void* impl,
327 unsigned int targetDpi,
328 ErrorCallbacks errorCallbacks);
329 INNO_ENROLLMENT_API void* inno_local_Image_ChangeDpiNistWithOptions(const void* impl,
330 unsigned int targetDpi,
331 uint8_t interpolationMethod,
332 uint8_t filterType,
333 ErrorCallbacks errorCallbacks);
334 INNO_ENROLLMENT_API void* inno_local_Image_GetRectangle(const void* impl,
335 int topLeftX,
336 int topLeftY,
337 int topRightX,
338 int topRightY,
339 int bottomRightX,
340 int bottomRightY,
341 int bottomLeftX,
342 int bottomLeftY,
343 unsigned int imageWidth,
344 unsigned int imageHeight,
345 unsigned char red,
346 unsigned char green,
347 unsigned char blue,
348 unsigned char transparency,
349 ErrorCallbacks errorCallbacks);
350 INNO_ENROLLMENT_API unsigned int inno_local_Image_Intersection_Rectangle(const void* impl,
351 int topLeftX,
352 int topLeftY,
353 int topRightX,
354 int topRightY,
355 int bottomRightX,
356 int bottomRightY,
357 int bottomLeftX,
358 int bottomLeftY,
359 ErrorCallbacks errorCallbacks);
360 INNO_ENROLLMENT_API void* inno_local_Image_GetCircle(const void* impl,
361 int centerX,
362 int centerY,
363 unsigned int radius,
364 unsigned char red,
365 unsigned char green,
366 unsigned char blue,
367 unsigned char transparency,
368 ErrorCallbacks errorCallbacks);
369 INNO_ENROLLMENT_API unsigned int inno_local_Image_Intersection_Circle(const void* impl,
370 int centerX,
371 int centerY,
372 unsigned int radius,
373 ErrorCallbacks errorCallbacks);
374 INNO_ENROLLMENT_API unsigned int inno_local_Image_Intersection_Point(const void* impl,
375 int x,
376 int y,
377 ErrorCallbacks errorCallbacks);
378 INNO_ENROLLMENT_API void inno_local_Image_GetRectangleDimensions(float* width,
379 float* height,
380 int topLeftX,
381 int topLeftY,
382 int topRightX,
383 int topRightY,
384 int bottomRightX,
385 int bottomRightY,
386 int bottomLeftX,
387 int bottomLeftY,
388 ErrorCallbacks errorCallbacks);
389 INNO_ENROLLMENT_API void inno_local_Image_ResizeRectangle(float width,
390 float height,
391 int topLeftX,
392 int topLeftY,
393 int topRightX,
394 int topRightY,
395 int bottomRightX,
396 int bottomRightY,
397 int bottomLeftX,
398 int bottomLeftY,
399 int* newTopLeftX,
400 int* newTopLeftY,
401 int* newTopRightX,
402 int* newTopRightY,
403 int* newBottomRightX,
404 int* newBottomRightY,
405 int* newBottomLeftX,
406 int* newBottomLeftY,
407 ErrorCallbacks errorCallbacks);
408 INNO_ENROLLMENT_API void inno_local_Image_MaskCircle(void* impl,
409 int centerX,
410 int centerY,
411 unsigned int radius,
412 unsigned char red,
413 unsigned char green,
414 unsigned char blue,
415 unsigned char transparency,
416 unsigned int maskType,
417 ErrorCallbacks errorCallbacks);
418 INNO_ENROLLMENT_API void inno_local_Image_MaskPolygon(void* impl,
419 const int* x,
420 const int* y,
421 size_t size,
422 unsigned char red,
423 unsigned char green,
424 unsigned char blue,
425 unsigned char transparency,
426 unsigned int maskType,
427 ErrorCallbacks errorCallbacks);
428 INNO_ENROLLMENT_API void inno_local_Image_BlurCircle(void* impl,
429 int centerX,
430 int centerY,
431 unsigned int radius,
432 unsigned int maskType,
433 unsigned int blurType,
434 ErrorCallbacks errorCallbacks);
435 INNO_ENROLLMENT_API void inno_local_Image_BlurPolygon(void* impl,
436 const int* x,
437 const int* y,
438 size_t size,
439 unsigned int maskType,
440 unsigned int blurType,
441 ErrorCallbacks errorCallbacks);
442 INNO_ENROLLMENT_API void inno_local_Image_AddCircleToBlurMask(void* impl,
443 int centerX,
444 int centerY,
445 unsigned int radius,
446 unsigned int maskType,
447 ErrorCallbacks errorCallbacks);
448 INNO_ENROLLMENT_API void inno_local_Image_AddPolygonToBlurMask(void* impl,
449 const int* x,
450 const int* y,
451 size_t size,
452 unsigned int maskType,
453 ErrorCallbacks errorCallbacks);
454 INNO_ENROLLMENT_API void inno_local_Image_ApplyBlur(void* impl,
455 unsigned int blurType,
456 ErrorCallbacks errorCallbacks);
457 INNO_ENROLLMENT_API void* inno_local_Image_MaskingFinished(void* impl, ErrorCallbacks errorCallbacks);
458 INNO_ENROLLMENT_API void* inno_local_Image_CreateMasker(void* impl, ErrorCallbacks errorCallbacks);
459 INNO_ENROLLMENT_API void inno_local_Image_DestroyMask(void* impl);
460 INNO_ENROLLMENT_API size_t inno_local_Image_GetNumOfChannels(void* impl, ErrorCallbacks errorCallbacks);
461 }
462 class LocalImageExecutor : public ImageExecutor
463 {
464 public:
465 void* Create(const uint8_t* image,
466 size_t imageLength,
467 unsigned int dpi,
468 ErrorCallbacks errorCallbacks) const final
469 {
470 return inno_local_Image_Create(image, imageLength, dpi, errorCallbacks);
471 }
472
473 void* CreateRaw(unsigned int width,
474 unsigned int height,
475 unsigned int dpi,
476 unsigned int type,
477 const uint8_t* image,
478 ErrorCallbacks errorCallbacks) const final
479 {
480 return inno_local_Image_Create_Raw(width, height, dpi, type, image, errorCallbacks);
481 }
482 void* Clone(const void* impl, ErrorCallbacks errorCallbacks) const final
483 {
484 return inno_local_Image_Clone(impl, errorCallbacks);
485 }
486 [[nodiscard]] ImageImplDestroyer Destroy() const final
487 {
488 return inno_local_Image_Destroy;
489 }
490 uint8_t DeduceType(const uint8_t* data, size_t length, ErrorCallbacks errorCallbacks) const final
491 {
492 return inno_local_Image_DeduceType(data, length, errorCallbacks);
493 }
494 bool IsEqual(const void* left, const void* right, ErrorCallbacks errorCallbacks) const final
495 {
496 return inno_local_Image_IsEqual(left, right, errorCallbacks);
497 }
498 size_t RawSize(const void* impl) const final
499 {
500 return inno_local_Image_RawSize(impl);
501 }
502 void ToRaw(const void* impl,
503 uint8_t* data,
504 size_t size,
505 unsigned int* type,
506 ErrorCallbacks errorCallbacks) const final
507 {
508 inno_local_Image_ToRaw(impl, data, size, type, errorCallbacks);
509 }
510 size_t RawTypeSize(const void* impl, unsigned int type, ErrorCallbacks errorCallbacks) const final
511 {
512 return inno_local_Image_RawTypeSize(impl, type, errorCallbacks);
513 }
514 void ToRawType(const void* impl,
515 uint8_t* data,
516 size_t size,
517 unsigned int type,
518 ErrorCallbacks errorCallbacks) const final
519 {
520 inno_local_Image_ToRawType(impl, data, size, type, errorCallbacks);
521 }
522 unsigned int Width(const void* impl) const final
523 {
524 return inno_local_Image_Width(impl);
525 }
526 unsigned int Height(const void* impl) const final
527 {
528 return inno_local_Image_Height(impl);
529 }
530 unsigned int Dpi(const void* impl) const final
531 {
532 return inno_local_Image_Dpi(impl);
533 }
534 void DrawLine(void* impl,
535 int startX,
536 int startY,
537 int endX,
538 int endY,
539 unsigned char red,
540 unsigned char green,
541 unsigned char blue,
542 unsigned char transparency,
543 unsigned char thickness,
544 ErrorCallbacks errorCallbacks) const final
545 {
546 inno_local_Image_DrawLine(
547 impl, startX, startY, endX, endY, red, green, blue, transparency, thickness, errorCallbacks);
548 }
549 void DrawCircle(void* impl,
550 int centerX,
551 int centerY,
552 unsigned int radius,
553 unsigned char red,
554 unsigned char green,
555 unsigned char blue,
556 unsigned char transparency,
557 unsigned char thickness,
558 ErrorCallbacks errorCallbacks) const final
559 {
560 inno_local_Image_DrawCircle(
561 impl, centerX, centerY, radius, red, green, blue, transparency, thickness, errorCallbacks);
562 }
563 void DrawingFinished(const void* impl, ErrorCallbacks errorCallbacks) const final
564 {
565 inno_local_Image_DrawingFinished(impl, errorCallbacks);
566 }
567 void* Resize(const void* impl, float factor, ErrorCallbacks errorCallbacks) const final
568 {
569 return inno_local_Image_Resize(impl, factor, errorCallbacks);
570 }
571 void* ChangeDpi(const void* impl, unsigned int targetDpi, ErrorCallbacks errorCallbacks) const final
572 {
573 return inno_local_Image_ChangeDpi(impl, targetDpi, errorCallbacks);
574 }
575 void* ChangeDpiArea(const void* impl, unsigned int targetDpi, ErrorCallbacks errorCallbacks) const final
576 {
577 return inno_local_Image_ChangeDpiArea(impl, targetDpi, errorCallbacks);
578 }
579
580 void* ChangeDpiNist(const void* impl, unsigned int targetDpi, ErrorCallbacks errorCallbacks) const final
581 {
582 return inno_local_Image_ChangeDpiNist(impl, targetDpi, errorCallbacks);
583 }
584
585 void* ChangeDpiNistWithOptions(const void* impl,
586 unsigned int targetDpi,
587 uint8_t interpolationMethod,
588 uint8_t filterType,
589 ErrorCallbacks errorCallbacks) const final
590 {
591 return inno_local_Image_ChangeDpiNistWithOptions(
592 impl, targetDpi, interpolationMethod, filterType, errorCallbacks);
593 }
594
595 void* CropAlignedRectangle(const void* impl,
596 int topLeftX,
597 int topLeftY,
598 int topRightX,
599 int topRightY,
600 int bottomRightX,
601 int bottomRightY,
602 int bottomLeftX,
603 int bottomLeftY,
604 float rectangleWidth,
605 float rectangleHeight,
606 unsigned int imageWidth,
607 unsigned int imageHeight,
608 unsigned char red,
609 unsigned char green,
610 unsigned char blue,
611 unsigned char transparency,
612 ErrorCallbacks errorCallbacks) const final
613 {
614 return inno_local_Image_GetAlignedRectangle(impl,
615 topLeftX,
616 topLeftY,
617 topRightX,
618 topRightY,
619 bottomRightX,
620 bottomRightY,
621 bottomLeftX,
622 bottomLeftY,
623 rectangleWidth,
624 rectangleHeight,
625 imageWidth,
626 imageHeight,
627 red,
628 green,
629 blue,
630 transparency,
631 errorCallbacks);
632 }
633
634 void* CropRectangle(const void* impl,
635 int topLeftX,
636 int topLeftY,
637 int topRightX,
638 int topRightY,
639 int bottomRightX,
640 int bottomRightY,
641 int bottomLeftX,
642 int bottomLeftY,
643 unsigned int imageWidth,
644 unsigned int imageHeight,
645 unsigned char red,
646 unsigned char green,
647 unsigned char blue,
648 unsigned char transparency,
649 ErrorCallbacks errorCallbacks) const final
650 {
651 return inno_local_Image_GetRectangle(impl,
652 topLeftX,
653 topLeftY,
654 topRightX,
655 topRightY,
656 bottomRightX,
657 bottomRightY,
658 bottomLeftX,
659 bottomLeftY,
660 imageWidth,
661 imageHeight,
662 red,
663 green,
664 blue,
665 transparency,
666 errorCallbacks);
667 }
668 unsigned int IntersectionRectangle(const void* impl,
669 int topLeftX,
670 int topLeftY,
671 int topRightX,
672 int topRightY,
673 int bottomRightX,
674 int bottomRightY,
675 int bottomLeftX,
676 int bottomLeftY,
677 ErrorCallbacks errorCallbacks) const final
678 {
679 return inno_local_Image_Intersection_Rectangle(impl,
680 topLeftX,
681 topLeftY,
682 topRightX,
683 topRightY,
684 bottomRightX,
685 bottomRightY,
686 bottomLeftX,
687 bottomLeftY,
688 errorCallbacks);
689 }
690 void* CropCircle(const void* impl,
691 int centerX,
692 int centerY,
693 unsigned int radius,
694 unsigned char red,
695 unsigned char green,
696 unsigned char blue,
697 unsigned char transparency,
698 ErrorCallbacks errorCallbacks) const final
699 {
700 return inno_local_Image_GetCircle(
701 impl, centerX, centerY, radius, red, green, blue, transparency, errorCallbacks);
702 }
703 unsigned int IntersectionCircle(const void* impl,
704 int centerX,
705 int centerY,
706 unsigned int radius,
707 ErrorCallbacks errorCallbacks) const final
708 {
709 return inno_local_Image_Intersection_Circle(impl, centerX, centerY, radius, errorCallbacks);
710 }
711 unsigned int IntersectionPoint(const void* impl, int x, int y, ErrorCallbacks errorCallbacks) const final
712 {
713 return inno_local_Image_Intersection_Point(impl, x, y, errorCallbacks);
714 }
715
716 void GetRectangleDimensions(float* width,
717 float* height,
718 int topLeftX,
719 int topLeftY,
720 int topRightX,
721 int topRightY,
722 int bottomRightX,
723 int bottomRightY,
724 int bottomLeftX,
725 int bottomLeftY,
726 ErrorCallbacks errorCallbacks) const final
727 {
728 inno_local_Image_GetRectangleDimensions(width,
729 height,
730 topLeftX,
731 topLeftY,
732 topRightX,
733 topRightY,
734 bottomRightX,
735 bottomRightY,
736 bottomLeftX,
737 bottomLeftY,
738 errorCallbacks);
739 }
740
741 void ResizeRectangle(float width,
742 float height,
743 int topLeftX,
744 int topLeftY,
745 int topRightX,
746 int topRightY,
747 int bottomRightX,
748 int bottomRightY,
749 int bottomLeftX,
750 int bottomLeftY,
751 int* newTopLeftX,
752 int* newTopLeftY,
753 int* newTopRightX,
754 int* newTopRightY,
755 int* newBottomRightX,
756 int* newBottomRightY,
757 int* newBottomLeftX,
758 int* newBottomLeftY,
759 ErrorCallbacks errorCallbacks) const final
760 {
761 inno_local_Image_ResizeRectangle(width,
762 height,
763 topLeftX,
764 topLeftY,
765 topRightX,
766 topRightY,
767 bottomRightX,
768 bottomRightY,
769 bottomLeftX,
770 bottomLeftY,
771 newTopLeftX,
772 newTopLeftY,
773 newTopRightX,
774 newTopRightY,
775 newBottomRightX,
776 newBottomRightY,
777 newBottomLeftX,
778 newBottomLeftY,
779 errorCallbacks);
780 }
781
782 void MaskCircle(void* impl,
783 int centerX,
784 int centerY,
785 unsigned int radius,
786 unsigned char red,
787 unsigned char green,
788 unsigned char blue,
789 unsigned char transparency,
790 unsigned int maskType,
791 ErrorCallbacks errorCallbacks) const final
792 {
793 inno_local_Image_MaskCircle(
794 impl, centerX, centerY, radius, red, green, blue, transparency, maskType, errorCallbacks);
795 }
796
797 void MaskPolygon(void* impl,
798 const int* x,
799 const int* y,
800 size_t size,
801 unsigned char red,
802 unsigned char green,
803 unsigned char blue,
804 unsigned char transparency,
805 unsigned int maskType,
806 ErrorCallbacks errorCallbacks) const final
807 {
808 inno_local_Image_MaskPolygon(impl, x, y, size, red, green, blue, transparency, maskType, errorCallbacks);
809 }
810
811 void BlurCircle(void* impl,
812 int centerX,
813 int centerY,
814 unsigned int radius,
815 unsigned int maskType,
816 unsigned int blurType,
817 ErrorCallbacks errorCallbacks) const final
818 {
819 inno_local_Image_BlurCircle(impl, centerX, centerY, radius, maskType, blurType, errorCallbacks);
820 }
821
822 void BlurPolygon(void* impl,
823 const int* x,
824 const int* y,
825 size_t size,
826 unsigned int maskType,
827 unsigned int blurType,
828 ErrorCallbacks errorCallbacks) const final
829 {
830 inno_local_Image_BlurPolygon(impl, x, y, size, maskType, blurType, errorCallbacks);
831 }
832
833 void AddCircleToBlurMask(void* impl,
834 int centerX,
835 int centerY,
836 unsigned int radius,
837 unsigned int maskType,
838 ErrorCallbacks errorCallbacks) final
839 {
840 inno_local_Image_AddCircleToBlurMask(impl, centerX, centerY, radius, maskType, errorCallbacks);
841 }
842
843 void AddPolygonToBlurMask(void* impl,
844 const int* x,
845 const int* y,
846 size_t size,
847 unsigned int maskType,
848 ErrorCallbacks errorCallbacks) final
849 {
850 inno_local_Image_AddPolygonToBlurMask(impl, x, y, size, maskType, errorCallbacks);
851 }
852
853 void ApplyBlur(void* impl, unsigned int blurType, ErrorCallbacks errorCallbacks) final
854 {
855 inno_local_Image_ApplyBlur(impl, blurType, errorCallbacks);
856 }
857
858 void* MaskingFinished(void* impl, ErrorCallbacks errorCallbacks) const final
859 {
860 return inno_local_Image_MaskingFinished(impl, errorCallbacks);
861 }
862
863 void* CreateMasker(void* impl, ErrorCallbacks errorCallbacks) const final
864 {
865 return inno_local_Image_CreateMasker(impl, errorCallbacks);
866 }
867
868 [[nodiscard]] ImageMaskImplDestroyer DestroyMask() const final
869 {
870 return inno_local_Image_DestroyMask;
871 }
872
873 [[nodiscard]] size_t Channels(void* impl, ErrorCallbacks errorCallbacks) const final
874 {
875 return inno_local_Image_GetNumOfChannels(impl, errorCallbacks);
876 }
877
878 LocalImageExecutor() = default;
879 virtual ~LocalImageExecutor() = default;
880 LocalImageExecutor(const LocalImageExecutor&) = delete;
881 LocalImageExecutor(LocalImageExecutor&&) = delete;
882 LocalImageExecutor& operator=(const LocalImageExecutor&) = delete;
883 LocalImageExecutor& operator=(LocalImageExecutor&&) = delete;
884 };
885
886 extern "C"
887 {
888 struct inno_grcp_ImageChannel;
889 INNO_ENROLLMENT_API inno_grcp_ImageChannel* inno_grpc_Image_Channel_Create(const char* endpoint);
890 INNO_ENROLLMENT_API void inno_grpc_Image_Channel_Destroy(inno_grcp_ImageChannel* channel);
891
892 INNO_ENROLLMENT_API void* inno_grpc_Image_Create(inno_grcp_ImageChannel* channel,
893 const uint8_t* image,
894 size_t imageLength,
895 unsigned int dpi,
896 ErrorCallbacks errorCallbacks);
897 INNO_ENROLLMENT_API void* inno_grpc_Image_Create_Raw(inno_grcp_ImageChannel* channel,
898 unsigned int width,
899 unsigned int height,
900 unsigned int dpi,
901 unsigned int type,
902 const uint8_t* image,
903 ErrorCallbacks errorCallbacks);
904 INNO_ENROLLMENT_API void* inno_grpc_Image_Clone(const void* impl, ErrorCallbacks errorCallbacks);
905 INNO_ENROLLMENT_API void inno_grpc_Image_Destroy(void* impl);
906 INNO_ENROLLMENT_API uint8_t inno_grpc_Image_DeduceType(const uint8_t* data,
907 size_t length,
908 ErrorCallbacks errorCallbacks);
909 INNO_ENROLLMENT_API bool inno_grpc_Image_IsEqual(const void* left,
910 const void* right,
911 ErrorCallbacks errorCallbacks);
912 INNO_ENROLLMENT_API size_t inno_grpc_Image_RawSize(const void* impl);
913 INNO_ENROLLMENT_API void inno_grpc_Image_ToRaw(const void* impl,
914 uint8_t* data,
915 size_t size,
916 unsigned int* type,
917 ErrorCallbacks errorCallbacks);
918 INNO_ENROLLMENT_API size_t inno_grpc_Image_RawTypeSize(const void* impl,
919 unsigned int type,
920 ErrorCallbacks errorCallbacks);
921 INNO_ENROLLMENT_API void inno_grpc_Image_ToRawType(const void* impl,
922 uint8_t* data,
923 size_t size,
924 unsigned int type,
925 ErrorCallbacks errorCallbacks);
926 INNO_ENROLLMENT_API unsigned int inno_grpc_Image_Width(const void* impl);
927 INNO_ENROLLMENT_API unsigned int inno_grpc_Image_Height(const void* impl);
928 INNO_ENROLLMENT_API unsigned int inno_grpc_Image_Dpi(const void* impl);
929 INNO_ENROLLMENT_API void inno_grpc_Image_DrawLine(void* impl,
930 int startX,
931 int startY,
932 int endX,
933 int endY,
934 unsigned char red,
935 unsigned char green,
936 unsigned char blue,
937 unsigned char transparency,
938 unsigned char thickness,
939 ErrorCallbacks errorCallbacks);
940 INNO_ENROLLMENT_API void inno_grpc_Image_DrawCircle(void* impl,
941 int centerX,
942 int centerY,
943 unsigned int radius,
944 unsigned char red,
945 unsigned char green,
946 unsigned char blue,
947 unsigned char transparency,
948 unsigned char thickness,
949 ErrorCallbacks errorCallbacks);
950 INNO_ENROLLMENT_API void inno_grpc_Image_DrawingFinished(const void* impl, ErrorCallbacks errorCallbacks);
951 INNO_ENROLLMENT_API void* inno_grpc_Image_Resize(const void* impl, float factor, ErrorCallbacks errorCallbacks);
952 INNO_ENROLLMENT_API void* inno_grpc_Image_ChangeDpi(const void* impl,
953 unsigned int targetDpi,
954 ErrorCallbacks errorCallbacks);
955 INNO_ENROLLMENT_API void* inno_grpc_Image_ChangeDpiArea(const void* impl,
956 unsigned int targetDpi,
957 ErrorCallbacks errorCallbacks);
958 INNO_ENROLLMENT_API void* inno_grpc_Image_ChangeDpiNist(const void* impl,
959 unsigned int targetDpi,
960 ErrorCallbacks errorCallbacks);
961 INNO_ENROLLMENT_API void* inno_grpc_Image_ChangeDpiNistWithOptions(const void* impl,
962 unsigned int targetDpi,
963 uint8_t interpolationMethod,
964 uint8_t filterType,
965 ErrorCallbacks errorCallbacks);
966 INNO_ENROLLMENT_API void* inno_grpc_Image_GetAlignedRectangle(const void* impl,
967 int topLeftX,
968 int topLeftY,
969 int topRightX,
970 int topRightY,
971 int bottomRightX,
972 int bottomRightY,
973 int bottomLeftX,
974 int bottomLeftY,
975 float rectangleWidth,
976 float rectangleHeight,
977 unsigned int imageWidth,
978 unsigned int imageHeight,
979 unsigned char red,
980 unsigned char green,
981 unsigned char blue,
982 unsigned char transparency,
983 ErrorCallbacks errorCallbacks);
984 INNO_ENROLLMENT_API void* inno_grpc_Image_GetRectangle(const void* impl,
985 int topLeftX,
986 int topLeftY,
987 int topRightX,
988 int topRightY,
989 int bottomRightX,
990 int bottomRightY,
991 int bottomLeftX,
992 int bottomLeftY,
993 unsigned int imageWidth,
994 unsigned int imageHeight,
995 unsigned char red,
996 unsigned char green,
997 unsigned char blue,
998 unsigned char transparency,
999 ErrorCallbacks errorCallbacks);
1000 INNO_ENROLLMENT_API unsigned int inno_grpc_Image_Intersection_Rectangle(const void* impl,
1001 int topLeftX,
1002 int topLeftY,
1003 int topRightX,
1004 int topRightY,
1005 int bottomRightX,
1006 int bottomRightY,
1007 int bottomLeftX,
1008 int bottomLeftY,
1009 ErrorCallbacks errorCallbacks);
1010 INNO_ENROLLMENT_API void* inno_grpc_Image_GetCircle(const void* impl,
1011 int centerX,
1012 int centerY,
1013 unsigned int radius,
1014 unsigned char red,
1015 unsigned char green,
1016 unsigned char blue,
1017 unsigned char transparency,
1018 ErrorCallbacks errorCallbacks);
1019 INNO_ENROLLMENT_API unsigned int inno_grpc_Image_Intersection_Circle(const void* impl,
1020 int centerX,
1021 int centerY,
1022 unsigned int radius,
1023 ErrorCallbacks errorCallbacks);
1024 INNO_ENROLLMENT_API unsigned int inno_grpc_Image_Intersection_Point(const void* impl,
1025 int x,
1026 int y,
1027 ErrorCallbacks errorCallbacks);
1028 INNO_ENROLLMENT_API void inno_grpc_Image_GetRectangleDimensions(const inno_grcp_ImageChannel* channel,
1029 float* width,
1030 float* height,
1031 int topLeftX,
1032 int topLeftY,
1033 int topRightX,
1034 int topRightY,
1035 int bottomRightX,
1036 int bottomRightY,
1037 int bottomLeftX,
1038 int bottomLeftY,
1039 ErrorCallbacks errorCallbacks);
1040 INNO_ENROLLMENT_API void inno_grpc_Image_ResizeRectangle(const inno_grcp_ImageChannel* channel,
1041 float width,
1042 float height,
1043 int topLeftX,
1044 int topLeftY,
1045 int topRightX,
1046 int topRightY,
1047 int bottomRightX,
1048 int bottomRightY,
1049 int bottomLeftX,
1050 int bottomLeftY,
1051 int* newTopLeftX,
1052 int* newTopLeftY,
1053 int* newTopRightX,
1054 int* newTopRightY,
1055 int* newBottomRightX,
1056 int* newBottomRightY,
1057 int* newBottomLeftX,
1058 int* newBottomLeftY,
1059 ErrorCallbacks errorCallbacks);
1060
1061 INNO_ENROLLMENT_API void inno_grpc_Image_MaskCircle(void* impl,
1062 int centerX,
1063 int centerY,
1064 unsigned int radius,
1065 unsigned char red,
1066 unsigned char green,
1067 unsigned char blue,
1068 unsigned char transparency,
1069 unsigned int maskType,
1070 ErrorCallbacks errorCallbacks);
1071 INNO_ENROLLMENT_API void inno_grpc_Image_MaskPolygon(void* impl,
1072 const int* x,
1073 const int* y,
1074 size_t size,
1075 unsigned char red,
1076 unsigned char green,
1077 unsigned char blue,
1078 unsigned char transparency,
1079 unsigned int maskType,
1080 ErrorCallbacks errorCallbacks);
1081 INNO_ENROLLMENT_API void inno_grpc_Image_BlurCircle(void* impl,
1082 int centerX,
1083 int centerY,
1084 unsigned int radius,
1085 unsigned int maskType,
1086 unsigned int blurType,
1087 ErrorCallbacks errorCallbacks);
1088 INNO_ENROLLMENT_API void inno_grpc_Image_BlurPolygon(void* impl,
1089 const int* x,
1090 const int* y,
1091 size_t size,
1092 unsigned int maskType,
1093 unsigned int blurType,
1094 ErrorCallbacks errorCallbacks);
1095 INNO_ENROLLMENT_API void inno_grpc_Image_AddCircleToBlurMask(void* impl,
1096 int centerX,
1097 int centerY,
1098 unsigned int radius,
1099 unsigned int maskType,
1100 ErrorCallbacks errorCallbacks);
1101 INNO_ENROLLMENT_API void inno_grpc_Image_AddPolygonToBlurMask(void* impl,
1102 const int* x,
1103 const int* y,
1104 size_t size,
1105 unsigned int maskType,
1106 ErrorCallbacks errorCallbacks);
1107 INNO_ENROLLMENT_API void inno_grpc_Image_ApplyBlur(void* impl,
1108 unsigned int blurType,
1109 ErrorCallbacks errorCallbacks);
1110 INNO_ENROLLMENT_API void* inno_grpc_Image_MaskingFinished(void* impl, ErrorCallbacks errorCallbacks);
1111 INNO_ENROLLMENT_API void* inno_grpc_Image_CreateMasker(void* impl, ErrorCallbacks errorCallbacks);
1112 INNO_ENROLLMENT_API void inno_grpc_Image_DestroyMask(void* impl);
1113 INNO_ENROLLMENT_API size_t inno_grpc_Image_GetNumOfChannels(void* impl, ErrorCallbacks errorCallbacks);
1114 }
1115
1116 class GrpcImageExecutor : public ImageExecutor
1117 {
1118 public:
1119 void* Create(const uint8_t* image,
1120 size_t imageLength,
1121 unsigned int dpi,
1122 ErrorCallbacks errorCallbacks) const final
1123 {
1124 return inno_grpc_Image_Create(channel.get(), image, imageLength, dpi, errorCallbacks);
1125 }
1126
1127 void* CreateRaw(unsigned int width,
1128 unsigned int height,
1129 unsigned int dpi,
1130 unsigned int type,
1131 const uint8_t* image,
1132 ErrorCallbacks errorCallbacks) const final
1133 {
1134 return inno_grpc_Image_Create_Raw(channel.get(), width, height, dpi, type, image, errorCallbacks);
1135 }
1136 void* Clone(const void* impl, ErrorCallbacks errorCallbacks) const final
1137 {
1138 return inno_grpc_Image_Clone(impl, errorCallbacks);
1139 }
1140 [[nodiscard]] ImageImplDestroyer Destroy() const final
1141 {
1142 return inno_grpc_Image_Destroy;
1143 }
1144 uint8_t DeduceType(const uint8_t* data, size_t length, ErrorCallbacks errorCallbacks) const final
1145 {
1146 return inno_grpc_Image_DeduceType(data, length, errorCallbacks);
1147 }
1148 bool IsEqual(const void* left, const void* right, ErrorCallbacks errorCallbacks) const final
1149 {
1150 return inno_grpc_Image_IsEqual(left, right, errorCallbacks);
1151 }
1152 size_t RawSize(const void* impl) const final
1153 {
1154 return inno_grpc_Image_RawSize(impl);
1155 }
1156 void ToRaw(const void* impl,
1157 uint8_t* data,
1158 size_t size,
1159 unsigned int* type,
1160 ErrorCallbacks errorCallbacks) const final
1161 {
1162 inno_grpc_Image_ToRaw(impl, data, size, type, errorCallbacks);
1163 }
1164 size_t RawTypeSize(const void* impl, unsigned int type, ErrorCallbacks errorCallbacks) const final
1165 {
1166 return inno_grpc_Image_RawTypeSize(impl, type, errorCallbacks);
1167 }
1168 void ToRawType(const void* impl,
1169 uint8_t* data,
1170 size_t size,
1171 unsigned int type,
1172 ErrorCallbacks errorCallbacks) const final
1173 {
1174 inno_grpc_Image_ToRawType(impl, data, size, type, errorCallbacks);
1175 }
1176 unsigned int Width(const void* impl) const final
1177 {
1178 return inno_grpc_Image_Width(impl);
1179 }
1180 unsigned int Height(const void* impl) const final
1181 {
1182 return inno_grpc_Image_Height(impl);
1183 }
1184 unsigned int Dpi(const void* impl) const final
1185 {
1186 return inno_grpc_Image_Dpi(impl);
1187 }
1188 void DrawLine(void* impl,
1189 int startX,
1190 int startY,
1191 int endX,
1192 int endY,
1193 unsigned char red,
1194 unsigned char green,
1195 unsigned char blue,
1196 unsigned char transparency,
1197 unsigned char thickness,
1198 ErrorCallbacks errorCallbacks) const final
1199 {
1200 inno_grpc_Image_DrawLine(
1201 impl, startX, startY, endX, endY, red, green, blue, transparency, thickness, errorCallbacks);
1202 }
1203 void DrawCircle(void* impl,
1204 int centerX,
1205 int centerY,
1206 unsigned int radius,
1207 unsigned char red,
1208 unsigned char green,
1209 unsigned char blue,
1210 unsigned char transparency,
1211 unsigned char thickness,
1212 ErrorCallbacks errorCallbacks) const final
1213 {
1214 inno_grpc_Image_DrawCircle(
1215 impl, centerX, centerY, radius, red, green, blue, transparency, thickness, errorCallbacks);
1216 }
1217 void DrawingFinished(const void* impl, ErrorCallbacks errorCallbacks) const final
1218 {
1219 inno_grpc_Image_DrawingFinished(impl, errorCallbacks);
1220 }
1221
1222 void* Resize(const void* impl, float factor, ErrorCallbacks errorCallbacks) const final
1223 {
1224 return inno_grpc_Image_Resize(impl, factor, errorCallbacks);
1225 }
1226
1227 void* ChangeDpi(const void* impl, unsigned int targetDpi, ErrorCallbacks errorCallbacks) const final
1228 {
1229 return inno_grpc_Image_ChangeDpi(impl, targetDpi, errorCallbacks);
1230 }
1231
1232 void* ChangeDpiArea(const void* impl, unsigned int targetDpi, ErrorCallbacks errorCallbacks) const final
1233 {
1234 return inno_grpc_Image_ChangeDpiArea(impl, targetDpi, errorCallbacks);
1235 }
1236
1237 void* ChangeDpiNist(const void* impl, unsigned int targetDpi, ErrorCallbacks errorCallbacks) const final
1238 {
1239 return inno_grpc_Image_ChangeDpiNist(impl, targetDpi, errorCallbacks);
1240 }
1241
1242 void* ChangeDpiNistWithOptions(const void* impl,
1243 unsigned int targetDpi,
1244 uint8_t interpolationMethod,
1245 uint8_t filterType,
1246 ErrorCallbacks errorCallbacks) const final
1247 {
1248 return inno_grpc_Image_ChangeDpiNistWithOptions(
1249 impl, targetDpi, interpolationMethod, filterType, errorCallbacks);
1250 }
1251
1252 void* CropAlignedRectangle(const void* impl,
1253 int topLeftX,
1254 int topLeftY,
1255 int topRightX,
1256 int topRightY,
1257 int bottomRightX,
1258 int bottomRightY,
1259 int bottomLeftX,
1260 int bottomLeftY,
1261 float rectangleWidth,
1262 float rectangleHeight,
1263 unsigned int imageWidth,
1264 unsigned int imageHeight,
1265 unsigned char red,
1266 unsigned char green,
1267 unsigned char blue,
1268 unsigned char transparency,
1269 ErrorCallbacks errorCallbacks) const final
1270 {
1271 return inno_grpc_Image_GetAlignedRectangle(impl,
1272 topLeftX,
1273 topLeftY,
1274 topRightX,
1275 topRightY,
1276 bottomRightX,
1277 bottomRightY,
1278 bottomLeftX,
1279 bottomLeftY,
1280 rectangleWidth,
1281 rectangleHeight,
1282 imageWidth,
1283 imageHeight,
1284 red,
1285 green,
1286 blue,
1287 transparency,
1288 errorCallbacks);
1289 }
1290
1291 void* CropRectangle(const void* impl,
1292 int topLeftX,
1293 int topLeftY,
1294 int topRightX,
1295 int topRightY,
1296 int bottomRightX,
1297 int bottomRightY,
1298 int bottomLeftX,
1299 int bottomLeftY,
1300 unsigned int imageWidth,
1301 unsigned int imageHeight,
1302 unsigned char red,
1303 unsigned char green,
1304 unsigned char blue,
1305 unsigned char transparency,
1306 ErrorCallbacks errorCallbacks) const final
1307 {
1308 return inno_grpc_Image_GetRectangle(impl,
1309 topLeftX,
1310 topLeftY,
1311 topRightX,
1312 topRightY,
1313 bottomRightX,
1314 bottomRightY,
1315 bottomLeftX,
1316 bottomLeftY,
1317 imageWidth,
1318 imageHeight,
1319 red,
1320 green,
1321 blue,
1322 transparency,
1323 errorCallbacks);
1324 }
1325 unsigned int IntersectionRectangle(const void* impl,
1326 int topLeftX,
1327 int topLeftY,
1328 int topRightX,
1329 int topRightY,
1330 int bottomRightX,
1331 int bottomRightY,
1332 int bottomLeftX,
1333 int bottomLeftY,
1334 ErrorCallbacks errorCallbacks) const final
1335 {
1336 return inno_grpc_Image_Intersection_Rectangle(impl,
1337 topLeftX,
1338 topLeftY,
1339 topRightX,
1340 topRightY,
1341 bottomRightX,
1342 bottomRightY,
1343 bottomLeftX,
1344 bottomLeftY,
1345 errorCallbacks);
1346 }
1347 void* CropCircle(const void* impl,
1348 int centerX,
1349 int centerY,
1350 unsigned int radius,
1351 unsigned char red,
1352 unsigned char green,
1353 unsigned char blue,
1354 unsigned char transparency,
1355 ErrorCallbacks errorCallbacks) const final
1356 {
1357 return inno_grpc_Image_GetCircle(
1358 impl, centerX, centerY, radius, red, green, blue, transparency, errorCallbacks);
1359 }
1360 unsigned int IntersectionCircle(const void* impl,
1361 int centerX,
1362 int centerY,
1363 unsigned int radius,
1364 ErrorCallbacks errorCallbacks) const final
1365 {
1366 return inno_grpc_Image_Intersection_Circle(impl, centerX, centerY, radius, errorCallbacks);
1367 }
1368 unsigned int IntersectionPoint(const void* impl, int x, int y, ErrorCallbacks errorCallbacks) const final
1369 {
1370 return inno_grpc_Image_Intersection_Point(impl, x, y, errorCallbacks);
1371 }
1372
1373 void GetRectangleDimensions(float* width,
1374 float* height,
1375 int topLeftX,
1376 int topLeftY,
1377 int topRightX,
1378 int topRightY,
1379 int bottomRightX,
1380 int bottomRightY,
1381 int bottomLeftX,
1382 int bottomLeftY,
1383 ErrorCallbacks errorCallbacks) const final
1384 {
1385 inno_grpc_Image_GetRectangleDimensions(channel.get(),
1386 width,
1387 height,
1388 topLeftX,
1389 topLeftY,
1390 topRightX,
1391 topRightY,
1392 bottomRightX,
1393 bottomRightY,
1394 bottomLeftX,
1395 bottomLeftY,
1396 errorCallbacks);
1397 }
1398
1399 void ResizeRectangle(float width,
1400 float height,
1401 int topLeftX,
1402 int topLeftY,
1403 int topRightX,
1404 int topRightY,
1405 int bottomRightX,
1406 int bottomRightY,
1407 int bottomLeftX,
1408 int bottomLeftY,
1409 int* newTopLeftX,
1410 int* newTopLeftY,
1411 int* newTopRightX,
1412 int* newTopRightY,
1413 int* newBottomRightX,
1414 int* newBottomRightY,
1415 int* newBottomLeftX,
1416 int* newBottomLeftY,
1417 ErrorCallbacks errorCallbacks) const final
1418 {
1419 inno_grpc_Image_ResizeRectangle(channel.get(),
1420 width,
1421 height,
1422 topLeftX,
1423 topLeftY,
1424 topRightX,
1425 topRightY,
1426 bottomRightX,
1427 bottomRightY,
1428 bottomLeftX,
1429 bottomLeftY,
1430 newTopLeftX,
1431 newTopLeftY,
1432 newTopRightX,
1433 newTopRightY,
1434 newBottomRightX,
1435 newBottomRightY,
1436 newBottomLeftX,
1437 newBottomLeftY,
1438 errorCallbacks);
1439 }
1440
1441 void MaskCircle(void* impl,
1442 int centerX,
1443 int centerY,
1444 unsigned int radius,
1445 unsigned char red,
1446 unsigned char green,
1447 unsigned char blue,
1448 unsigned char transparency,
1449 unsigned int maskType,
1450 ErrorCallbacks errorCallbacks) const final
1451 {
1452 inno_grpc_Image_MaskCircle(
1453 impl, centerX, centerY, radius, red, green, blue, transparency, maskType, errorCallbacks);
1454 }
1455
1456 void MaskPolygon(void* impl,
1457 const int* x,
1458 const int* y,
1459 size_t size,
1460 unsigned char red,
1461 unsigned char green,
1462 unsigned char blue,
1463 unsigned char transparency,
1464 unsigned int maskType,
1465 ErrorCallbacks errorCallbacks) const final
1466 {
1467 inno_grpc_Image_MaskPolygon(impl, x, y, size, red, green, blue, transparency, maskType, errorCallbacks);
1468 }
1469
1470 void BlurCircle(void* impl,
1471 int centerX,
1472 int centerY,
1473 unsigned int radius,
1474 unsigned int maskType,
1475 unsigned int blurType,
1476 ErrorCallbacks errorCallbacks) const final
1477 {
1478 inno_grpc_Image_BlurCircle(impl, centerX, centerY, radius, maskType, blurType, errorCallbacks);
1479 }
1480
1481 void BlurPolygon(void* impl,
1482 const int* x,
1483 const int* y,
1484 size_t size,
1485 unsigned int maskType,
1486 unsigned int blurType,
1487 ErrorCallbacks errorCallbacks) const final
1488 {
1489 inno_grpc_Image_BlurPolygon(impl, x, y, size, maskType, blurType, errorCallbacks);
1490 }
1491
1492 void AddCircleToBlurMask(void* impl,
1493 int centerX,
1494 int centerY,
1495 unsigned int radius,
1496 unsigned int maskType,
1497 ErrorCallbacks errorCallbacks) final
1498 {
1499 inno_grpc_Image_AddCircleToBlurMask(impl, centerX, centerY, radius, maskType, errorCallbacks);
1500 }
1501
1502 void AddPolygonToBlurMask(void* impl,
1503 const int* x,
1504 const int* y,
1505 size_t size,
1506 unsigned int maskType,
1507 ErrorCallbacks errorCallbacks) final
1508 {
1509 inno_grpc_Image_AddPolygonToBlurMask(impl, x, y, size, maskType, errorCallbacks);
1510 }
1511
1512 void ApplyBlur(void* impl, unsigned int blurType, ErrorCallbacks errorCallbacks) final
1513 {
1514 inno_grpc_Image_ApplyBlur(impl, blurType, errorCallbacks);
1515 }
1516
1517 void* MaskingFinished(void* impl, ErrorCallbacks errorCallbacks) const final
1518 {
1519 return inno_grpc_Image_MaskingFinished(impl, errorCallbacks);
1520 }
1521
1522 void* CreateMasker(void* impl, ErrorCallbacks errorCallbacks) const final
1523 {
1524 return inno_grpc_Image_CreateMasker(impl, errorCallbacks);
1525 }
1526
1527 [[nodiscard]] ImageMaskImplDestroyer DestroyMask() const final
1528 {
1529 return inno_grpc_Image_DestroyMask;
1530 }
1531
1532 [[nodiscard]] size_t Channels(void* impl, ErrorCallbacks errorCallbacks) const final
1533 {
1534 return inno_grpc_Image_GetNumOfChannels(impl, errorCallbacks);
1535 }
1536
1542 explicit GrpcImageExecutor(const std::string& endPoint)
1543 : channel(inno_grpc_Image_Channel_Create(endPoint.c_str()), inno_grpc_Image_Channel_Destroy)
1544 {
1545 }
1546
1547 GrpcImageExecutor() = delete;
1548 virtual ~GrpcImageExecutor() = default;
1549 GrpcImageExecutor(const GrpcImageExecutor&) = delete;
1550 GrpcImageExecutor(GrpcImageExecutor&&) = delete;
1551 GrpcImageExecutor& operator=(const GrpcImageExecutor&) = delete;
1552 GrpcImageExecutor& operator=(GrpcImageExecutor&&) = delete;
1553
1554 private:
1555 std::unique_ptr<inno_grcp_ImageChannel, void (*)(inno_grcp_ImageChannel*)> channel;
1556 };
1557
1564 class GlobalImageExecutor
1565 {
1566 public:
1571 static std::shared_ptr<ImageExecutor> Get()
1572 {
1573 return GlobalImageExecutor::Instance().GetInternal();
1574 }
1575
1581 static void Set(std::shared_ptr<ImageExecutor> executor)
1582 {
1583 if (executor == nullptr)
1584 {
1585 throw NullArgumentException("executor can not be null");
1586 }
1587
1588 GlobalImageExecutor::Instance().SetInternal(std::move(executor));
1589 }
1590
1591 GlobalImageExecutor() = delete;
1592 virtual ~GlobalImageExecutor() = default;
1595 GlobalImageExecutor& operator=(const GlobalImageExecutor&) = delete;
1596 GlobalImageExecutor& operator=(GlobalImageExecutor&&) = delete;
1597
1598 private:
1599 std::shared_ptr<ImageExecutor> pe;
1600 std::mutex peMux;
1601
1602 static GlobalImageExecutor& Instance()
1603 {
1604 static GlobalImageExecutor e(std::make_shared<LocalImageExecutor>());
1605 return e;
1606 }
1607
1608 std::shared_ptr<ImageExecutor> GetInternal()
1609 {
1610 const std::scoped_lock lock(peMux);
1611 return pe;
1612 }
1613
1614 void SetInternal(std::shared_ptr<ImageExecutor> executor)
1615 {
1616 const std::scoped_lock lock(peMux);
1617 pe = std::move(executor);
1618 }
1619
1620 explicit GlobalImageExecutor(std::shared_ptr<ImageExecutor> e)
1621 : pe(std::move(e))
1622 {
1623 }
1624 };
1625} // namespace inno
Holds instance of ImageExecutor.
Definition ImageExecutor.h:1564
static std::shared_ptr< ImageExecutor > Get()
Provides current executor.
Definition ImageExecutor.h:1570
static void Set(std::shared_ptr< ImageExecutor > executor)
Sets new global executor.
Definition ImageExecutor.h:1580
Null argument is not allowed.
Definition EnrollmentException.h:156