Annotation of parser3/src/types/pa_vimage.h, revision 1.34.2.8.2.2
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.2! paf 11: static const char* IDENT_VIMAGE_H="$Date: 2003/03/18 15:14:21 $";
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.4 paf 24: class gdImage; DECLARE_OBJECT_PTR(gdImage);
1.34.2.8 paf 25:
26:
27: /// simple gdImage-based font storage & text output
28: class Font: public PA_Object {
29: public:
30:
31: const static int letter_spacing;
32: int height; ///< Font heigth
33: int monospace; ///< Default char width
34: int spacebarspace; ///< spacebar width
1.34.2.8.2.2! paf 35: gdImage* ifont;
1.34.2.8.2.1 paf 36: const String& alphabet;
1.34.2.8 paf 37:
1.34.2.8.2.1 paf 38: Font(//
39: const String& aalphabet,
1.34.2.8.2.2! paf 40: gdImage* aifont, int aheight, int amonospace, int aspacebarspace);
1.34.2.8 paf 41:
42: //@{******************************** char **********************************
43: int index_of(char ch);
44: int index_width(int index);
1.34.2.8.2.2! paf 45: void index_display(gdImage* image, int x, int y, int index);
1.34.2.8 paf 46: //@}
47: //@{******************************* string *********************************
48: int step_width(int index);
49: //@}
50: /// counts trailing letter_spacing, consider this OK. useful for contiuations
1.34.2.8.2.1 paf 51: int string_width(const String& s);
1.34.2.8.2.2! paf 52: void string_display(gdImage* image, int x, int y, const String& s);
1.34.2.8 paf 53: };
54: DECLARE_OBJECT_PTR(Font);
1.10 paf 55:
1.20 parser 56: // externs
57:
1.34.2.8.2.2! paf 58: extern Methoded* image_class;
1.7 paf 59:
1.8 paf 60: /** holds img attributes
1.1 paf 61: and [image itself]
62: */
1.34.2.7 paf 63: class VImage: public VStateless_object {
1.1 paf 64: public: // Value
65:
1.34.2.3 paf 66: override const char* type() const { return VIMAGE_TYPE; }
1.34.2.8.2.2! paf 67: override VStateless_class *get_class() { return image_class; }
1.1 paf 68:
69: /// VImage: true
1.34.2.1 paf 70: override bool as_bool() const { return true; }
1.19 parser 71:
72: /// VImage: true
1.34.2.8.2.2! paf 73: override Value* as_expr_result(bool return_string_as_is=false) {
! 74: return Value*(new VBool(as_bool()));
1.34.2.1 paf 75: }
1.1 paf 76:
77: /// VImage: method,field
1.34.2.8.2.2! paf 78: override Value* get_element(const String& aname, Value& aself, bool looking_up);
1.15 parser 79:
80: /// VImage: field
1.34.2.8.2.2! paf 81: override bool put_element(const String& aname, Value* avalue, bool replace);
1.1 paf 82:
83: public: // usage
84:
1.34.2.8.2.1 paf 85: void set(const String& src, int width, int height,
1.34.2.8.2.2! paf 86: gdImage* aimage,
! 87: Value* aexif=0);
1.1 paf 88:
1.34.2.1 paf 89: HashStringValue& fields() { return ffields; }
1.3 paf 90:
91: public:
92:
1.34.2.8.2.2! paf 93: gdImage* image;
1.34.2.6 paf 94: FontPtr font;
1.1 paf 95:
96: private:
97:
1.34.2.1 paf 98: HashStringValue ffields;
1.34.2.8.2.2! paf 99: Value* fexif;
1.1 paf 100:
101: };
102:
103: #endif
E-mail: