mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-05 17:44:55 -06:00
SDraw improvements
git-svn-id: svn://ultimatepp.org/upp/trunk@723 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
93fc976688
commit
a9b6df415a
9 changed files with 189 additions and 123 deletions
|
|
@ -63,10 +63,10 @@ void Arc(SDraw& sw, double x, double y, double rx, double ry,
|
|||
double px = x + rx * cos(start_angle);
|
||||
double py = y + ry * sin(start_angle);
|
||||
if(startline)
|
||||
sw.LineTo(px, py);
|
||||
sw.Line(px, py);
|
||||
else
|
||||
sw.MoveTo(px, py);
|
||||
sw.LineTo(x + rx * cos(start_angle + sweep_angle), y + ry * sin(start_angle + sweep_angle));
|
||||
sw.Move(px, py);
|
||||
sw.Line(x + rx * cos(start_angle + sweep_angle), y + ry * sin(start_angle + sweep_angle));
|
||||
return;
|
||||
}
|
||||
double total_sweep = 0.0;
|
||||
|
|
@ -98,9 +98,9 @@ void Arc(SDraw& sw, double x, double y, double rx, double ry,
|
|||
sSubArc(x, y, rx, ry, start_angle, local_sweep, px, py);
|
||||
if(first)
|
||||
if(startline)
|
||||
sw.LineTo(px[0], py[0]);
|
||||
sw.Line(px[0], py[0]);
|
||||
else
|
||||
sw.MoveTo(px[0], py[0]);
|
||||
sw.Move(px[0], py[0]);
|
||||
first = false;
|
||||
sw.Cubic(px[1], py[1], px[2], py[2], px[3], py[3]);
|
||||
start_angle += local_sweep;
|
||||
|
|
|
|||
|
|
@ -57,13 +57,13 @@ bool SDraw::IsPaintingOp(const Rect& r) const
|
|||
void SDraw::DrawRectOp(int x, int y, int cx, int cy, Color color)
|
||||
{
|
||||
RTIMING("Rect");
|
||||
MoveTo(x, y).LineTo(x + cx - 1, y).LineTo(x + cx - 1, y + cy - 1).LineTo(x, y + cy - 1);
|
||||
Move(x, y).Line(x + cx - 1, y).Line(x + cx - 1, y + cy - 1).Line(x, y + cy - 1);
|
||||
Fill(color);
|
||||
}
|
||||
|
||||
void SDraw::DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color)
|
||||
{
|
||||
MoveTo(x, y).LineTo(x + cx - 1, y).LineTo(x + cx - 1, y + cy - 1).LineTo(x, y + cy - 1);
|
||||
Move(x, y).Line(x + cx - 1, y).Line(x + cx - 1, y + cy - 1).Line(x, y + cy - 1);
|
||||
Fill(img, Translate2D(x, y));
|
||||
}
|
||||
|
||||
|
|
@ -73,8 +73,8 @@ void SDraw::DrawDataOp(int x, int y, int cx, int cy, const String& data, const c
|
|||
|
||||
void SDraw::DrawLineOp(int x1, int y1, int x2, int y2, int width, Color color)
|
||||
{
|
||||
MoveTo(x1, y1);
|
||||
LineTo(x2, y2);
|
||||
Move(x1, y1);
|
||||
Line(x2, y2);
|
||||
Stroke(color, width);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,6 @@
|
|||
// mcseemagg@yahoo.com
|
||||
// http://www.antigrain.com
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Arc generator. Produces at most 4 consecutive cubic bezier curves, i.e.,
|
||||
// 4, 7, 10, or 13 vertices.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// Recycled for U++ by Miroslav Fidler 2008
|
||||
|
||||
|
|
@ -32,47 +27,36 @@ inline double fx_to_dbl(const FIXED& p) {
|
|||
|
||||
void RenderCharPath(const char* gbuf, unsigned total_size, SDraw& sw, double xx, double yy)
|
||||
{
|
||||
const char* cur_glyph = gbuf;
|
||||
const char* end_glyph = gbuf + total_size;
|
||||
|
||||
while(cur_glyph < end_glyph) {
|
||||
const TTPOLYGONHEADER* th = (TTPOLYGONHEADER*)cur_glyph;
|
||||
|
||||
const char* end_poly = cur_glyph + th->cb;
|
||||
const char* cur_poly = cur_glyph + sizeof(TTPOLYGONHEADER);
|
||||
|
||||
sw.MoveTo(xx + fx_to_dbl(th->pfxStart.x), yy - fx_to_dbl(th->pfxStart.y));
|
||||
|
||||
while(cur_poly < end_poly)
|
||||
{
|
||||
const TTPOLYCURVE* pc = (const TTPOLYCURVE*)cur_poly;
|
||||
|
||||
const char* cur_glyph = gbuf;
|
||||
const char* end_glyph = gbuf + total_size;
|
||||
|
||||
while(cur_glyph < end_glyph) {
|
||||
const TTPOLYGONHEADER* th = (TTPOLYGONHEADER*)cur_glyph;
|
||||
const char* end_poly = cur_glyph + th->cb;
|
||||
const char* cur_poly = cur_glyph + sizeof(TTPOLYGONHEADER);
|
||||
sw.Move(xx + fx_to_dbl(th->pfxStart.x), yy - fx_to_dbl(th->pfxStart.y));
|
||||
while(cur_poly < end_poly) {
|
||||
const TTPOLYCURVE* pc = (const TTPOLYCURVE*)cur_poly;
|
||||
if (pc->wType == TT_PRIM_LINE)
|
||||
for(int i = 0; i < pc->cpfx; i++)
|
||||
sw.LineTo(xx + fx_to_dbl(pc->apfx[i].x), yy - fx_to_dbl(pc->apfx[i].y));
|
||||
|
||||
if (pc->wType == TT_PRIM_QSPLINE)
|
||||
{
|
||||
int u;
|
||||
for (u = 0; u < pc->cpfx - 1; u++) // Walk through points in spline
|
||||
{
|
||||
POINTFX pnt_b = pc->apfx[u]; // B is always the current point
|
||||
POINTFX pnt_c = pc->apfx[u+1];
|
||||
|
||||
if (u < pc->cpfx - 2) // If not on last spline, compute C
|
||||
{
|
||||
// midpoint (x,y)
|
||||
*(int*)&pnt_c.x = (*(int*)&pnt_b.x + *(int*)&pnt_c.x) / 2;
|
||||
*(int*)&pnt_c.y = (*(int*)&pnt_b.y + *(int*)&pnt_c.y) / 2;
|
||||
}
|
||||
|
||||
sw.Quadratic(xx + fx_to_dbl(pnt_b.x), yy - fx_to_dbl(pnt_b.y),
|
||||
xx + fx_to_dbl(pnt_c.x), yy - fx_to_dbl(pnt_c.y));
|
||||
}
|
||||
}
|
||||
cur_poly += sizeof(WORD) * 2 + sizeof(POINTFX) * pc->cpfx;
|
||||
}
|
||||
cur_glyph += th->cb;
|
||||
sw.Line(xx + fx_to_dbl(pc->apfx[i].x), yy - fx_to_dbl(pc->apfx[i].y));
|
||||
if (pc->wType == TT_PRIM_QSPLINE) {
|
||||
int u;
|
||||
for (u = 0; u < pc->cpfx - 1; u++) { // Walk through points in spline
|
||||
POINTFX pnt_b = pc->apfx[u]; // B is always the current point
|
||||
POINTFX pnt_c = pc->apfx[u+1];
|
||||
if (u < pc->cpfx - 2) { // If not on last spline, compute C
|
||||
// midpoint (x,y)
|
||||
*(int*)&pnt_c.x = (*(int*)&pnt_b.x + *(int*)&pnt_c.x) / 2;
|
||||
*(int*)&pnt_c.y = (*(int*)&pnt_b.y + *(int*)&pnt_c.y) / 2;
|
||||
}
|
||||
sw.Quadratic(xx + fx_to_dbl(pnt_b.x), yy - fx_to_dbl(pnt_b.y),
|
||||
xx + fx_to_dbl(pnt_c.x), yy - fx_to_dbl(pnt_c.y));
|
||||
}
|
||||
}
|
||||
cur_poly += sizeof(WORD) * 2 + sizeof(POINTFX) * pc->cpfx;
|
||||
}
|
||||
cur_glyph += th->cb;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,22 +4,40 @@ NAMESPACE_UPP
|
|||
|
||||
#define LTIMING(x) RTIMING(x)
|
||||
|
||||
|
||||
SDraw& SDraw::MoveTo(double x, double y)
|
||||
inline void SDraw::PathPoint(double x, double y)
|
||||
{
|
||||
if(inpath)
|
||||
path.close_polygon();
|
||||
else
|
||||
if(inpath) {
|
||||
pathrect.left = min(pathrect.left, x);
|
||||
pathrect.top = min(pathrect.top, y);
|
||||
pathrect.right = max(pathrect.right, x);
|
||||
pathrect.bottom = max(pathrect.bottom, y);
|
||||
}
|
||||
else {
|
||||
path.remove_all();
|
||||
pathrect.left = pathrect.right = x;
|
||||
pathrect.top = pathrect.bottom = y;
|
||||
}
|
||||
inpath = true;
|
||||
current = Pointf(x, y);
|
||||
}
|
||||
|
||||
inline void SDraw::ControlPoint(double x, double y)
|
||||
{
|
||||
control = Pointf(x, y);
|
||||
PathPoint(x, y);
|
||||
}
|
||||
|
||||
SDraw& SDraw::Move(double x, double y)
|
||||
{
|
||||
PathPoint(x, y);
|
||||
path.move_to(x, y);
|
||||
inpath = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SDraw& SDraw::LineTo(double x, double y)
|
||||
SDraw& SDraw::Line(double x, double y)
|
||||
{
|
||||
if(!inpath)
|
||||
path.remove_all();
|
||||
PathPoint(x, y);
|
||||
path.line_to(x, y);
|
||||
inpath = true;
|
||||
return *this;
|
||||
|
|
@ -27,25 +45,37 @@ SDraw& SDraw::LineTo(double x, double y)
|
|||
|
||||
SDraw& SDraw::Quadratic(double x1, double y1, double x, double y)
|
||||
{
|
||||
ControlPoint(x1, y1);
|
||||
PathPoint(x, y);
|
||||
path.curve3(x1, y1, x, y);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Pointf SDraw::Reflection() const
|
||||
{
|
||||
return current + current - control;
|
||||
}
|
||||
|
||||
SDraw& SDraw::Quadratic(double x, double y)
|
||||
{
|
||||
path.curve3(x, y);
|
||||
Pointf c = Reflection();
|
||||
path.curve3(c.x, c.y, x, y);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SDraw& SDraw::Cubic(double x1, double y1, double x2, double y2, double x, double y)
|
||||
{
|
||||
ControlPoint(x1, y1);
|
||||
ControlPoint(x2, y2);
|
||||
PathPoint(x, y);
|
||||
path.curve4(x1, y1, x2, y2, x, y);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SDraw& SDraw::Cubic(double x2, double y2, double x, double y)
|
||||
{
|
||||
path.curve4(x2, y2, x, y);
|
||||
Pointf c = Reflection();
|
||||
path.curve4(c.x, c.y, x2, y2, x, y);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -55,39 +85,63 @@ SDraw& SDraw::Close()
|
|||
return *this;
|
||||
}
|
||||
|
||||
inline void SDraw::MinMax(Pointf& minv, Pointf& maxv, Pointf p) const
|
||||
{
|
||||
p = attr.mtx.Transformed(p);
|
||||
minv.x = min(minv.x, p.x);
|
||||
minv.y = min(minv.y, p.y);
|
||||
maxv.x = max(maxv.x, p.x);
|
||||
maxv.y = max(maxv.y, p.y);
|
||||
}
|
||||
|
||||
bool SDraw::PathVisible(double w) const
|
||||
{
|
||||
Pointf h = attr.mtx.Transformed(w, w);
|
||||
w = max(abs(h.x), abs(h.y));
|
||||
Pointf min;
|
||||
Pointf max;
|
||||
min = max = attr.mtx.Transformed(pathrect.TopLeft());
|
||||
MinMax(min, max, pathrect.TopRight());
|
||||
MinMax(min, max, pathrect.BottomLeft());
|
||||
MinMax(min, max, pathrect.BottomRight());
|
||||
return max.x + w >= 0 && max.y + w >= 0 && min.x - w <= sizef.cx && min.y - w <= sizef.cy;
|
||||
}
|
||||
|
||||
SDraw& SDraw::Fill()
|
||||
{
|
||||
LTIMING("Fill");
|
||||
if(inpath)
|
||||
path.close_polygon();
|
||||
rasterizer.reset();
|
||||
rasterizer.filling_rule(attr.evenodd ? agg::fill_even_odd : agg::fill_non_zero);
|
||||
rasterizer.add_path(curved_trans);
|
||||
renderer.color(*(color_type *)&attr.fill);
|
||||
if(mask.GetCount()) {
|
||||
agg::rendering_buffer mask_rbuf;
|
||||
mask_rbuf.attach(~mask.Top(), size.cx, size.cy, size.cx);
|
||||
agg::alpha_mask_gray8 mask(mask_rbuf);
|
||||
agg::scanline_u8_am<agg::alpha_mask_gray8> sl(mask);
|
||||
if(PathVisible(0)) {
|
||||
rasterizer.reset();
|
||||
rasterizer.filling_rule(attr.evenodd ? agg::fill_even_odd : agg::fill_non_zero);
|
||||
rasterizer.add_path(curved_trans);
|
||||
renderer.color(*(color_type *)&attr.fill);
|
||||
if(mask.GetCount()) {
|
||||
agg::rendering_buffer mask_rbuf;
|
||||
mask_rbuf.attach(~mask.Top(), size.cx, size.cy, size.cx);
|
||||
agg::alpha_mask_gray8 mask(mask_rbuf);
|
||||
agg::scanline_u8_am<agg::alpha_mask_gray8> sl(mask);
|
||||
if(attr.antialiased) {
|
||||
renderer.color(*(color_type *)&attr.fill);
|
||||
agg::render_scanlines(rasterizer, sl, renderer);
|
||||
}
|
||||
else {
|
||||
rendererb.color(*(color_type *)&attr.fill);
|
||||
agg::render_scanlines(rasterizer, sl, rendererb);
|
||||
}
|
||||
}
|
||||
else
|
||||
if(attr.antialiased) {
|
||||
renderer.color(*(color_type *)&attr.fill);
|
||||
agg::render_scanlines(rasterizer, sl, renderer);
|
||||
agg::render_scanlines(rasterizer, scanline_p, renderer);
|
||||
}
|
||||
else {
|
||||
rendererb.color(*(color_type *)&attr.fill);
|
||||
agg::render_scanlines(rasterizer, sl, rendererb);
|
||||
agg::render_scanlines(rasterizer, scanline_p, rendererb);
|
||||
}
|
||||
rasterizer.reset();
|
||||
}
|
||||
else
|
||||
if(attr.antialiased) {
|
||||
renderer.color(*(color_type *)&attr.fill);
|
||||
agg::render_scanlines(rasterizer, scanline_p, renderer);
|
||||
}
|
||||
else {
|
||||
rendererb.color(*(color_type *)&attr.fill);
|
||||
agg::render_scanlines(rasterizer, scanline_p, rendererb);
|
||||
}
|
||||
rasterizer.reset();
|
||||
inpath = false;
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -206,11 +260,6 @@ SDraw& SDraw::Stroke()
|
|||
return *this;
|
||||
}
|
||||
|
||||
Pointf SDraw::Current() const
|
||||
{
|
||||
return Pointf(path.last_x(), path.last_y());
|
||||
}
|
||||
|
||||
SDraw& SDraw::Fill(const RGBA& rgba)
|
||||
{
|
||||
attr.fill = rgba;
|
||||
|
|
@ -276,6 +325,7 @@ SDraw::SDraw(ImageBuffer& ib)
|
|||
curved_trans(curved, attr.mtx)
|
||||
{
|
||||
size = ib.GetSize();
|
||||
sizef = size;
|
||||
UPP::Fill(~buffer, White(), buffer.GetLength()); //!!!
|
||||
rbuf.attach((agg::int8u *)~buffer, size.cx, size.cy, size.cx * 4);
|
||||
pixf.attach(rbuf);
|
||||
|
|
@ -283,6 +333,8 @@ SDraw::SDraw(ImageBuffer& ib)
|
|||
renderer.attach(renb);
|
||||
rendererb.attach(renb);
|
||||
inpath = false;
|
||||
pathrect = Null;
|
||||
control = current = Null;
|
||||
|
||||
attr.cap = LINECAP_BUTT;
|
||||
attr.join = LINEJOIN_MITER;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,11 @@
|
|||
NAMESPACE_UPP
|
||||
|
||||
struct Matrix2D : agg::trans_affine {
|
||||
Matrix2D operator*(const Matrix2D& s) const { Matrix2D x = *this; x *= s; return x; }
|
||||
Matrix2D operator*(const Matrix2D& s) const { Matrix2D x = *this; x *= s; return x; }
|
||||
|
||||
void Transform(double& x, double& y) const { transform(&x, &y); }
|
||||
Pointf Transformed(double x, double y) const { Transform(x, y); return Pointf(x, y); }
|
||||
Pointf Transformed(Pointf p) const { Transform(p.x, p.y); return p; }
|
||||
};
|
||||
|
||||
struct Translate2D : Matrix2D {
|
||||
|
|
@ -88,6 +92,7 @@ private:
|
|||
typedef renderer_base::color_type x;
|
||||
|
||||
Size size;
|
||||
Sizef sizef;
|
||||
ImageBuffer& buffer;
|
||||
Array< Buffer<byte> > mask;
|
||||
|
||||
|
|
@ -127,14 +132,24 @@ private:
|
|||
CurvedStrokedTrans curved_stroked_trans;
|
||||
CurvedTrans curved_trans;
|
||||
|
||||
Rectf pathrect;
|
||||
Pointf current, control;
|
||||
|
||||
void PathPoint(double x, double y);
|
||||
void ControlPoint(double x, double y);
|
||||
void MinMax(Pointf& min, Pointf& max, Pointf p) const;
|
||||
bool PathVisible(double d) const;
|
||||
Pointf Reflection() const;
|
||||
|
||||
public:
|
||||
Pointf Current() const;
|
||||
Pointf Current() const { return current; }
|
||||
Rectf PathRect() const { return pathrect; }
|
||||
|
||||
void Begin();
|
||||
void End();
|
||||
|
||||
SDraw& MoveTo(double x, double y);
|
||||
SDraw& LineTo(double x, double y);
|
||||
SDraw& Move(double x, double y);
|
||||
SDraw& Line(double x, double y);
|
||||
SDraw& Quadratic(double x1, double y1, double x, double y);
|
||||
SDraw& Quadratic(double x, double y);
|
||||
SDraw& Cubic(double x1, double y1, double x2, double y2, double x, double y);
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ optimize_speed;
|
|||
file
|
||||
SDraw.h,
|
||||
SDraw.cpp optimize_speed,
|
||||
FontWin32.cpp,
|
||||
FontX11.cpp,
|
||||
FontWin32.cpp,
|
||||
Arc.cpp,
|
||||
Text.cpp,
|
||||
Draw.cpp,
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ void PaintLion(SDraw *sw, Draw *w)
|
|||
|
||||
if(c == 'M') {
|
||||
if(sw)
|
||||
sw->MoveTo(x, y);
|
||||
sw->Move(x, y);
|
||||
else {
|
||||
if(!IsNull(color))
|
||||
w->DrawPolygon(p, color);
|
||||
|
|
@ -212,7 +212,7 @@ void PaintLion(SDraw *sw, Draw *w)
|
|||
}
|
||||
else
|
||||
if(sw)
|
||||
sw->LineTo(x, y);
|
||||
sw->Line(x, y);
|
||||
else
|
||||
p.Add(Point((int)x, (int)y));
|
||||
|
||||
|
|
@ -249,28 +249,43 @@ struct App : TopWindow {
|
|||
SDraw sw(ib);
|
||||
|
||||
sw.AntiAliased(true);
|
||||
//Text(sw, 500, 500, Format("%d", p.y), Arial(20));
|
||||
//sw.Fill(Black());
|
||||
|
||||
sw.Scale(0.0005 * p.x);
|
||||
sw.Rotate(0.01 * p.y - M_PI);
|
||||
/*
|
||||
DDUMP(0.01 * 394 - M_PI);
|
||||
sw.Begin();
|
||||
sw.Rotate(0.01 * 394 - M_PI);
|
||||
sw.Move(100, 100).Line(200, 100).Line(200, 200).Fill(Black());
|
||||
sw.End();
|
||||
|
||||
{
|
||||
DDUMP(0.01 * 390 - M_PI);
|
||||
sw.Rotate(0.01 * 390 - M_PI);
|
||||
sw.Move(100, 100).Line(200, 100).Line(200, 200).Fill(Blue());
|
||||
*/
|
||||
if(1) {
|
||||
static RichText txt = ParseQTF(GetTopic("topic://SDrawTest/app/main$en-us"));
|
||||
RTIMING("QTF");
|
||||
txt.Paint(sw, 0, 0, 4000);
|
||||
}
|
||||
|
||||
|
||||
// sw.Scale(p.x / 100.0, p.y / 100.0);
|
||||
// Arc(sw, 500, 300, 400, 100, 0, M_2PI);
|
||||
// sw.FillMask(0);
|
||||
// sw.Rotate(p.y / 100.00);
|
||||
// sw.Scale(1.4);
|
||||
// sw.MoveTo(100, 100).LineTo(200.5, 100).LineTo(200, 200).LineTo(0, 300).Stroke(Blue(), 10);
|
||||
// sw.Move(100, 100).Line(200.5, 100).Line(200, 200).Line(0, 300).Stroke(Blue(), 10);
|
||||
/*
|
||||
sw.MoveTo(100 + 10, 100 - 10).LineTo(200 + 20, 100 - 60).LineTo(200 + 23, 200- 50).LineTo(20, 300)
|
||||
sw.Move(100 + 10, 100 - 10).Line(200 + 20, 100 - 60).Line(200 + 23, 200- 50).Line(20, 300)
|
||||
.Fill(100 * Green()).Stroke(Blue(), 2);*/
|
||||
// PaintLion(&sw, NULL);
|
||||
// sw.MoveTo(200, 300).Quadratic(400,50, 600,300).Fill(Green()).Stroke(Red(), 10);
|
||||
// sw.MoveTo(200, 300).Quadratic(400,50, 600,300).Fill(Green()).Stroke(Red(), 10);
|
||||
// sw.MoveTo(100, 200).Cubic(100,100, 250,100, 250,200).Cubic(400,300, 400,200).Stroke(Cyan(), 4);
|
||||
// sw.MoveTo(300, 200).LineTo(150, 200).Arc(150, 150, 0, 1,0, 300, 50).Fill(Red()).Stroke(Blue(), 2);
|
||||
PaintLion(&sw, NULL);
|
||||
// sw.Move(200, 300).Quadratic(400,50, 600,300).Fill(Green()).Stroke(Red(), 10);
|
||||
// sw.Move(200, 300).Quadratic(400,50, 600,300).Fill(Green()).Stroke(Red(), 10);
|
||||
sw.Move(100, 200).Cubic(100,100, 250,100, 250,200).Cubic(400,300, 400,200).Stroke(Cyan(), 4);
|
||||
// sw.Move(300, 200).Line(150, 200).Arc(150, 150, 0, 1,0, 300, 50).Fill(Red()).Stroke(Blue(), 2);
|
||||
// d="M300,200 h-150 a150,150 0 1,0 150,-150 z"
|
||||
// fill="red" stroke="blue" stroke-width="5"
|
||||
|
||||
|
|
@ -278,15 +293,15 @@ struct App : TopWindow {
|
|||
sw.FillMask(50);
|
||||
for(int i = 0; i < 0; i++) {
|
||||
RTIMING("Lion");
|
||||
sw.MoveTo(200, 200).LineTo(200, 210).LineTo(210, 205).FillMask(0);
|
||||
sw.Move(200, 200).Line(200, 210).Line(210, 205).FillMask(0);
|
||||
PaintLion(&sw, NULL);
|
||||
// sw.MoveTo(200, 200).LineTo(200, 300).LineTo(300, 250).Fill(Blue());
|
||||
// sw.Move(200, 200).Line(200, 300).Line(300, 250).Fill(Blue());
|
||||
}
|
||||
|
||||
#if 0
|
||||
for(int i = 0; i < 1000; i++) {
|
||||
RTIMING("Small rect");
|
||||
sw.MoveTo(100, 100).LineTo(100, 110).LineTo(110, 105).Fill(Red());
|
||||
sw.Move(100, 100).Line(100, 110).Line(110, 105).Fill(Red());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -294,28 +309,28 @@ struct App : TopWindow {
|
|||
#if 0
|
||||
for(int i = 0; i < 1000; i++) {
|
||||
RTIMING("Large rect");
|
||||
sw.MoveTo(200, 200).LineTo(200, 600).LineTo(600, 600).LineTo(600, 200).Fill(Blue());
|
||||
sw.Move(200, 200).Line(200, 600).Line(600, 600).Line(600, 200).Fill(Blue());
|
||||
}
|
||||
|
||||
for(int i = 0; i < 1000; i++) {
|
||||
RTIMING("Small rect");
|
||||
sw.MoveTo(100, 100).LineTo(100, 110).LineTo(110, 110).LineTo(100, 110).Fill(Red());
|
||||
sw.Move(100, 100).Line(100, 110).Line(110, 110).Line(100, 110).Fill(Red());
|
||||
}
|
||||
|
||||
sw.StrokeColor(Blue());
|
||||
sw.MoveTo(100, 100).LineTo(100, 110).LineTo(110, 110).LineTo(100, 110).Stroke();
|
||||
sw.Move(100, 100).Line(100, 110).Line(110, 110).Line(100, 110).Stroke();
|
||||
|
||||
sw.MoveTo(50, 200).Arc(50, 50, 0, true, true, 150, 200).Arc(50, 50, 0, true, true, 50, 200)
|
||||
sw.Move(50, 200).Arc(50, 50, 0, true, true, 150, 200).Arc(50, 50, 0, true, true, 50, 200)
|
||||
.Stroke(Blue(), 2);
|
||||
|
||||
sw.MoveTo(0, 0).Ellipse(100, 100).Stroke();
|
||||
sw.Move(0, 0).Ellipse(100, 100).Stroke();
|
||||
|
||||
#endif
|
||||
|
||||
/// sw.Scale(1.5);
|
||||
Matrix2D m;
|
||||
// m.rotate(p.x / 300.0);
|
||||
// sw.MoveTo(0, 0).LineTo(0, 600).LineTo(600, 600).LineTo(200, 0)
|
||||
// sw.Move(0, 0).Line(0, 600).Line(600, 600).Line(200, 0)
|
||||
// .Fill(Black());
|
||||
// .Fill(StreamRaster::LoadFileAny("U:/ImgTest/Jachym.bmp"), m, 255, true)
|
||||
// .Stroke(Black(), 1);
|
||||
|
|
@ -325,16 +340,16 @@ struct App : TopWindow {
|
|||
sw.Fill(StreamRaster::LoadFileAny("U:/ImgTest/Jachym.bmp"), m, 255, true);
|
||||
sw.Stroke(Black(), 1);
|
||||
// sw.Fill(Black()).Stroke(LtRed(), 2);
|
||||
sw.MoveTo(100, 100).LineTo(100, 300).LineTo(400, 400);
|
||||
sw.Move(100, 100).Line(100, 300).Line(400, 400);
|
||||
sw.Fill(StreamRaster::LoadFileAny("U:/ImgTest/Jachym.bmp"), m, 255, true);
|
||||
|
||||
sw.Begin();
|
||||
sw.LineJoin(LINEJOIN_ROUND);
|
||||
sw.MoveTo(100, 100);
|
||||
sw.Move(100, 100);
|
||||
// Arc(sw, 100, 100, 150, 100, p.x / 100.0, p.y / 100.0, true);
|
||||
sw.Fill(LtBlue());
|
||||
sw.Stroke(Black(), 2);
|
||||
sw.MoveTo(100, 100);
|
||||
sw.Move(100, 100);
|
||||
// Arc(sw, 100, 100, 150, 100, p.x / 100.0 + p.y / 100.0, M_2PI - p.x / 100.0, true);
|
||||
sw.Fill(LtRed());
|
||||
sw.Stroke(Black(), 2);
|
||||
|
|
@ -359,7 +374,7 @@ struct App : TopWindow {
|
|||
|
||||
}
|
||||
|
||||
App() { Sizeable().Zoomable(); }
|
||||
App() { Sizeable().Zoomable(); p = Point(0, 0); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ topic "class aaa : public WithaaaLayout<TopWindow> ";
|
|||
[s0; [R6 dům]&]
|
||||
[s0;R6 &]
|
||||
[s0; [R6 doj]&]
|
||||
[s0; [R6 noj]&]
|
||||
[s0; [R6 hoj]&]
|
||||
[s0; [R6 běží]&]
|
||||
[s0; [R6 dozadu]&]
|
||||
[s0; [R6 nemá]&]
|
||||
|
|
@ -106,4 +106,4 @@ topic "class aaa : public WithaaaLayout<TopWindow> ";
|
|||
[s0; [R6 dítě]&]
|
||||
[s0; [R6 děti]&]
|
||||
[s0; [R6 něco]&]
|
||||
[s0;6 ]
|
||||
[s0; ]
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
TITLE("class aaa : public WithaaaLayout<TopWindow> ")
|
||||
COMPRESSED
|
||||
120,156,133,84,75,142,211,64,16,189,138,165,140,88,192,8,245,215,221,182,55,44,88,32,177,64,98,27,89,168,29,55,19,199,95,98,59,82,130,152,27,228,0,163,89,229,0,17,123,36,178,113,124,47,202,144,209,164,60,25,38,31,219,85,238,87,85,239,85,117,79,153,115,117,69,174,201,132,188,240,241,223,219,175,166,205,154,112,154,8,161,3,195,100,144,126,252,228,5,3,158,2,158,43,202,181,228,84,48,23,46,148,83,38,25,23,84,51,79,104,206,53,241,103,153,169,235,112,154,49,173,255,130,24,128,152,146,140,42,161,133,166,92,105,6,88,70,8,35,138,73,42,184,102,210,143,109,61,11,167,4,150,115,88,238,185,220,35,148,16,69,41,225,76,17,46,5,165,156,65,8,166,24,37,210,183,69,28,78,63,184,193,0,16,3,41,233,66,233,46,68,19,130,64,244,1,38,56,229,132,113,73,61,233,250,145,189,73,138,75,148,228,139,148,20,241,147,198,230,39,70,70,4,175,223,201,128,2,212,189,118,39,10,210,10,9,201,188,129,17,7,24,99,174,244,168,
|
||||
20,80,146,32,204,95,218,111,109,178,180,185,45,154,83,132,132,82,70,131,136,170,0,74,184,189,189,125,75,5,249,167,148,130,90,40,129,186,25,5,31,240,80,84,122,196,147,154,106,194,149,96,82,1,245,202,44,77,126,98,18,9,22,156,120,232,107,61,113,169,11,138,18,13,245,75,15,2,16,32,1,119,16,82,194,143,107,191,57,129,7,220,0,242,174,189,9,136,196,37,81,30,81,66,73,1,76,24,117,41,8,73,6,254,208,6,191,40,151,185,201,194,233,247,47,63,156,105,77,130,207,174,243,42,188,252,224,76,225,177,176,85,153,247,63,251,67,27,158,121,35,167,112,226,71,199,27,232,215,216,7,139,226,34,202,163,56,30,238,143,151,240,82,150,168,92,132,40,233,185,21,247,63,243,139,168,120,132,194,102,116,188,239,15,221,30,69,42,55,38,110,113,166,188,219,33,20,78,141,44,83,148,200,140,177,25,149,56,87,100,80,96,19,37,199,109,138,125,153,197,166,121,248,227,34,22,78,158,56,13,10,95,149,199,109,183,111,204,113,27,62,175,227,9,89,149,
|
||||
233,72,41,19,117,251,133,109,158,81,249,97,141,137,81,29,155,54,26,153,235,115,27,14,138,114,100,155,113,219,158,25,178,172,219,173,80,170,21,128,81,112,96,155,224,94,215,231,230,220,12,95,236,193,34,206,51,179,26,57,186,125,129,60,53,86,120,94,214,205,40,2,206,153,149,109,245,100,141,45,112,151,234,198,102,72,149,54,69,188,82,60,83,233,176,213,208,80,164,45,56,112,136,178,50,13,170,124,108,103,109,133,223,183,53,178,111,218,28,107,177,44,108,58,214,127,100,163,247,27,139,102,37,141,215,253,1,209,170,146,25,222,72,43,219,223,33,207,12,180,194,59,164,157,205,145,22,221,175,227,214,162,50,226,227,125,131,198,32,134,45,112,188,199,130,162,24,253,1,70,125,151,98,87,183,195,137,7,15,166,7,243,88,198,107,220,201,116,9,155,173,93,224,19,165,223,117,123,232,121,247,251,220,153,39,53,222,231,53,148,137,235,106,12,140,95,127,55,110,194,236,226,57,55,95,26,116,176,86,221,174,176,43,212,159,126,103,103,243,98,125,17,14,170,225,141,
|
||||
188,218,196,160,245,255,117,124,34,117,113,188,159,61,80,112,157,240,15,62,255,145,167,
|
||||
120,156,133,84,75,142,211,64,16,189,74,164,140,88,192,8,245,215,221,182,55,44,88,32,177,64,98,27,89,168,29,55,19,199,95,98,59,82,130,152,27,228,0,163,172,114,128,104,246,72,100,227,248,94,148,33,195,164,60,25,38,31,219,85,238,87,85,239,85,117,79,216,232,234,138,92,147,49,121,225,227,189,183,95,77,147,214,193,36,22,66,251,134,73,63,249,248,201,245,123,60,5,60,87,148,107,201,169,96,14,92,40,167,76,50,46,168,102,174,208,156,107,226,77,83,83,85,193,36,101,90,255,1,49,0,49,37,25,85,66,11,77,185,210,12,176,140,16,70,20,147,84,112,205,164,23,217,106,26,76,8,44,231,176,220,117,184,75,40,33,138,82,194,153,34,92,10,74,57,131,16,76,49,74,164,103,243,40,152,124,112,252,30,32,122,82,210,129,210,29,136,38,4,129,232,61,76,112,202,9,227,146,186,210,241,66,123,19,231,151,40,201,23,41,41,226,197,181,205,78,140,140,240,95,191,147,62,5,168,115,237,140,21,164,21,18,146,185,61,35,14,48,198,28,233,82,
|
||||
41,160,36,65,152,183,176,223,154,120,97,51,155,215,167,8,49,165,140,250,33,85,62,148,112,123,123,251,150,10,242,87,41,5,181,80,2,117,51,10,62,224,161,168,116,137,43,53,213,132,43,193,164,2,234,165,89,152,236,196,36,20,204,63,241,208,215,122,236,80,7,20,37,26,234,151,46,4,32,64,2,238,32,164,132,31,215,94,125,2,247,184,30,228,94,187,99,16,137,75,162,92,162,132,146,2,152,48,234,80,16,146,244,252,161,13,94,94,44,50,147,6,147,239,95,126,140,38,21,241,63,59,163,87,193,229,135,209,4,30,115,91,22,89,119,223,29,154,224,204,27,142,242,81,244,232,120,3,253,26,250,96,81,148,135,89,24,69,253,253,241,18,92,202,18,22,243,0,37,61,183,162,238,62,187,136,138,48,106,134,205,240,184,237,14,237,30,69,42,214,38,106,112,166,172,221,33,20,78,141,44,147,23,200,140,176,25,22,56,87,104,80,96,19,198,199,77,130,125,169,197,166,121,248,227,34,230,163,44,30,213,40,124,89,28,55,237,190,54,199,77,240,188,142,39,100,
|
||||
89,36,3,125,77,216,238,231,182,126,70,229,135,53,38,66,117,172,155,112,96,174,206,109,56,40,138,129,109,134,109,123,102,200,210,118,183,68,169,150,0,70,193,129,109,140,170,43,42,212,122,211,127,177,7,139,56,75,205,114,224,104,247,57,242,84,88,225,89,81,213,131,8,56,103,90,52,229,147,53,54,199,93,170,106,155,34,85,154,4,241,74,240,76,37,253,86,67,67,145,52,224,192,33,138,210,212,168,242,161,157,54,37,126,223,84,200,190,105,50,172,197,34,183,201,80,255,129,141,222,175,45,154,149,36,90,117,7,68,171,140,167,120,35,45,109,119,135,60,83,208,10,239,144,102,58,67,90,180,63,143,27,139,202,136,142,219,26,141,65,4,91,224,184,197,130,162,24,221,1,70,125,151,96,87,187,195,137,123,15,166,7,243,88,68,43,220,201,100,1,155,173,153,227,19,165,219,181,123,232,121,251,235,220,153,197,21,222,231,21,148,137,235,170,13,140,95,119,55,108,194,244,226,57,55,91,24,116,176,150,237,46,183,75,212,159,110,103,167,179,124,117,17,14,170,225,
|
||||
141,188,92,71,160,245,255,117,124,34,117,126,220,78,255,81,8,126,3,140,210,145,107,
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue