Core: Fixed MSBT problem (thanks Tom!), Painter examples and docs

This commit is contained in:
Mirek Fidler 2023-12-27 16:41:12 +01:00
parent 9c96b30c3a
commit 4a9674604c
6 changed files with 543 additions and 15 deletions

View file

@ -8,6 +8,20 @@ void GradientStop(Painter& sw)
.ColorStop(0.75, Gray())
.Fill(0, 0, Blue(), 500, 0, LtRed())
.Stroke(1, Black());
sw.Circle(120.5, 250.5, 100)
.ColorStop(0.25, Green())
.ColorStop(0.5, Yellow())
.ColorStop(0.75, Gray())
.Fill(120.5, 250.5, Blue(), 100, LtRed())
.Stroke(1, Black());
sw.Circle(420.5, 250.5, 100)
.ColorStop(0.25, Green())
.ColorStop(0.5, Yellow())
.ColorStop(0.75, Gray())
.Fill(390, 280, Blue(), 420.5, 250.5, 100, LtRed())
.Stroke(1, Black());
}
INITBLOCK {

View file

@ -0,0 +1,45 @@
#include "Examples.h"
void LineAttrs(Painter& sw)
{
sw.Begin();
for(int i = 0; i < 3; i++) {
sw.DrawText(20, 20, get_i(i, "LINECAP_BUTT", "LINECAP_SQUARE", "LINECAP_ROUND"), Arial(28));
sw.Move(50, 100).Line(200, 100)
.LineCap(get_i(i, LINECAP_BUTT, LINECAP_SQUARE, LINECAP_ROUND)).Stroke(30, Black())
.LineCap(LINECAP_BUTT).Stroke(1, LtRed());
sw.Translate(300, 0);
}
sw.End();
sw.Translate(0, 200);
sw.Begin();
for(int i = 0; i < 3; i++) {
sw.DrawText(20, 20, get_i(i, "LINEJOIN_MITER", "LINEJOIN_ROUND", "LINEJOIN_BEVEL"), Arial(28));
sw.Move(50, 240).Line(60, 100).Line(150, 220)
.LineJoin(get_i(i, LINEJOIN_MITER, LINEJOIN_ROUND, LINEJOIN_BEVEL)).Stroke(20, Black());
sw.Translate(300, 0);
}
sw.End();
sw.Translate(0, 300);
sw.Begin();
for(int i = 0; i < 3; i++) {
sw.DrawText(20, 20, get_i(i, "MiterLimit(1)", "MiterLimit(4)", "MiterLimit(20)"), Arial(28));
sw.Move(50, 240).Line(60, 100).Line(150, 220).Line(110, 100)
.MiterLimit(get_i(i, 1, 4, 20)).Stroke(20, Black());
sw.Translate(300, 0);
}
sw.End();
sw.Translate(0, 300);
sw.Begin();
for(int i = 0; i < 3; i++) {
sw.DrawText(20, 20, get_i(i, "Dash(\"10\")", "Dash(\"10 10 30 10\")", "Dash(\"10 10 30 10\", 40)"), Arial(28));
sw.Move(20, 100).Line(280, 100)
.Dash(i ? "10 10 30 10" : "10", i == 2 ? 25 : 0).Stroke(10, Black());
sw.Translate(300, 0);
}
sw.End();
}
INITBLOCK {
RegisterExample("Line attributes", LineAttrs);
}

View file

@ -15,6 +15,7 @@ file
Curves.cpp,
Clipping.cpp,
Gradient.cpp,
LineAttrs.cpp,
ColorStops.cpp,
Radial.cpp,
RadialFocus.cpp,

View file

@ -64,7 +64,7 @@ String MakeKey_(const K& k, const M& m)
RawCat(key, StaticTypeNo<K>());
RawCat(key, StaticTypeNo<M>());
key.Cat(k());
return key;
return String(key);
}
template <class K, class M>

View file

@ -319,9 +319,9 @@ public:
Painter& LineCap(int linecap);
Painter& LineJoin(int linejoin);
Painter& MiterLimit(double l);
Painter& EvenOdd(bool evenodd = true);
Painter& Dash(const Vector<double>& dash, double start);
Painter& Dash(const char *dash, double start = 0);
Painter& EvenOdd(bool evenodd = true);
Painter& Invert(bool b = true);
Painter& ImageFilter(int filter);

File diff suppressed because one or more lines are too long