--- parser3/src/classes/image.C 2001/09/04 19:44:32 1.39 +++ parser3/src/classes/image.C 2001/09/15 15:42:08 1.40.4.1 @@ -5,9 +5,9 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: image.C,v 1.39 2001/09/04 19:44:32 parser Exp $ + $Id: image.C,v 1.40.4.1 2001/09/15 15:42:08 parser Exp $ */ -static const char *RCSId="$Id: image.C,v 1.39 2001/09/04 19:44:32 parser Exp $"; +static const char *RCSId="$Id: image.C,v 1.40.4.1 2001/09/15 15:42:08 parser Exp $"; /* jpegsize: gets the width and height (in pixels) of a jpeg file @@ -137,7 +137,7 @@ void measure_gif(Pool& pool, const Strin if(strncmp(head->type, "GIF", 3)!=0) PTHROW(0, 0, origin_string, - "not GIF file - signature not found"); + "not GIF file - wrong signature"); width=little_endian_to_int(head->width); height=little_endian_to_int(head->height); @@ -161,7 +161,7 @@ void measure_jpeg(Pool& pool, const Stri if(!(signature[0]==0xFF && signature[1]==0xD8)) PTHROW(0, 0, origin_string, - "not JPEG file - signature not found"); + "not JPEG file - wrong signature"); bool found=false; while(true) { @@ -219,11 +219,12 @@ void measure(Pool& pool, const String& f "can not determine image type - no file name extension"); } -/// used by image: _measure / read_mem +#ifndef DOXYGEN struct Read_mem_info { unsigned char *ptr; unsigned char *eof; }; +#endif static size_t read_mem(void*& buf, size_t limit, void *info) { Read_mem_info& rmi=*static_cast(info); buf=rmi.ptr; @@ -232,11 +233,12 @@ static size_t read_mem(void*& buf, size_ return read_size; } -/// used by image: _measure / read_disk +#ifndef DOXYGEN struct Read_disk_info { const String *file_spec; size_t offset; }; +#endif static size_t read_disk(void*& buf, size_t limit, void *info) { Read_disk_info& rdi=*static_cast(info); Pool& pool=rdi.file_spec->pool(); @@ -283,11 +285,12 @@ static void _measure(Request& r, const S static_cast(r.self)->set(file_name, width, height); } -/// used by image: _html / append_attrib_pair +#ifndef DOXYGEN struct Attrib_info { String *tag; ///< html tag being constructed Hash *skip; ///< tag attributes not to append to tag string [to skip] }; +#endif static void append_attrib_pair(const Hash::Key& key, Hash::Val *val, void *info) { Attrib_info& ai=*static_cast(info); @@ -353,8 +356,7 @@ static gdImage *load(Request& r, const S static void _load(Request& r, const String& method_name, MethodParams *params) { Pool& pool=r.pool(); - Value& vfile_name=params->as_no_junction(0, "file name must not be code"); - const String& file_name=vfile_name.as_string(); + const String& file_name=params->as_string(0, "file name must not be code"); gdImage& image=*load(r, method_name, file_name); int width=image.SX(); @@ -406,12 +408,24 @@ static void _line(Request& r, const Stri &method_name, "does not contain an image"); - image->Line( - params->as_int(0, r), - params->as_int(1, r), - params->as_int(2, r), - params->as_int(3, r), - image->Color(params->as_int(4, r))); + if(params->size()>5) { + // '*** * ' + const String& sline_style=params->as_string(5, "line style must not be code"); + + image->StyledLine( + params->as_int(0, r), + params->as_int(1, r), + params->as_int(2, r), + params->as_int(3, r), + image->Color(params->as_int(4, r)), + sline_style.size()?sline_style.cstr(String::UL_AS_IS):0); + } else + image->Line( + params->as_int(0, r), + params->as_int(1, r), + params->as_int(2, r), + params->as_int(3, r), + image->Color(params->as_int(4, r))); } static void _fill(Request& r, const String& method_name, MethodParams *params) { @@ -678,7 +692,7 @@ MImage::MImage(Pool& apool) : Methoded(a add_native_method("gif", Method::CT_DYNAMIC, _gif, 0, 0); // ^image.line(x0;y0;x1;y1;color) - add_native_method("line", Method::CT_DYNAMIC, _line, 5, 5); + add_native_method("line", Method::CT_DYNAMIC, _line, 5, 6); // ^image.fill(x;y;color) add_native_method("fill", Method::CT_DYNAMIC, _fill, 3, 3);