Commit 252c1a0e authored by twanvl's avatar twanvl

Added 'combine' option to ColorStyle.

parent abd0b7b9
......@@ -142,6 +142,7 @@ The rest of the properties depend on the type of [[type:field]] this style is fo
| ^^^ @top width@ ^^^ ^^^ ^^^
| ^^^ @bottom width@ ^^^ ^^^ ^^^
| ^^^ @mask@ [[type:scriptable]] [[type:filename]] ''none'' A mask to apply to the box, black areas in the mask become transparent.
| ^^^ @combine@ [[type:combine]] @"normal"@ How to combine the color with the background? Only applies when a mask is used.
! <<< <<< <<< <<<
| @"image"@ @mask@ [[type:scriptable]] [[type:filename]] ''none'' A mask to apply to the image, black areas in the mask become transparent, similair to [[fun:set_mask]].
......
......@@ -52,6 +52,7 @@ ColorStyle::ColorStyle(const ColorFieldP& field)
, radius(0)
, left_width(100000), right_width (100000)
, top_width (100000), bottom_width(100000)
, combine(COMBINE_NORMAL)
{}
IMPLEMENT_REFLECTION(ColorStyle) {
......@@ -62,6 +63,7 @@ IMPLEMENT_REFLECTION(ColorStyle) {
REFLECT(top_width);
REFLECT(bottom_width);
REFLECT_N("mask", mask_filename);
REFLECT(combine);
}
int ColorStyle::update(Context& ctx) {
......
......@@ -62,6 +62,7 @@ class ColorStyle : public Style {
double top_width; ///< Width of the colored region on the top side
double bottom_width; ///< Width of the colored region on the bottom side
Scriptable<String> mask_filename; ///< Filename of an additional mask over the images
Scriptable<ImageCombine> combine; ///< How to combine image with the background
virtual int update(Context&);
};
......
......@@ -48,7 +48,7 @@ void ColorValueViewer::draw(RotatedDC& dc) {
Image img(alpha_mask->size.x, alpha_mask->size.y);
fill_image(img, value().value());
alpha_mask->setAlpha(img);
dc.DrawImage(img, RealPoint(0,0));
dc.DrawImage(img, RealPoint(0,0), style().combine);
} else {
// do we need clipping?
bool clip = style().left_width < style().width && style().right_width < style().width &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment