diff --git a/upptst/DDARasterizer/DDARasterizer.upp b/upptst/DDARasterizer/DDARasterizer.upp new file mode 100644 index 000000000..64c4df5c5 --- /dev/null +++ b/upptst/DDARasterizer/DDARasterizer.upp @@ -0,0 +1,10 @@ +uses + CtrlLib; + +file + main.cpp, + test.iml; + +mainconfig + "" = "GUI SSE2"; + diff --git a/upptst/DDARasterizer/init b/upptst/DDARasterizer/init new file mode 100644 index 000000000..53bfa2eac --- /dev/null +++ b/upptst/DDARasterizer/init @@ -0,0 +1,4 @@ +#ifndef _DDARasterizer_icpp_init_stub +#define _DDARasterizer_icpp_init_stub +#include "CtrlLib/init" +#endif diff --git a/upptst/DDARasterizer/main.cpp b/upptst/DDARasterizer/main.cpp new file mode 100644 index 000000000..6cfc962af --- /dev/null +++ b/upptst/DDARasterizer/main.cpp @@ -0,0 +1,93 @@ +#include + +using namespace Upp; + +#define IMAGECLASS TestImg +#define IMAGEFILE +#include + +#define IMAGECLASS TestImg +#define IMAGEFILE +#include + +struct ColorRenderer : DDARasterizer { + Draw *draw; + Color color; + + virtual void PutHorz(int x, int y, int cx) { + draw->DrawRect(x, y, cx, 1, color); + } + virtual void PutVert(int x, int y, int cy) { + draw->DrawRect(x, y, 1, cy, color); + } +}; + +struct MyApp : TopWindow { + Point p; + int width; + + virtual void Paint(Draw& w); + virtual void MouseMove(Point p, dword keyflags); + virtual void MouseWheel(Point p, int zdelta, dword keyflags); + virtual Image CursorImage(Point p, dword keyflags); + + MyApp() { width = 2; p = Point(0, 0); Sizeable().Zoomable(); } +}; + +Image MyApp::CursorImage(Point p, dword keyflags) +{ + return TestImg::cursor1(); +} + +void MyApp::MouseMove(Point p_, dword keyflags) +{ + p = p_; + Refresh(); +} + +void MyApp::MouseWheel(Point p, int zdelta, dword keyflags) +{ + width = minmax(1, 1000, width + sgn(zdelta)); + Title(AsString(width)); + Refresh(); +} + +void MyApp::Paint(Draw& w) +{ + Size sz = GetSize(); + + w.DrawRect(GetSize(), Gray()); + + Point p0(10, 10); + + Vector< Vector > pgs; + + ColorRenderer r; + r.Cy(sz.cy); + + r.draw = &w; + r.color = Green(); + + r.color = Black(); + r.Polygon(); + r.Move(p0); + r.Line(p); + r.Line(Point(700, 400)); + r.Fill(); + + w.DrawRect(p.x, p.y, 1, 1, White()); + r.color = LtRed(); + r.Width(width); + r.Move(p0); + r.Line(p); + + w.DrawRect(p0.x, p0.y, 1, 1, White()); + w.DrawRect(700, 400, 1, 1, White()); + + r.color = LtBlue(); +} + +GUI_APP_MAIN +{ + MyApp().Run(); +} diff --git a/upptst/DDARasterizer/test.iml b/upptst/DDARasterizer/test.iml new file mode 100644 index 000000000..4dd7b9007 --- /dev/null +++ b/upptst/DDARasterizer/test.iml @@ -0,0 +1,6 @@ +PREMULTIPLIED +IMAGE_ID(cursor1) + +IMAGE_BEGIN_DATA +IMAGE_DATA(120,156,99,96,100,96,100,128,129,255,255,15,252,7,0,9,167,3,192,0,0,0,0,0,0,0,0,0,0,0,0,0) +IMAGE_END_DATA(32, 1)