diff --git a/upptst/MemoryStatus/MemoryStatus.cpp b/upptst/MemoryStatus/MemoryStatus.cpp new file mode 100644 index 000000000..a197ee82a --- /dev/null +++ b/upptst/MemoryStatus/MemoryStatus.cpp @@ -0,0 +1,14 @@ +#include + +using namespace Upp; + +CONSOLE_APP_MAIN +{ + StdLogSetup(LOG_COUT|LOG_FILE); + + uint64 free, total; + GetSystemMemoryStatus(total, free); + + LOG("Total memory: " << (total >> 20) << " MB"); + LOG("Free memory: " << (free >> 20) << " MB"); +} diff --git a/upptst/MemoryStatus/MemoryStatus.upp b/upptst/MemoryStatus/MemoryStatus.upp new file mode 100644 index 000000000..b71d3fe6f --- /dev/null +++ b/upptst/MemoryStatus/MemoryStatus.upp @@ -0,0 +1,9 @@ +uses + Core; + +file + MemoryStatus.cpp; + +mainconfig + "" = ""; + diff --git a/upptst/Test_painting/Test_painting.h b/upptst/Test_painting/Test_painting.h new file mode 100644 index 000000000..01344b012 --- /dev/null +++ b/upptst/Test_painting/Test_painting.h @@ -0,0 +1,97 @@ +#ifndef _Test_painting_Test_painting_h +#define _Test_painting_Test_painting_h + +#include +#include + +using namespace Upp; + +#define IMAGECLASS Test_paintingImg +#define IMAGEFILE +#include + +class TestCtrl_1 : public Ctrl { + public: + typedef TestCtrl_1 CLASSNAME; + + int _drawMode; + Image _ctrlBckgndStyle; + + TestCtrl_1() { + Transparent(); + BackPaintHint(); + } + virtual ~TestCtrl_1() {} + + void Paint2(ImageBuffer& ib) { + RGBA bckgColor; bckgColor.r = 0; bckgColor.g = 0; bckgColor.b = 0; bckgColor.a = 0; + Upp::Fill( ib.Begin(), bckgColor, ib.GetLength() ); + BufferPainter bp(ib, _drawMode); + bp.Clear(RGBAZero()); + bp.DrawRect(Rect(Point(0,0), Point( GetSize().cx, GetSize().cy/2)), White()); + bp.DrawRect(Rect(Point(0,GetSize().cy/2), Point( GetSize().cx, GetSize().cy)), Blue()); + ChPaint(bp, GetSize(), _ctrlBckgndStyle ); + bp.DrawLine( Point(0,0), Point( GetSize().cx, GetSize().cy), 1 , Red() ); + } + + virtual void Paint(Draw& dw) { + ImageBuffer ib(GetSize()); + Paint2(ib); + dw.DrawImage(GetSize(), ib); + } + +}; + +class TestCtrl_2 : public TestCtrl_1 { + public: + typedef TestCtrl_2 CLASSNAME; + + TestCtrl_2() {} + virtual ~TestCtrl_2() {} + + + virtual void Paint(Draw& dw) { + ImageBuffer ib(GetSize()); + Paint2(ib); + Premultiply(ib); + dw.DrawImage(GetSize(), ib); + } +}; + +class TestCtrl_3 : public TestCtrl_1 { + public: + typedef TestCtrl_3 CLASSNAME; + + + TestCtrl_3() {} + virtual ~TestCtrl_3() {} + + + virtual void Paint(Draw& dw) { + ImageBuffer ib(GetSize()); + RGBA bckgColor; bckgColor.r = 0; bckgColor.g = 0; bckgColor.b = 0; bckgColor.a = 0; + Upp::Fill( ib.Begin(), bckgColor, ib.GetLength() ); + BufferPainter bp(ib, _drawMode); + + ImageBuffer ib2(GetSize()); + Paint2(ib2); + + bp.DrawImage(GetSize(), ib2); + dw.DrawImage(GetSize(), ib); + } +}; + + +#define LAYOUTFILE +#include + +#define IMAGEFILE +#include + +class Test_painting : public WithTest_paintingLayout { +public: + typedef Test_painting CLASSNAME; + Test_painting(); +}; + +#endif diff --git a/upptst/Test_painting/Test_painting.iml b/upptst/Test_painting/Test_painting.iml new file mode 100644 index 000000000..2c7c408ad --- /dev/null +++ b/upptst/Test_painting/Test_painting.iml @@ -0,0 +1,10 @@ +PREMULTIPLIED +IMAGE_ID(testImg) IMAGE_META("exp", "") + + +IMAGE_BEGIN_DATA +IMAGE_DATA(120,156,237,212,75,14,128,48,8,69,81,150,194,38,117,127,174,172,206,140,33,225,147,10,52,169,239,145,142,207,29,245) +IMAGE_DATA(98,98,194,48,108,114,227,117,7,157,207,235,182,165,95,217,32,93,205,175,232,208,108,203,207,106,176,108,207,207,104,88) +IMAGE_DATA(233,123,118,196,255,210,0,31,254,159,253,72,195,206,255,79,164,161,218,246,26,58,108,171,163,203,213,26,186,109,12,195) +IMAGE_DATA(210,118,3,220,3,137,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) +IMAGE_END_DATA(128, 1) diff --git a/upptst/Test_painting/Test_painting.lay b/upptst/Test_painting/Test_painting.lay new file mode 100644 index 000000000..e01a629c2 --- /dev/null +++ b/upptst/Test_painting/Test_painting.lay @@ -0,0 +1,22 @@ +LAYOUT(Test_paintingLayout, 880, 484) + ITEM(TestCtrl_2, ctrl2_noaa, LeftPosZ(320, 180).TopPosZ(204, 120)) + ITEM(TestCtrl_2, ctrl2_subpix, LeftPosZ(696, 180).TopPosZ(204, 120)) + ITEM(TestCtrl_2, ctrl2_draw, LeftPosZ(132, 180).TopPosZ(204, 120)) + ITEM(TestCtrl_2, ctrl2_aa, LeftPosZ(508, 180).TopPosZ(205, 120)) + ITEM(TestCtrl_1, ctrl1_noaa, LeftPosZ(320, 180).TopPosZ(52, 120)) + ITEM(TestCtrl_1, ctrl1_subpix, LeftPosZ(696, 180).TopPosZ(52, 120)) + ITEM(TestCtrl_1, ctrl1_draw, LeftPosZ(132, 180).TopPosZ(52, 120)) + ITEM(TestCtrl_1, ctrl1_aa, LeftPosZ(508, 180).TopPosZ(53, 120)) + ITEM(TestCtrl_3, ctrl3_noaa, LeftPosZ(320, 180).TopPosZ(360, 120)) + ITEM(TestCtrl_3, ctrl3_subpix, LeftPosZ(696, 180).TopPosZ(360, 120)) + ITEM(TestCtrl_3, ctrl3_draw, LeftPosZ(132, 180).TopPosZ(360, 120)) + ITEM(TestCtrl_3, ctrl3_aa, LeftPosZ(508, 180).TopPosZ(360, 120)) + ITEM(StaticText, dv___12, SetText(t_("no antialiasing")).LeftPosZ(324, 84).TopPosZ(24, 19)) + ITEM(StaticText, dv___13, SetText(t_("antialiased")).LeftPosZ(516, 84).TopPosZ(24, 19)) + ITEM(StaticText, dv___14, SetText(t_("subpixel")).LeftPosZ(716, 84).TopPosZ(24, 19)) + ITEM(StaticText, dv___15, SetText(t_("TestCtrl_2\nImageBuffer ib;\nPaint2(ib);\nPremuiltiply(ib);\ndw.DrawImage(ib);")).LeftPosZ(4, 124).TopPosZ(232, 66)) + ITEM(StaticText, dv___16, SetText(t_("draw")).LeftPosZ(120, 84).TopPosZ(24, 19)) + ITEM(StaticText, dv___17, SetText(t_("TestCtrl_1\nImageBuffer ib;\nPaint2(ib);\ndw.DrawImage(ib)")).LeftPosZ(4, 124).TopPosZ(80, 66)) + ITEM(StaticText, dv___18, SetText(t_("TestCtrl_3\nBufferPainter bp\nbp.fill( RGBA(0) );\n ImageBuffer ib;\n Paint2(ib);\n bp.DrawImage(ib);\ndw.DrawImage(bp);")).LeftPosZ(4, 124).TopPosZ(360, 116)) +END_LAYOUT + diff --git a/upptst/Test_painting/Test_painting.upp b/upptst/Test_painting/Test_painting.upp new file mode 100644 index 000000000..23d344506 --- /dev/null +++ b/upptst/Test_painting/Test_painting.upp @@ -0,0 +1,15 @@ +description "Test_painting\377"; + +uses + CtrlLib, + Painter; + +file + Test_painting.h, + main.cpp, + Test_painting.lay, + Test_painting.iml; + +mainconfig + "" = "GUI"; + diff --git a/upptst/Test_painting/icon.ico b/upptst/Test_painting/icon.ico new file mode 100644 index 000000000..53c61ac2d Binary files /dev/null and b/upptst/Test_painting/icon.ico differ diff --git a/upptst/Test_painting/icon32x32.png b/upptst/Test_painting/icon32x32.png new file mode 100644 index 000000000..3e07955ba Binary files /dev/null and b/upptst/Test_painting/icon32x32.png differ diff --git a/upptst/Test_painting/main.cpp b/upptst/Test_painting/main.cpp new file mode 100644 index 000000000..8bf86a474 --- /dev/null +++ b/upptst/Test_painting/main.cpp @@ -0,0 +1,59 @@ +#include "Test_painting.h" + + + +#define IMAGECLASS Test_paintingImg +#define IMAGEFILE +#include + +Test_painting::Test_painting() +{ + CtrlLayout(*this, "Window title"); + ctrl1_draw._drawMode = -1; + ctrl1_noaa._drawMode = MODE_NOAA; + ctrl1_aa._drawMode = MODE_ANTIALIASED; + ctrl1_subpix._drawMode = MODE_SUBPIXEL; + + Image img = Test_paintingImg::testImg(); + + ctrl1_draw._ctrlBckgndStyle = img; + ctrl1_noaa._ctrlBckgndStyle = img; + ctrl1_aa._ctrlBckgndStyle = img; + ctrl1_subpix._ctrlBckgndStyle = img; + + + ctrl2_draw._drawMode = -1; + ctrl2_noaa._drawMode = MODE_NOAA; + ctrl2_aa._drawMode = MODE_ANTIALIASED; + ctrl2_subpix._drawMode = MODE_SUBPIXEL; + + ctrl2_draw._ctrlBckgndStyle = img; + ctrl2_noaa._ctrlBckgndStyle = img; + ctrl2_aa._ctrlBckgndStyle = img; + ctrl2_subpix._ctrlBckgndStyle = img; + + + ctrl3_draw._drawMode = -1; + ctrl3_noaa._drawMode = MODE_NOAA; + ctrl3_aa._drawMode = MODE_ANTIALIASED; + ctrl3_subpix._drawMode = MODE_SUBPIXEL; + + ctrl3_draw._ctrlBckgndStyle = img; + ctrl3_noaa._ctrlBckgndStyle = img; + ctrl3_aa._ctrlBckgndStyle = img; + ctrl3_subpix._ctrlBckgndStyle = img; +} + +GUI_APP_MAIN +{ + Image img = Test_paintingImg::testImg(); + const RGBA *s = ~img; + Index rgba; + for(const RGBA& c : img) + rgba.FindAdd(c); + DDUMP(rgba); + Test_painting().Run(); +} + + +