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
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
00046
00047 #if OGRE_VERSION < ((1 << 16) | (9 << 8) | 0)
00048 #include <OGRE/OgrePanelOverlayElement.h>
00049 #include <OGRE/OgreOverlayElement.h>
00050 #include <OGRE/OgreOverlayContainer.h>
00051 #include <OGRE/OgreOverlayManager.h>
00052 #else
00053 #include <OGRE/Overlay/OgrePanelOverlayElement.h>
00054 #include <OGRE/Overlay/OgreOverlayElement.h>
00055 #include <OGRE/Overlay/OgreOverlayContainer.h>
00056 #include <OGRE/Overlay/OgreOverlayManager.h>
00057 #endif
00058
00059 #include <QImage>
00060 #include <QColor>
00061
00062 namespace jsk_rviz_plugins
00063 {
00064 class OverlayObject;
00065
00066 class ScopedPixelBuffer
00067 {
00068 public:
00069 ScopedPixelBuffer(Ogre::HardwarePixelBufferSharedPtr pixel_buffer);
00070 virtual ~ScopedPixelBuffer();
00071 virtual Ogre::HardwarePixelBufferSharedPtr getPixelBuffer();
00072 virtual QImage getQImage(unsigned int width, unsigned int height);
00073 virtual QImage getQImage(OverlayObject& overlay);
00074 virtual QImage getQImage(unsigned int width, unsigned int height, QColor& bg_color);
00075 virtual QImage getQImage(OverlayObject& overlay, QColor& bg_color);
00076 protected:
00077 Ogre::HardwarePixelBufferSharedPtr pixel_buffer_;
00078 private:
00079
00080 };
00081
00082
00083
00084
00085
00086 class OverlayObject
00087 {
00088 public:
00089 typedef std::shared_ptr<OverlayObject> Ptr;
00090
00091 OverlayObject(const std::string& name);
00092 virtual ~OverlayObject();
00093
00094 virtual std::string getName();
00095 virtual void hide();
00096 virtual void show();
00097 virtual bool isTextureReady();
00098 virtual bool updateTextureSize(unsigned int width, unsigned int height);
00099 virtual ScopedPixelBuffer getBuffer();
00100 virtual void setPosition(double left, double top);
00101 virtual void setDimensions(double width, double height);
00102 virtual bool isVisible();
00103 virtual unsigned int getTextureWidth();
00104 virtual unsigned int getTextureHeight();
00105 protected:
00106 const std::string name_;
00107 Ogre::Overlay* overlay_;
00108 Ogre::PanelOverlayElement* panel_;
00109 Ogre::MaterialPtr panel_material_;
00110 Ogre::TexturePtr texture_;
00111
00112 private:
00113
00114 };
00115
00116
00117
00118
00119 }
00120
00121 #endif