Turn audio into a shareable video. forked from nypublicradio/audiogram

ImageData.h 834B

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // ImageData.h
  3. //
  4. // Copyright (c) 2010 LearnBoost <tj@learnboost.com>
  5. //
  6. #ifndef __NODE_IMAGE_DATA_H__
  7. #define __NODE_IMAGE_DATA_H__
  8. #include "Canvas.h"
  9. #include <stdlib.h>
  10. #include <v8.h>
  11. class ImageData: public Nan::ObjectWrap {
  12. public:
  13. static Nan::Persistent<FunctionTemplate> constructor;
  14. static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target);
  15. static NAN_METHOD(New);
  16. static NAN_GETTER(GetWidth);
  17. static NAN_GETTER(GetHeight);
  18. inline int width() { return _width; }
  19. inline int height() { return _height; }
  20. inline uint8_t *data() { return _data; }
  21. inline int stride() { return _width * 4; }
  22. ImageData(uint8_t *data, int width, int height) : _width(width), _height(height), _data(data) {}
  23. private:
  24. int _width;
  25. int _height;
  26. uint8_t *_data;
  27. };
  28. #endif