mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 06:05:58 -06:00
Painter: Xform2D::GetClass removed
This commit is contained in:
parent
eba38dda5d
commit
a402ea0cb4
6 changed files with 4213 additions and 27 deletions
|
|
@ -6,13 +6,14 @@ GUI_APP_MAIN
|
|||
{
|
||||
ImagePainter iw(4000, 2000);
|
||||
iw.Co();
|
||||
Image m;
|
||||
|
||||
for(int i = 0; i < 10; i++) {
|
||||
for(int i = 0; i < 20; i++) {
|
||||
{
|
||||
RTIMING("Clear");
|
||||
iw.Clear();
|
||||
}
|
||||
{
|
||||
if(1) {
|
||||
RTIMING("Text");
|
||||
for(int y = 0; y < 2000; y += 30)
|
||||
iw.DrawText(0, y,
|
||||
|
|
@ -20,8 +21,9 @@ GUI_APP_MAIN
|
|||
Arial(25));
|
||||
iw.Finish();
|
||||
}
|
||||
// m = iw;
|
||||
}
|
||||
|
||||
|
||||
TopWindow win;
|
||||
ImageCtrl h;
|
||||
h.SetImage(iw);
|
||||
|
|
|
|||
|
|
@ -13,16 +13,6 @@ namespace Upp {
|
|||
|
||||
INITIALIZE(PaintPainting)
|
||||
|
||||
enum XformClass { // classification of Xform (simpler forms can be optimized)
|
||||
XFORM_REGULAR = 32, // same scale in X and Y, does not skew line width
|
||||
|
||||
XFORM_IDENTITY = 0|XFORM_REGULAR, // not transformation
|
||||
XFORM_TRANSLATION = 1|XFORM_REGULAR,
|
||||
XFORM_REGULAR_SCALE = 2|XFORM_REGULAR, // just scale, same in X and Y
|
||||
XFORM_SCALE = 2, // just scale, but X scale != Y scale
|
||||
XFORM_ANY = 0,
|
||||
};
|
||||
|
||||
struct Xform2D {
|
||||
Pointf x, y, t;
|
||||
|
||||
|
|
@ -33,8 +23,6 @@ struct Xform2D {
|
|||
double GetScale() const;
|
||||
bool IsRegular() const;
|
||||
|
||||
byte GetClass() const;
|
||||
|
||||
static Xform2D Identity();
|
||||
static Xform2D Translation(double x, double y);
|
||||
static Xform2D Scale(double sx, double sy);
|
||||
|
|
|
|||
|
|
@ -24,18 +24,6 @@ bool Xform2D::IsRegular() const
|
|||
return Epsqual(d.x, d.y);
|
||||
}
|
||||
|
||||
byte Xform2D::GetClass() const
|
||||
{
|
||||
if(x.y == 0 && y.x == 0) {
|
||||
if(t.x == 0 && t.y == 0)
|
||||
return XFORM_IDENTITY;
|
||||
else
|
||||
return XFORM_TRANSLATION;
|
||||
return Epsqual(x.x, y.x) ? XFORM_REGULAR_SCALE : XFORM_SCALE;
|
||||
}
|
||||
return IsRegular() ? XFORM_REGULAR : XFORM_ANY;
|
||||
}
|
||||
|
||||
Xform2D::Xform2D()
|
||||
{
|
||||
x.x = y.y = 1;
|
||||
|
|
|
|||
10
upptst/PainterImage3/PainterImage3.upp
Normal file
10
upptst/PainterImage3/PainterImage3.upp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
test.iml,
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
45
upptst/PainterImage3/main.cpp
Normal file
45
upptst/PainterImage3/main.cpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
#define IMAGECLASS TestImg
|
||||
#define IMAGEFILE <PainterImage3/test.iml>
|
||||
#include <Draw/iml_header.h>
|
||||
|
||||
#define IMAGECLASS TestImg
|
||||
#define IMAGEFILE <PainterImage3/test.iml>
|
||||
#include <Draw/iml_source.h>
|
||||
|
||||
struct MyApp : TopWindow {
|
||||
DropList dl;
|
||||
Pointf p1 = Pointf(0, 0);
|
||||
Pointf p2 = Pointf(200, 0);
|
||||
Pointf p3 = Pointf(200, 200);
|
||||
|
||||
void Paint(Draw& w) override {
|
||||
Size sz = GetSize();
|
||||
DrawPainter iw(w, GetSize());
|
||||
iw.Clear(SWhite());
|
||||
iw.Rectangle(0, 0, sz.cx, sz.cy).Fill(TestImg::naso(), p1, p2);
|
||||
}
|
||||
|
||||
void LeftDown(Point p, dword keyflags) override
|
||||
{
|
||||
p1 = p;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void RightDown(Point p, dword keyflags) override
|
||||
{
|
||||
p2 = p;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
MyApp() {
|
||||
}
|
||||
};
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
MyApp().Run();
|
||||
}
|
||||
4153
upptst/PainterImage3/test.iml
Normal file
4153
upptst/PainterImage3/test.iml
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue