/src/nuke/OCIOLogConvert/OCIOLogConvert.h

http://github.com/imageworks/OpenColorIO · C Header · 101 lines · 33 code · 23 blank · 45 comment · 0 complexity · 19597fb7df98a3e8158f01f25365afb9 MD5 · raw file

  1. #ifndef INCLUDED_OCIO_NUKE_LOGCONVERT_H_
  2. #define INCLUDED_OCIO_NUKE_LOGCONVERT_H_
  3. // Include these early, for Nuke's headers under gcc 4.4.2.
  4. #include <memory>
  5. #include <cstdarg>
  6. #include <DDImage/PixelIop.h>
  7. #include <DDImage/Row.h>
  8. #include <DDImage/Knob.h>
  9. #include <OpenColorIO/OpenColorIO.h>
  10. namespace OCIO = OCIO_NAMESPACE;
  11. /*!
  12. * Iop that uses OpenColorIO to perform colorspace conversions
  13. */
  14. class OCIOLogConvert : public DD::Image::PixelIop {
  15. protected:
  16. int modeindex;
  17. OCIO::ConstProcessorRcPtr processor;
  18. public:
  19. static const char* modes[];
  20. OCIOLogConvert(Node *node);
  21. virtual ~OCIOLogConvert();
  22. static const DD::Image::Op::Description description;
  23. /*! Return the command name that will be stored in Nuke scripts. */
  24. virtual const char *Class() const;
  25. /*!
  26. * Return a name for this class that will be shown to the user. The
  27. * default implementation returns Class(). You can return a different
  28. * (ie more user-friendly) name instead here, and there is no need for
  29. * this to be unique.
  30. *
  31. * Nuke currently will remove any trailing digits and underscores from
  32. * this and add a new number to make a unique name for the new node.
  33. *
  34. * \return "OCIOLogConvert"
  35. */
  36. virtual const char *displayName() const;
  37. /*!
  38. * Return help information for this node. This information is in the
  39. * pop-up window that the user gets when they hit the [?] button in
  40. * the lower-left corner of the control panel.
  41. */
  42. virtual const char *node_help() const;
  43. /*!
  44. * Define the knobs that will be presented in the control panel.
  45. */
  46. virtual void knobs(DD::Image::Knob_Callback f);
  47. /*!
  48. * Specify the channels required from input n to produce the channels
  49. * in mask by modifying mask in-place. (At least one channel in the
  50. * input is assumed.)
  51. *
  52. * Since OCIOLogConvert conversions can have channel cross-talk, any rgb
  53. * output channel requires all its rgb bretheren. (Non-rgb
  54. * are passed through.)
  55. */
  56. virtual void in_channels(int n, DD::Image::ChannelSet& mask) const;
  57. /*!
  58. * Calculate the output pixel data.
  59. * \param rowY vertical line number
  60. * \param rowX inclusive left bound
  61. * \param rowXBound exclusive right bound
  62. * \param outputChannels a subset of out_channels(), the required channels to be produced
  63. */
  64. virtual void pixel_engine(
  65. const DD::Image::Row& in,
  66. int rowY, int rowX, int rowXBound,
  67. DD::Image::ChannelMask outputChannels,
  68. DD::Image::Row& out);
  69. protected:
  70. /*!
  71. * Check that colorspaces are available, and that the transform
  72. * is not a noop. (As OCIO whether a given transform is a noop, since it
  73. * can do more analysis than just name matching.)
  74. */
  75. virtual void _validate(bool for_real);
  76. };
  77. static DD::Image::Op* build(Node *node);
  78. #endif // INCLUDED_OCIO_NUKE_LOGCONVERT_H_