]> git.mxchange.org Git - simgear.git/blobdiff - simgear/canvas/elements/CanvasImage.hxx
CanvasImage: improve fetching from http and add mime detection.
[simgear.git] / simgear / canvas / elements / CanvasImage.hxx
index 3b8dca7884aa401e4145f7c67750a31413fa6303..c9e3c081289f5ced3c7f8853ad276833e5074dde 100644 (file)
@@ -27,6 +27,7 @@
 
 namespace simgear
 {
+namespace HTTP { class Request; }
 namespace canvas
 {
 
@@ -34,6 +35,9 @@ namespace canvas
     public Element
   {
     public:
+      static const std::string TYPE_NAME;
+      static void staticInit();
+
       /**
        * @param node    Property node containing settings for this image:
        *                  rect/[left/right/top/bottom]  Dimensions of source
@@ -43,7 +47,7 @@ namespace canvas
        */
       Image( const CanvasWeakPtr& canvas,
              const SGPropertyNode_ptr& node,
-             const Style& parent_style,
+             const Style& parent_style = Style(),
              Element* parent = 0 );
       virtual ~Image();
 
@@ -100,6 +104,12 @@ namespace canvas
       void setQuad(size_t index, const SGVec2f& tl, const SGVec2f& br);
       void setQuadUV(size_t index, const SGVec2f& tl, const SGVec2f& br);
 
+      void handleImageLoadDone(HTTP::Request*);
+      bool loadImage( osgDB::ReaderWriter& reader,
+                      const std::string& data,
+                      HTTP::Request& request,
+                      const std::string& type );
+
       osg::ref_ptr<osg::Texture2D> _texture;
       // TODO optionally forward events to canvas
       CanvasWeakPtr _src_canvas;