Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef JSK_RVIZ_PLUGIN_OVERLAY_UTIL_H_
00037 #define JSK_RVIZ_PLUGIN_OVERLAY_UTIL_H_
00038
00039 #include <OGRE/OgreOverlayManager.h>
00040 #include <OGRE/OgreMaterialManager.h>
00041 #include <OGRE/OgreTextureManager.h>
00042 #include <OGRE/OgreTexture.h>
00043 #include <OGRE/OgreTechnique.h>
00044 #include <OGRE/OgreHardwarePixelBuffer.h>
00045 #include <OGRE/OgrePanelOverlayElement.h>
00046 #include <OGRE/OgreOverlayElement.h>
00047 #include <OGRE/OgreOverlayContainer.h>
00048
00049 #include <QImage>
00050 #include <QColor>
00051
00052 namespace jsk_rviz_plugin
00053 {
00054 class OverlayObject;
00055
00056 class ScopedPixelBuffer
00057 {
00058 public:
00059 ScopedPixelBuffer(Ogre::HardwarePixelBufferSharedPtr pixel_buffer);
00060 virtual ~ScopedPixelBuffer();
00061 virtual Ogre::HardwarePixelBufferSharedPtr getPixelBuffer();
00062 virtual QImage getQImage(unsigned int width, unsigned int height);
00063 virtual QImage getQImage(OverlayObject& overlay);
00064 virtual QImage getQImage(unsigned int width, unsigned int height, QColor& bg_color);
00065 virtual QImage getQImage(OverlayObject& overlay, QColor& bg_color);
00066 protected:
00067 Ogre::HardwarePixelBufferSharedPtr pixel_buffer_;
00068 private:
00069
00070 };
00071
00072
00073
00074
00075
00076 class OverlayObject
00077 {
00078 public:
00079 typedef boost::shared_ptr<OverlayObject> Ptr;
00080
00081 OverlayObject(const std::string& name);
00082 virtual ~OverlayObject();
00083
00084 virtual std::string getName();
00085 virtual void hide();
00086 virtual void show();
00087 virtual bool isTextureReady();
00088 virtual bool updateTextureSize(unsigned int width, unsigned int height);
00089 virtual ScopedPixelBuffer getBuffer();
00090 virtual void setPosition(double left, double top);
00091 virtual void setDimensions(double width, double height);
00092 virtual bool isVisible();
00093 virtual unsigned int getTextureWidth();
00094 virtual unsigned int getTextureHeight();
00095 protected:
00096 const std::string name_;
00097 Ogre::Overlay* overlay_;
00098 Ogre::PanelOverlayElement* panel_;
00099 Ogre::MaterialPtr panel_material_;
00100 Ogre::TexturePtr texture_;
00101
00102 private:
00103
00104 };
00105
00106
00107
00108
00109 }
00110
00111 #endif