mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 06:05:58 -06:00
.upptst
git-svn-id: svn://ultimatepp.org/upp/trunk@14569 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
7b20cb4af0
commit
c176a3ba21
9 changed files with 226 additions and 0 deletions
14
upptst/MemoryStatus/MemoryStatus.cpp
Normal file
14
upptst/MemoryStatus/MemoryStatus.cpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
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");
|
||||
}
|
||||
9
upptst/MemoryStatus/MemoryStatus.upp
Normal file
9
upptst/MemoryStatus/MemoryStatus.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
MemoryStatus.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
97
upptst/Test_painting/Test_painting.h
Normal file
97
upptst/Test_painting/Test_painting.h
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
#ifndef _Test_painting_Test_painting_h
|
||||
#define _Test_painting_Test_painting_h
|
||||
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
#include <Painter/Painter.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
#define IMAGECLASS Test_paintingImg
|
||||
#define IMAGEFILE <Test_painting/Test_painting.iml>
|
||||
#include <Draw/iml_header.h>
|
||||
|
||||
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 <Test_painting/Test_painting.lay>
|
||||
#include <CtrlCore/lay.h>
|
||||
|
||||
#define IMAGEFILE <Test_painting/Test_painting.iml>
|
||||
#include <Draw/iml_header.h>
|
||||
|
||||
class Test_painting : public WithTest_paintingLayout<TopWindow> {
|
||||
public:
|
||||
typedef Test_painting CLASSNAME;
|
||||
Test_painting();
|
||||
};
|
||||
|
||||
#endif
|
||||
10
upptst/Test_painting/Test_painting.iml
Normal file
10
upptst/Test_painting/Test_painting.iml
Normal file
|
|
@ -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)
|
||||
22
upptst/Test_painting/Test_painting.lay
Normal file
22
upptst/Test_painting/Test_painting.lay
Normal file
|
|
@ -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
|
||||
|
||||
15
upptst/Test_painting/Test_painting.upp
Normal file
15
upptst/Test_painting/Test_painting.upp
Normal file
|
|
@ -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";
|
||||
|
||||
BIN
upptst/Test_painting/icon.ico
Normal file
BIN
upptst/Test_painting/icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.1 KiB |
BIN
upptst/Test_painting/icon32x32.png
Normal file
BIN
upptst/Test_painting/icon32x32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 222 B |
59
upptst/Test_painting/main.cpp
Normal file
59
upptst/Test_painting/main.cpp
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#include "Test_painting.h"
|
||||
|
||||
|
||||
|
||||
#define IMAGECLASS Test_paintingImg
|
||||
#define IMAGEFILE <Test_painting/Test_painting.iml>
|
||||
#include <Draw/iml_source.h>
|
||||
|
||||
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> rgba;
|
||||
for(const RGBA& c : img)
|
||||
rgba.FindAdd(c);
|
||||
DDUMP(rgba);
|
||||
Test_painting().Run();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue