Annotation of parser3/src/types/pa_vimage.C, revision 1.8
1.7 paf 1: /** @file
1.1 paf 2: Parser: @b image parser type.
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 ! parser 8: $Id: pa_vimage.C,v 1.7.8.2 2001/09/17 16:14:04 parser Exp $
1.1 paf 9: */
10:
11: #include "pa_vimage.h"
12: #include "pa_vint.h"
13: #include "pa_vstring.h"
1.8 ! parser 14: #include "gif.h"
1.1 paf 15:
1.3 paf 16: void VImage::set(const String *src, int width, int height,
1.6 paf 17: gdImage* aimage) {
1.5 paf 18: image=aimage;
1.3 paf 19:
1.1 paf 20: // $src
1.3 paf 21: if(src)
22: ffields.put(String(pool(), "src"), NEW VString(*src));
1.1 paf 23: // $width
24: if(width)
25: ffields.put(String(pool(), "width"), NEW VInt(pool(), width));
26: // $height
27: if(height)
28: ffields.put(String(pool(), "height"), NEW VInt(pool(), height));
1.2 paf 29:
30: // defaults
1.8 ! parser 31: // $border(0)
1.2 paf 32: ffields.put(String(pool(), "border"), NEW VInt(pool(), 0));
1.8 ! parser 33: // $line-width(1)
! 34: ffields.put(String(pool(), "line-width"), NEW VInt(pool(), 1));
! 35: }
! 36:
! 37:
! 38: void VImage::put_element(const String& aname, Value *avalue) {
! 39: ffields.put(aname, avalue);
! 40:
! 41: if(image)
! 42: if(aname=="line-width") {
! 43: image->SetLineWidth(min(max(avalue->as_int(), 1), 10));
! 44: } else if(aname=="line-style") {
! 45: const String sline_style=avalue->as_string();
! 46: image->SetLineStyle(sline_style.size()?sline_style.cstr(String::UL_AS_IS):0);
! 47: }
1.1 paf 48: }
E-mail: