stacker.cpp 1.1 KB

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