Annotation of parser3/src/types/pa_vimage.h, revision 1.18

1.9       paf         1: /** @file
1.1       paf         2:        Parser: @b image parser type decl.
                      3: 
                      4:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
                      5:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
                      6: 
1.18    ! parser      7:        $Id: pa_vimage.h,v 1.17 2001/09/24 15:00:35 parser Exp $
1.1       paf         8: */
                      9: 
                     10: #ifndef PA_VIMAGE_H
                     11: #define PA_VIMAGE_H
                     12: 
1.12      paf        13: #include "classes.h"
1.1       paf        14: #include "pa_common.h"
                     15: #include "pa_vstateless_object.h"
                     16: 
1.7       paf        17: class gdImage; class Font;
1.10      paf        18: 
                     19: extern Methoded *image_class;
1.7       paf        20: 
1.8       paf        21: /** holds img attributes 
1.1       paf        22:        and [image itself]
                     23: */
                     24: class VImage : public VStateless_object {
                     25: public: // Value
                     26:        
                     27:        const char *type() const { return "image"; }
                     28: 
                     29:        /// VImage: true
1.17      parser     30:        bool as_bool() const { return true; }
1.1       paf        31: 
                     32:        /// VImage: method,field
                     33:        Value *VImage::get_element(const String& aname) {
                     34:                // $method
                     35:                if(Value *result=VStateless_object::get_element(aname))
                     36:                        return result;
                     37: 
                     38:                // $src, $size
                     39:                return static_cast<Value *>(ffields.get(aname));
                     40:        }
1.15      parser     41: 
                     42:        /// VImage: field
                     43:        void put_element(const String& aname, Value *avalue);
1.1       paf        44: 
                     45: protected: // VAliased
                     46: 
                     47:        /// disable .CLASS element. @see VAliased::get_element
                     48:        bool hide_class() { return true; }
                     49: 
                     50: public: // usage
                     51: 
                     52:        VImage::VImage(Pool& apool) : VStateless_object(apool, *image_class),
1.7       paf        53:                ffields(apool),
                     54:                image(0), font(0) {
1.1       paf        55:        }
                     56: 
1.3       paf        57:        void set(const String *src, int width, int height,
1.6       paf        58:                gdImage *aimage=0);
1.1       paf        59:        void save(const String& image_spec) {
                     60:                /*if(fvalue_ptr)
                     61:                        image_write(pool(), image_spec, fvalue_ptr, fvalue_size, false);
                     62:                else
                     63:                        THROW(0, 0,
                     64:                                &image_spec,
                     65:                                "saving unassigned image"); //never*/
                     66:        }
                     67: 
                     68:        Hash fields() const { return ffields; }
1.3       paf        69: 
                     70: public:
                     71: 
1.7       paf        72:        gdImage *image; Font *font;
1.1       paf        73: 
                     74: private:
                     75: 
                     76:        Hash ffields;
                     77: 
                     78: };
                     79: 
                     80: #endif

E-mail: