Doc, Draw: Improve draw tutorial and add missing code to tutorial source code

This commit is contained in:
klugier 2025-12-19 23:04:52 +01:00
parent a8fa1ec628
commit 8911eacec2
6 changed files with 108 additions and 66 deletions

View file

@ -51,5 +51,8 @@ struct MyApp : TopWindow {
GUI_APP_MAIN
{
MyApp().Sizeable().Run();
MyApp app;
app.Title("Basic Drawing Operations").Zoomable().Sizeable();
app.SetRect(0, 0, 500, 420);
app.Run();
}

View file

@ -8,7 +8,7 @@ struct MyApp : TopWindow {
w.DrawText(0, 0, "Hello world", Roman(30).Bold());
}
virtual void Paint(Draw& w) override {
void Paint(Draw& w) override {
w.DrawRect(GetSize(), White());
DoPainting(w);
w.Offset(30, 50);
@ -27,5 +27,8 @@ struct MyApp : TopWindow {
GUI_APP_MAIN
{
MyApp().Sizeable().Run();
MyApp app;
app.Title("Offsets and Cliping").Zoomable().Sizeable();
app.SetRect(0, 0, 420, 240);
app.Run();
}

View file

@ -42,5 +42,8 @@ struct MyApp : TopWindow {
GUI_APP_MAIN
{
MyApp().Sizeable().Run();
MyApp app;
app.Title("Fonts and Font Metrics").Zoomable().Sizeable();
app.SetRect(0, 0, 700, 300);
app.Run();
}

View file

@ -23,5 +23,8 @@ struct MyApp : TopWindow {
GUI_APP_MAIN
{
MyApp().Sizeable().Run();
MyApp app;
app.Title("DrawingDraw").Zoomable().Sizeable();
app.SetRect(0, 0, 380, 360);
app.Run();
}

View file

@ -11,16 +11,19 @@ struct MyApp : TopWindow {
}
MyApp() {
ImageDraw iw(100, 40);
iw.Alpha().DrawRect(0, 0, 100, 40, GrayColor(0));
iw.Alpha().DrawEllipse(0, 0, 100, 40, GrayColor(255));
iw.DrawEllipse(0, 0, 100, 40, Yellow());
iw.DrawText(26, 10, "Image", Arial(16).Bold());
ImageDraw iw(200, 80);
iw.Alpha().DrawRect(0, 0, 200, 80, GrayColor(0));
iw.Alpha().DrawEllipse(0, 0, 200, 80, GrayColor(255));
iw.DrawEllipse(0, 0, 200, 80, Yellow());
iw.DrawText(50, 15, "Image", Arial(32).Bold());
image = iw;
}
};
GUI_APP_MAIN
{
MyApp().Sizeable().Run();
MyApp app;
app.Title("ImageDraw").Zoomable().Sizeable();
app.SetRect(0, 0, 220, 100);
app.Run();
}

File diff suppressed because one or more lines are too long