BsScriptPixelData.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsScriptEnginePrerequisites.h"
  5. #include "BsScriptObject.h"
  6. #include "BsPixelData.h"
  7. #include "BsColor.h"
  8. namespace BansheeEngine
  9. {
  10. /**
  11. * @brief Interop class between C++ & CLR for PixelData.
  12. */
  13. class BS_SCR_BE_EXPORT ScriptPixelData : public ScriptObject <ScriptPixelData>
  14. {
  15. public:
  16. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "PixelData")
  17. /**
  18. * @brief Returns the internal wrapped pixel data.
  19. */
  20. PixelDataPtr getInternalValue() const { return mPixelData; }
  21. /**
  22. * @brief Creates a new managed pixel data instance that wraps
  23. * the provided native pixel data instance.
  24. */
  25. static MonoObject* create(const PixelDataPtr& pixelData);
  26. private:
  27. ScriptPixelData(MonoObject* managedInstance);
  28. ~ScriptPixelData();
  29. /**
  30. * @brief Initializes the object. Must be called after construction
  31. * and before use.
  32. */
  33. void initialize(const PixelDataPtr& pixelData);
  34. /**
  35. * @brief Checks is the underlying pixel data of the provided object locked.
  36. * When locked pixel data cannot be accessed.
  37. */
  38. static bool checkIsLocked(ScriptPixelData* thisPtr);
  39. PixelDataPtr mPixelData;
  40. /************************************************************************/
  41. /* CLR HOOKS */
  42. /************************************************************************/
  43. static void internal_createInstance(MonoObject* instance, PixelVolume* volume, PixelFormat format);
  44. static void internal_getPixel(ScriptPixelData* thisPtr, int x, int y, int z, Color* value);
  45. static void internal_setPixel(ScriptPixelData* thisPtr, int x, int y, int z, Color* value);
  46. static void internal_getPixels(ScriptPixelData* thisPtr, MonoArray** value);
  47. static void internal_setPixels(ScriptPixelData* thisPtr, MonoArray* value);
  48. static void internal_getRawPixels(ScriptPixelData* thisPtr, MonoArray** value);
  49. static void internal_setRawPixels(ScriptPixelData* thisPtr, MonoArray* value);
  50. static void internal_getExtents(ScriptPixelData* thisPtr, PixelVolume* value);
  51. static void internal_getFormat(ScriptPixelData* thisPtr, PixelFormat* value);
  52. static void internal_getRowPitch(ScriptPixelData* thisPtr, int* value);
  53. static void internal_getSlicePitch(ScriptPixelData* thisPtr, int* value);
  54. static void internal_getSize(ScriptPixelData* thisPtr, int* value);
  55. static void internal_getIsConsecutive(ScriptPixelData* thisPtr, bool* value);
  56. };
  57. }