mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
Mirrors upptst
git-svn-id: svn://ultimatepp.org/upp/trunk@874 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
f46c1ff59a
commit
2d6e3ada45
3 changed files with 73 additions and 0 deletions
56
upptst/Mirrors/main.cpp
Normal file
56
upptst/Mirrors/main.cpp
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
#include <Report/Report.h>
|
||||
#include <Painter/Painter.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
Font fnt = Arial(200);
|
||||
Size isz = GetTextSize("M", fnt);
|
||||
String letters = "sSzZEeDNB12345679kKrRLCc";
|
||||
Report r;
|
||||
Size page = r.GetPageSize();
|
||||
// r.DrawText(0, 0, letters, fnt);
|
||||
for(int y = 0; y + isz.cy < page.cy; y += 3 * isz.cy / 2)
|
||||
for(int x = 0; x < page.cx; x += 3 * isz.cx / 2) {
|
||||
int ch = letters[Random(letters.GetCount())];
|
||||
PaintingPainter gw(isz.cx, isz.cy);
|
||||
gw.Begin();
|
||||
if(Random(4) == 0) {
|
||||
gw.Translate(isz.cx, 0);
|
||||
gw.Scale(-1, 1);
|
||||
}
|
||||
gw.Character((isz.cx - fnt.Info()[ch]) / 2, 0, ch, fnt).Fill(Black());
|
||||
// gw.Rectangle(0, 0, isz.cx, isz.cy).Stroke(5, LtGray());
|
||||
gw.End();
|
||||
r.DrawPainting(x, y, isz.cx, isz.cy, gw);
|
||||
}
|
||||
r.NewPage();
|
||||
String pairs = "BNDH";
|
||||
for(int y = 0; y + isz.cy < page.cy; y += 3 * isz.cy / 2)
|
||||
for(int x = 0; x < page.cx; x += 3 * isz.cx) {
|
||||
int ch = pairs[Random(pairs.GetCount())];
|
||||
int cl = ToLower(ch);
|
||||
if(Random(3) == 0)
|
||||
cl = ToLower(pairs[Random(pairs.GetCount())]);
|
||||
r.DrawText(x, y, String(ch, 1) + String(cl, 1), fnt);
|
||||
}
|
||||
r.NewPage();
|
||||
for(int i = 0; i < 10; i++) {
|
||||
int a, b;
|
||||
do {
|
||||
a = Random(50) + 1;
|
||||
b = Random(50) + 1;
|
||||
}
|
||||
while(a + b < 0 || a + b > 50);
|
||||
r.DrawText(10, 10 + isz.cy * 2 * i, Format("%d + %d = ", a, b), fnt);
|
||||
do {
|
||||
a = Random(30) + 1;
|
||||
b = Random(20) + 1;
|
||||
}
|
||||
while(a - b < 1);
|
||||
r.DrawText(2000, 10 + isz.cy * 2 * i, Format("%d - %d = ", a, b), fnt);
|
||||
}
|
||||
Perform(r);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue