mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
.upptst: DDARasterizer
git-svn-id: svn://ultimatepp.org/upp/trunk@6062 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
7ab4b5b0bf
commit
f710616c12
4 changed files with 113 additions and 0 deletions
10
upptst/DDARasterizer/DDARasterizer.upp
Normal file
10
upptst/DDARasterizer/DDARasterizer.upp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp,
|
||||
test.iml;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI SSE2";
|
||||
|
||||
4
upptst/DDARasterizer/init
Normal file
4
upptst/DDARasterizer/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _DDARasterizer_icpp_init_stub
|
||||
#define _DDARasterizer_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#endif
|
||||
93
upptst/DDARasterizer/main.cpp
Normal file
93
upptst/DDARasterizer/main.cpp
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
#define IMAGECLASS TestImg
|
||||
#define IMAGEFILE <DDARasterizer/test.iml>
|
||||
#include <Draw/iml_header.h>
|
||||
|
||||
#define IMAGECLASS TestImg
|
||||
#define IMAGEFILE <DDARasterizer/test.iml>
|
||||
#include <Draw/iml_source.h>
|
||||
|
||||
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<Point> > 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();
|
||||
}
|
||||
6
upptst/DDARasterizer/test.iml
Normal file
6
upptst/DDARasterizer/test.iml
Normal file
|
|
@ -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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue