git-svn-id: svn://ultimatepp.org/upp/trunk@15902 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2021-04-09 07:16:31 +00:00
parent 48afff1ba0
commit d274cabbe1
2 changed files with 0 additions and 77 deletions

View file

@ -1,9 +0,0 @@
uses
CtrlLib;
file
main.cpp;
mainconfig
"" = "GUI";

View file

@ -1,68 +0,0 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
struct MyApp : TopWindow {
Point pos;
Vector<Vector<Tuple<double, Pointf>>> drawing;
PenInfo pen;
virtual bool Pen(Point p, const PenInfo& pn, dword keyflags) {
if(keyflags&K_SHIFT)
return false;
if(pn.pressure) {
if((!!pn.pressure == !!pen.pressure) && drawing.GetCount())
drawing.Top().Add(MakeTuple(pn.pressure, p));
else
drawing.Add().Add(MakeTuple(pn.pressure, p));
}
pen = pn;
Refresh();
return true;
}
void LeftDown(Point p, dword keyflags) override {
if(keyflags & K_SHIFT) {
RectTracker tracker(*this);
tracker.MinSize(Size(-100000,-100000));
tracker.Track(Rect(p,p));
}
}
virtual void Paint(Draw& w0) {
DrawPainter w(w0, GetSize());
w.Co();
w.Clear(SColorPaper());
w.LineCap(LINECAP_ROUND);
for(const auto& stroke : drawing)
if(stroke.GetCount())
for(int i = 0; i < stroke.GetCount() - 1; i++) {
w.Move(stroke[i].b);
w.Line(stroke[i + 1].b);
w.Stroke(DPI(20) * stroke[i].a, Black());
}
int fcy = GetStdFontCy();
int y = 10;
auto Text = [&] (const String& text) {
w.DrawText(10, y, text);
y += fcy;
};
Text(AsString(pos));
Text(String() << "Pressure: " << pen.pressure);
Text(String() << "Rotation: " << pen.rotation);
Text(String() << "Tilt: " << pen.tilt);
Text(String() << "Barrel: " << pen.barrel);
Text(String() << "Inverted: " << pen.inverted);
Text(String() << "Eraser: " << pen.eraser); // FIXED to IsPenEraserPressed()
}
};
GUI_APP_MAIN
{
MyApp().Run();
}