BsScriptPixelData.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 bs
  9. {
  10. /** @addtogroup ScriptInteropEngine
  11. * @{
  12. */
  13. /** Interop class between C++ & CLR for PixelData. */
  14. class BS_SCR_BE_EXPORT ScriptPixelData : public ScriptObject <ScriptPixelData>
  15. {
  16. public:
  17. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "PixelData")
  18. /** Returns the internal wrapped pixel data. */
  19. SPtr<PixelData> getInternalValue() const { return mPixelData; }
  20. /** Creates a new managed pixel data instance that wraps the provided native pixel data instance. */
  21. static MonoObject* create(const SPtr<PixelData>& pixelData);
  22. private:
  23. ScriptPixelData(MonoObject* managedInstance);
  24. ~ScriptPixelData();
  25. /** Initializes the object. Must be called after construction and before use. */
  26. void initialize(const SPtr<PixelData>& pixelData);
  27. /** Checks is the underlying pixel data of the provided object locked. When locked pixel data cannot be accessed. */
  28. static bool checkIsLocked(ScriptPixelData* thisPtr);
  29. SPtr<PixelData> mPixelData;
  30. /************************************************************************/
  31. /* CLR HOOKS */
  32. /************************************************************************/
  33. static void internal_createInstance(MonoObject* instance, PixelVolume* volume, PixelFormat format);
  34. static void internal_getPixel(ScriptPixelData* thisPtr, int x, int y, int z, Color* value);
  35. static void internal_setPixel(ScriptPixelData* thisPtr, int x, int y, int z, Color* value);
  36. static void internal_getPixels(ScriptPixelData* thisPtr, MonoArray** value);
  37. static void internal_setPixels(ScriptPixelData* thisPtr, MonoArray* value);
  38. static void internal_getRawPixels(ScriptPixelData* thisPtr, MonoArray** value);
  39. static void internal_setRawPixels(ScriptPixelData* thisPtr, MonoArray* value);
  40. static void internal_getExtents(ScriptPixelData* thisPtr, PixelVolume* value);
  41. static void internal_getFormat(ScriptPixelData* thisPtr, PixelFormat* value);
  42. static void internal_getRowPitch(ScriptPixelData* thisPtr, int* value);
  43. static void internal_getSlicePitch(ScriptPixelData* thisPtr, int* value);
  44. static void internal_getSize(ScriptPixelData* thisPtr, int* value);
  45. static void internal_getIsConsecutive(ScriptPixelData* thisPtr, bool* value);
  46. };
  47. /** @} */
  48. }