ultimatepp/examples/PainterExamples/RadialMaskBlending.cpp
cxl 87634c8031 .examples
git-svn-id: svn://ultimatepp.org/upp/trunk@12507 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2018-11-11 12:41:20 +00:00

31 lines
986 B
C++

#include "Examples.h"
void RadialMaskBlending(Painter& sw)
{
const char *txt = "This is just a test of radial mask blending";
Size tsz = GetTextSize(txt, Roman(40).Italic());
sw.Begin();
sw.BeginMask();
sw.Move(0, 0).Line(tsz.cx + 20, 0)
.Line(tsz.cx + 20, tsz.cx + tsz.cy + 20).Line(0, tsz.cx + tsz.cy + 20)
.Fill(tsz.cx / 2, tsz.cy + tsz.cx / 2, White(), tsz.cx / 2, Black());
sw.End();
for(int y = 0; y < tsz.cx; y += tsz.cy)
sw.Text(10, y, txt, Roman(40))
.Fill(Red());
sw.End();
sw.Begin();
sw.BeginMask();
sw.Move(0, 0).Line(tsz.cx + 20, 0)
.Line(tsz.cx + 20, tsz.cx + tsz.cy + 20).Line(0, tsz.cx + tsz.cy + 20)
.Fill(tsz.cx / 2, tsz.cy + tsz.cx / 2, Black(), tsz.cx / 2, White());
sw.End();
for(int y = 0; y < tsz.cx; y += tsz.cy)
sw.Text(10, y, txt, Roman(40).Italic())
.Fill(Blue());
sw.End();
}
INITBLOCK {
RegisterExample("Blending using radial alpha mask", RadialMaskBlending);
}