Annotation of parser3/src/types/pa_vimage.h, revision 1.8
1.1 paf 1: /** @image
2: Parser: @b image parser type decl.
3:
4: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
5:
6: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
7:
1.8 ! paf 8: $Id: pa_vimage.h,v 1.7.2.1 2001/04/17 15:02:19 paf Exp $
1.1 paf 9: */
10:
11: #ifndef PA_VIMAGE_H
12: #define PA_VIMAGE_H
13:
14: #include "pa_common.h"
15: //#include "pa_globals.h"
16: #include "pa_vstateless_object.h"
17: #include "_image.h"
18:
1.7 paf 19: class gdImage; class Font;
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: /// all: for error reporting after fail(), etc
28: const char *type() const { return "image"; }
29:
30: /// VImage: this
31: Value *as_expr_result(bool return_string_as_is=false) { return this; }
32:
33: /// VImage: true
34: bool as_bool() { return true; }
35:
36: /// VImage: method,field
37: Value *VImage::get_element(const String& aname) {
38: // $method
39: if(Value *result=VStateless_object::get_element(aname))
40: return result;
41:
42: // $src, $size
43: return static_cast<Value *>(ffields.get(aname));
44: }
45:
46: protected: // VAliased
47:
48: /// disable .CLASS element. @see VAliased::get_element
49: bool hide_class() { return true; }
50:
51: public: // usage
52:
53: VImage::VImage(Pool& apool) : VStateless_object(apool, *image_class),
1.7 paf 54: ffields(apool),
55: image(0), font(0) {
1.1 paf 56: }
57:
1.3 paf 58: void set(const String *src, int width, int height,
1.6 paf 59: gdImage *aimage=0);
1.1 paf 60: void save(const String& image_spec) {
61: /*if(fvalue_ptr)
62: image_write(pool(), image_spec, fvalue_ptr, fvalue_size, false);
63: else
64: THROW(0, 0,
65: &image_spec,
66: "saving unassigned image"); //never*/
67: }
68:
69: Hash fields() const { return ffields; }
1.3 paf 70:
71: public:
72:
1.7 paf 73: gdImage *image; Font *font;
1.1 paf 74:
75: private:
76:
77: Hash ffields;
78:
79: };
80:
81: #endif
E-mail: