From 9a68c91635dc614c39e393c034179c3740c1ba63 Mon Sep 17 00:00:00 2001 From: twanvl Date: Tue, 5 Aug 2008 20:43:11 +0000 Subject: [PATCH] Added 'combine' option to ColorStyle. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1069 0fc631ac-6414-0410-93d0-97cfa31319b6 --- doc/type/style.txt | 1 + src/data/field/color.cpp | 2 ++ src/data/field/color.hpp | 1 + src/render/value/color.cpp | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/type/style.txt b/doc/type/style.txt index 293e30c0..16510939 100644 --- a/doc/type/style.txt +++ b/doc/type/style.txt @@ -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]]. diff --git a/src/data/field/color.cpp b/src/data/field/color.cpp index a4f57dca..b17b9386 100644 --- a/src/data/field/color.cpp +++ b/src/data/field/color.cpp @@ -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) { diff --git a/src/data/field/color.hpp b/src/data/field/color.hpp index a2750db3..b624586a 100644 --- a/src/data/field/color.hpp +++ b/src/data/field/color.hpp @@ -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 mask_filename; ///< Filename of an additional mask over the images + Scriptable combine; ///< How to combine image with the background virtual int update(Context&); }; diff --git a/src/render/value/color.cpp b/src/render/value/color.cpp index daa3bfb5..ee3c6c0f 100644 --- a/src/render/value/color.cpp +++ b/src/render/value/color.cpp @@ -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 &&