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

1.9       paf         1: /** @file
1.1       paf         2:        Parser: @b image parser type decl.
                      3: 
1.34.2.3  paf         4:        Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com)
1.24      paf         5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1       paf         6: */
                      7: 
                      8: #ifndef PA_VIMAGE_H
                      9: #define PA_VIMAGE_H
1.26      paf        10: 
1.34.2.8.2.4! paf        11: static const char* IDENT_VIMAGE_H="$Date: 2003/03/21 14:27:53 $";
1.1       paf        12: 
1.12      paf        13: #include "classes.h"
1.1       paf        14: #include "pa_common.h"
                     15: #include "pa_vstateless_object.h"
                     16: 
1.20      parser     17: // defines
                     18: 
                     19: #define VIMAGE_TYPE "image"
1.33      paf        20: #define EXIF_ELEMENT_NAME "exif"
1.20      parser     21: 
                     22: // forwards
                     23: 
1.34.2.8.2.3  paf        24: class gdImage;
1.34.2.8  paf        25: 
                     26: /// simple gdImage-based font storage & text output 
                     27: class Font: public PA_Object {
                     28: public:
                     29:        
                     30:        const static int letter_spacing;
                     31:        int height;         ///< Font heigth
                     32:        int monospace;      ///< Default char width
                     33:        int spacebarspace; ///< spacebar width
1.34.2.8.2.2  paf        34:        gdImage* ifont;
1.34.2.8.2.1  paf        35:        const String& alphabet;
1.34.2.8  paf        36:        
1.34.2.8.2.1  paf        37:        Font(//
                     38:                const String& aalphabet, 
1.34.2.8.2.2  paf        39:                gdImage* aifont, int aheight, int amonospace, int aspacebarspace);
1.34.2.8  paf        40: 
                     41:        //@{******************************** char **********************************    
                     42:        int index_of(char ch);
                     43:        int index_width(int index);
1.34.2.8.2.2  paf        44:        void index_display(gdImage* image, int x, int y, int index);
1.34.2.8  paf        45:        //@}
                     46:        //@{******************************* string *********************************
                     47:        int step_width(int index);
                     48:        //@}
                     49:        /// counts trailing letter_spacing, consider this OK. useful for contiuations
1.34.2.8.2.1  paf        50:        int string_width(const String& s);
1.34.2.8.2.2  paf        51:        void string_display(gdImage* image, int x, int y, const String& s);     
1.34.2.8  paf        52: };
                     53: DECLARE_OBJECT_PTR(Font);
1.10      paf        54: 
1.20      parser     55: // externs
                     56: 
1.34.2.8.2.2  paf        57: extern Methoded* image_class;
1.7       paf        58: 
1.8       paf        59: /** holds img attributes 
1.1       paf        60:        and [image itself]
                     61: */
1.34.2.7  paf        62: class VImage: public VStateless_object {
1.1       paf        63: public: // Value
                     64:        
1.34.2.3  paf        65:        override const char* type() const { return VIMAGE_TYPE; }
1.34.2.8.2.2  paf        66:        override VStateless_class *get_class() { return image_class; }
1.1       paf        67: 
                     68:        /// VImage: true
1.34.2.1  paf        69:        override bool as_bool() const { return true; }
1.19      parser     70: 
                     71:        /// VImage: true
1.34.2.8.2.3  paf        72:        override Value* as_expr_result(bool return_string_as_is=false) { return new VBool(as_bool()); }
1.1       paf        73: 
                     74:        /// VImage: method,field
1.34.2.8.2.2  paf        75:        override Value* get_element(const String& aname, Value& aself, bool looking_up);
1.15      parser     76: 
                     77:        /// VImage: field
1.34.2.8.2.2  paf        78:        override bool put_element(const String& aname, Value* avalue, bool replace);
1.1       paf        79: 
                     80: public: // usage
                     81: 
1.34.2.8.2.4! paf        82:        void set(const String* src, int width, int height,
1.34.2.8.2.2  paf        83:                gdImage* aimage,
                     84:                Value* aexif=0);
1.1       paf        85: 
1.34.2.1  paf        86:        HashStringValue& fields() { return ffields; }
1.3       paf        87: 
                     88: public:
                     89: 
1.34.2.8.2.2  paf        90:        gdImage* image; 
1.34.2.8.2.3  paf        91:        Font* font;
1.1       paf        92: 
                     93: private:
                     94: 
1.34.2.1  paf        95:        HashStringValue ffields;
1.34.2.8.2.2  paf        96:        Value* fexif;
1.1       paf        97: 
                     98: };
                     99: 
                    100: #endif

E-mail: