- if(param=="blend_method" && value.same_as(int()))
- blend_method_=static_cast<Color::BlendMethod>(value.get(int()));
+ if(param=="blend_method" && value.same_type_as(int()))
+ {
+ blend_method_ = static_cast<Color::BlendMethod>(value.get(int()));
+
+ if (blend_method_ < 0 || blend_method_ >= Color::BLEND_END)
+ {
+ warning("illegal value (%d) for blend_method - using Composite instead", blend_method_);
+ blend_method_ = Color::BLEND_COMPOSITE;
+ return false;
+ }
+
+ if (blend_method_ == Color::BLEND_STRAIGHT && !reads_context())
+ {
+ Canvas::Handle canvas(get_canvas());
+ if (canvas)
+ {
+ String version(canvas->get_version());
+
+ if (version == "0.1" || version == "0.2")
+ if (get_name() == "PasteCanvas")
+ warning("loaded a version %s canvas with a 'Straight' blended PasteCanvas (%s) - check it renders OK",
+ version.c_str(), get_non_empty_description().c_str());
+ else
+ blend_method_ = Color::BLEND_COMPOSITE;
+ }
+ }
+ }