--- parser3/src/classes/image.C 2001/10/16 10:26:09 1.56 +++ parser3/src/classes/image.C 2001/10/19 15:20:40 1.58 @@ -4,7 +4,7 @@ Copyright(c) 2001 ArtLebedev Group(http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: image.C,v 1.56 2001/10/16 10:26:09 parser Exp $ + $Id: image.C,v 1.58 2001/10/19 15:20:40 parser Exp $ */ /* @@ -128,13 +128,13 @@ void measure_gif(Pool& pool, const Strin void *buf; const int head_size=sizeof(GIF_Header); if(reader.read(buf, head_size)type, "GIF", 3)!=0) - PTHROW(0, 0, + throw Exception(0, 0, origin_string, "not GIF file - wrong signature"); @@ -142,6 +142,7 @@ void measure_gif(Pool& pool, const Strin height=little_endian_to_int(head->height); } +/// @test remove ugly mech in reader - 20K limit void measure_jpeg(Pool& pool, const String *origin_string, Measure_reader& reader, int& width, int& height) { // JFIF format markers @@ -152,13 +153,13 @@ void measure_jpeg(Pool& pool, const Stri void *buf; const size_t prefix_size=2; if(reader.read(buf, prefix_size)for_each(append_attrib_pair, &attrib_info); } else - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "attributes must be hash"); } @@ -342,12 +343,12 @@ static gdImage *load(Request& r, const S bool ok=image.CreateFromGif(f); fclose(f); if(!ok) - PTHROW(0, 0, + throw Exception(0, 0, &file_name, "is not in GIF format"); return ℑ } else { - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "can not open '%s'", file_name_cstr); return 0; @@ -385,7 +386,7 @@ static void _gif(Request& r, const Strin gdImage *image=static_cast(r.self)->image; if(!image) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "does not contain an image"); @@ -406,7 +407,7 @@ static void _line(Request& r, const Stri gdImage *image=static_cast(r.self)->image; if(!image) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "does not contain an image"); @@ -423,7 +424,7 @@ static void _fill(Request& r, const Stri gdImage *image=static_cast(r.self)->image; if(!image) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "does not contain an image"); @@ -438,7 +439,7 @@ static void _rectangle(Request& r, const gdImage *image=static_cast(r.self)->image; if(!image) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "does not contain an image"); @@ -455,7 +456,7 @@ static void _bar(Request& r, const Strin gdImage *image=static_cast(r.self)->image; if(!image) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "does not contain an image"); @@ -482,13 +483,13 @@ static void _replace(Request& r, const S gdImage *image=static_cast(r.self)->image; if(!image) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "does not contain an image"); Table *table=params->as_no_junction(2, "coordinates must not be code").get_table(); if(!table) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "coordinates must be table"); @@ -505,13 +506,13 @@ static void _polyline(Request& r, const gdImage *image=static_cast(r.self)->image; if(!image) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "does not contain an image"); Table *table=params->as_no_junction(1, "coordinates must not be code").get_table(); if(!table) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "coordinates must be table"); @@ -528,13 +529,13 @@ static void _polygon(Request& r, const S gdImage *image=static_cast(r.self)->image; if(!image) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "does not contain an image"); Table *table=params->as_no_junction(1, "coordinates must not be code").get_table(); if(!table) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "coordinates must be table"); @@ -550,13 +551,13 @@ static void _polybar(Request& r, const S gdImage *image=static_cast(r.self)->image; if(!image) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "does not contain an image"); Table *table=params->as_no_junction(1, "coordinates must not be code").get_table(); if(!table) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "coordinates must be table"); @@ -651,7 +652,7 @@ static void _font(Request& r, const Stri monospace_width=0; if(!alphabet.size()) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "alphabet must not be empty"); @@ -673,11 +674,11 @@ static void _text(Request& r, const Stri if(vimage.font) vimage.font->string_display(*vimage.image, x, y, s); else - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "set the font first"); else - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "does not contain an image"); } @@ -694,11 +695,11 @@ static void _length(Request& r, const St result.set_name(method_name); r.write_assign_lang(result); } else - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "set the font first"); else - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "does not contain an image"); } @@ -708,7 +709,7 @@ static void _arc(Request& r, const Strin gdImage *image=static_cast(r.self)->image; if(!image) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "does not contain an image"); @@ -727,7 +728,7 @@ static void _sector(Request& r, const St gdImage *image=static_cast(r.self)->image; if(!image) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "does not contain an image"); @@ -746,7 +747,7 @@ static void _circle(Request& r, const St gdImage *image=static_cast(r.self)->image; if(!image) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "does not contain an image"); @@ -766,13 +767,13 @@ gdImage& as_image(Pool& pool, const Stri Value& value=params->as_no_junction(index, msg); if(strcmp(value.type(), VIMAGE_TYPE)!=0) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, msg); gdImage *src=static_cast(&value)->image; if(!src) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, msg); @@ -784,7 +785,7 @@ static void _copy(Request& r, const Stri gdImage *dest=static_cast(r.self)->image; if(!dest) - PTHROW(0, 0, + throw Exception(0, 0, &method_name, "self does not contain an image");