stacker.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #include <stdlib.h>
  2. #include "stacker.h"
  3. #include "stackercpp.h"
  4. stacker_t *
  5. stacker_create()
  6. {
  7. stacker_t *st;
  8. Stacker *obj;
  9. st = (__typeof__(st)) malloc(sizeof(*st));
  10. obj = new Stacker();
  11. st->obj = obj;
  12. return st;
  13. }
  14. void
  15. stacker_add_image(stacker_t *st, unsigned char *data, int width, int height)
  16. {
  17. Stacker *obj;
  18. if (st == NULL) {
  19. return;
  20. }
  21. obj = static_cast<Stacker * >(st->obj);
  22. obj->add_frame(data, width, height);
  23. }
  24. char *
  25. stacker_get_result(stacker_t *st)
  26. {
  27. Stacker *obj;
  28. if (st == NULL) {
  29. return NULL;
  30. }
  31. obj = static_cast<Stacker * >(st->obj);
  32. return obj->get_result();
  33. }
  34. char *
  35. stacker_postprocess(stacker_t *st, unsigned char *data, int width, int height)
  36. {
  37. Stacker *obj;
  38. if (st == NULL) {
  39. return NULL;
  40. }
  41. obj = static_cast<Stacker * >(st->obj);
  42. return obj->postprocess(data, width, height);
  43. }
  44. int
  45. stacker_get_width(stacker_t *st)
  46. {
  47. Stacker *obj;
  48. obj = static_cast<Stacker * >(st->obj);
  49. return obj->get_width();
  50. }
  51. int
  52. stacker_get_height(stacker_t *st)
  53. {
  54. Stacker *obj;
  55. obj = static_cast<Stacker * >(st->obj);
  56. return obj->get_height();
  57. }