SDraw dashes

git-svn-id: svn://ultimatepp.org/upp/trunk@725 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-01-04 14:07:33 +00:00
parent 3cb711b605
commit 7af4ea01e7
29 changed files with 181062 additions and 697 deletions

View file

@ -232,7 +232,7 @@ struct App : TopWindow {
w.DrawRect(sz, White());
PaintLion(&w);
}
App() { Sizeable().Zoomable(); p = Point(0, 0); }
};

View file

@ -75,7 +75,7 @@ void SDraw::DrawLineOp(int x1, int y1, int x2, int y2, int width, Color color)
{
Move(x1, y1);
Line(x2, y2);
Stroke(color, width);
Stroke(width, color);
}
void SDraw::DrawPolyPolylineOp(const Point *vertices, int vertex_count, const int *counts, int count_count, int width, Color color, Color doxor)

View file

@ -46,7 +46,6 @@ void RenderCharPath(const char* gbuf, unsigned total_size, SDraw& sw, double xx,
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;
}
@ -56,6 +55,7 @@ void RenderCharPath(const char* gbuf, unsigned total_size, SDraw& sw, double xx,
}
cur_poly += sizeof(WORD) * 2 + sizeof(POINTFX) * pc->cpfx;
}
sw.Close();
cur_glyph += th->cb;
}
}
@ -107,6 +107,7 @@ SDraw& SDraw::Character(double x, double y, int ch, Font fnt)
s = cache.Get(h);
}
RenderCharPath(s, s.GetLength(), *this, x, y);
EvenOdd(true);
return *this;
}

View file

@ -1,134 +1,134 @@
#include "SDraw.h"
NAMESPACE_UPP
#ifdef PLATFORM_X11
static inline double ft_dbl(int p)
{
return double(p) / 64.0;
}
bool RenderOutline(const FT_Outline& outline, SDraw& path)
{
FT_Vector v_last;
FT_Vector v_control;
FT_Vector v_start;
double x1, y1, x2, y2, x3, y3;
FT_Vector* point;
FT_Vector* limit;
char* tags;
int n; // index of contour in outline
char tag; // current point's state
int first = 0; // index of first point in contour
for(n = 0; n < outline.n_contours; n++) {
int last = outline.contours[n];
limit = outline.points + last;
v_start = outline.points[first];
v_last = outline.points[last];
v_control = v_start;
point = outline.points + first;
tags = outline.tags + first;
tag = FT_CURVE_TAG(tags[0]);
if(tag == FT_CURVE_TAG_CUBIC) return false;
if(tag == FT_CURVE_TAG_CONIC) {
if(FT_CURVE_TAG(outline.tags[last]) == FT_CURVE_TAG_ON) {
// start at last point if it is on the curve
v_start = v_last;
limit--;
}
else {
// if both first and last points are conic,
// start at their middle and record its position
// for closure
v_start.x = (v_start.x + v_last.x) / 2;
v_start.y = (v_start.y + v_last.y) / 2;
v_last = v_start;
}
point--;
tags--;
}
path.MoveTo(ft_dbl(v_start.x), -ft_dbl(v_start.y));
while(point < limit) {
point++;
tags++;
tag = FT_CURVE_TAG(tags[0]);
switch(tag) {
case FT_CURVE_TAG_ON:
path.LineTo(ft_dbl(point->x), -ft_dbl(point->y));
continue;
case FT_CURVE_TAG_CONIC:
v_control.x = point->x;
v_control.y = point->y;
Do_Conic:
if(point < limit) {
FT_Vector vec;
FT_Vector v_middle;
point++;
tags++;
tag = FT_CURVE_TAG(tags[0]);
vec.x = point->x;
vec.y = point->y;
if(tag == FT_CURVE_TAG_ON) {
path.Quadratic(ft_dbl(v_control.x), -ft_dbl(v_control.y),
ft_dbl(vec.x), -ft_dbl(vec.y));
continue;
}
if(tag != FT_CURVE_TAG_CONIC) return false;
v_middle.x = (v_control.x + vec.x) / 2;
v_middle.y = (v_control.y + vec.y) / 2;
path.Quadratic(ft_dbl(v_control.x), -ft_dbl(v_control.y),
ft_dbl(v_middle.x), -ft_dbl(v_middle.y));
v_control = vec;
goto Do_Conic;
}
path.Quadratic(ft_dbl(v_control.x), -ft_dbl(v_control.y),
ft_dbl(v_start.x), -ft_dbl(v_start.y));
goto Close;
default:
FT_Vector vec1, vec2;
if(point + 1 > limit || FT_CURVE_TAG(tags[1]) != FT_CURVE_TAG_CUBIC)
return false;
vec1.x = point[0].x;
vec1.y = point[0].y;
vec2.x = point[1].x;
vec2.y = point[1].y;
point += 2;
tags += 2;
if(point <= limit) {
FT_Vector vec;
vec.x = point->x;
vec.y = point->y;
path.Cubic(ft_dbl(vec1.x), -ft_dbl(vec1.y),
ft_dbl(vec2.x), -ft_dbl(vec2.y),
ft_dbl(vec.x), -ft_dbl(vec.y));
continue;
}
path.Cubic(ft_dbl(vec1.x), -ft_dbl(vec1.y),
ft_dbl(vec2.x), -ft_dbl(vec2.y),
ft_dbl(v_start.x), -ft_dbl(v_start.y));
goto Close;
}
}
path.Close();
Close:
first = last + 1;
}
return true;
}
void RenderCharacter(SDraw& sw, int ch, Font fnt)
{
FontInfo fi = fnt.Info();
FT_Face face = XftLockFace(fi.GetXftFont());
int glyph_index = FT_Get_Char_Index(face, ch);
if(FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT) == 0)
RenderOutline(face->glyph->outline, sw);
XftUnlockFace(fi.GetXftFont());
}
#endif
END_UPP_NAMESPACE
#include "SDraw.h"
NAMESPACE_UPP
#ifdef PLATFORM_X11
static inline double ft_dbl(int p)
{
return double(p) / 64.0;
}
bool RenderOutline(const FT_Outline& outline, SDraw& path)
{
FT_Vector v_last;
FT_Vector v_control;
FT_Vector v_start;
double x1, y1, x2, y2, x3, y3;
FT_Vector* point;
FT_Vector* limit;
char* tags;
int n; // index of contour in outline
char tag; // current point's state
int first = 0; // index of first point in contour
for(n = 0; n < outline.n_contours; n++) {
int last = outline.contours[n];
limit = outline.points + last;
v_start = outline.points[first];
v_last = outline.points[last];
v_control = v_start;
point = outline.points + first;
tags = outline.tags + first;
tag = FT_CURVE_TAG(tags[0]);
if(tag == FT_CURVE_TAG_CUBIC) return false;
if(tag == FT_CURVE_TAG_CONIC) {
if(FT_CURVE_TAG(outline.tags[last]) == FT_CURVE_TAG_ON) {
// start at last point if it is on the curve
v_start = v_last;
limit--;
}
else {
// if both first and last points are conic,
// start at their middle and record its position
// for closure
v_start.x = (v_start.x + v_last.x) / 2;
v_start.y = (v_start.y + v_last.y) / 2;
v_last = v_start;
}
point--;
tags--;
}
path.MoveTo(ft_dbl(v_start.x), -ft_dbl(v_start.y));
while(point < limit) {
point++;
tags++;
tag = FT_CURVE_TAG(tags[0]);
switch(tag) {
case FT_CURVE_TAG_ON:
path.LineTo(ft_dbl(point->x), -ft_dbl(point->y));
continue;
case FT_CURVE_TAG_CONIC:
v_control.x = point->x;
v_control.y = point->y;
Do_Conic:
if(point < limit) {
FT_Vector vec;
FT_Vector v_middle;
point++;
tags++;
tag = FT_CURVE_TAG(tags[0]);
vec.x = point->x;
vec.y = point->y;
if(tag == FT_CURVE_TAG_ON) {
path.Quadratic(ft_dbl(v_control.x), -ft_dbl(v_control.y),
ft_dbl(vec.x), -ft_dbl(vec.y));
continue;
}
if(tag != FT_CURVE_TAG_CONIC) return false;
v_middle.x = (v_control.x + vec.x) / 2;
v_middle.y = (v_control.y + vec.y) / 2;
path.Quadratic(ft_dbl(v_control.x), -ft_dbl(v_control.y),
ft_dbl(v_middle.x), -ft_dbl(v_middle.y));
v_control = vec;
goto Do_Conic;
}
path.Quadratic(ft_dbl(v_control.x), -ft_dbl(v_control.y),
ft_dbl(v_start.x), -ft_dbl(v_start.y));
goto Close;
default:
FT_Vector vec1, vec2;
if(point + 1 > limit || FT_CURVE_TAG(tags[1]) != FT_CURVE_TAG_CUBIC)
return false;
vec1.x = point[0].x;
vec1.y = point[0].y;
vec2.x = point[1].x;
vec2.y = point[1].y;
point += 2;
tags += 2;
if(point <= limit) {
FT_Vector vec;
vec.x = point->x;
vec.y = point->y;
path.Cubic(ft_dbl(vec1.x), -ft_dbl(vec1.y),
ft_dbl(vec2.x), -ft_dbl(vec2.y),
ft_dbl(vec.x), -ft_dbl(vec.y));
continue;
}
path.Cubic(ft_dbl(vec1.x), -ft_dbl(vec1.y),
ft_dbl(vec2.x), -ft_dbl(vec2.y),
ft_dbl(v_start.x), -ft_dbl(v_start.y));
goto Close;
}
}
Close:
path.Close();
first = last + 1;
}
return true;
}
void RenderCharacter(SDraw& sw, int ch, Font fnt)
{
FontInfo fi = fnt.Info();
FT_Face face = XftLockFace(fi.GetXftFont());
int glyph_index = FT_Get_Char_Index(face, ch);
if(FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT) == 0)
RenderOutline(face->glyph->outline, sw);
XftUnlockFace(fi.GetXftFont());
}
#endif
END_UPP_NAMESPACE

32
uppdev/SDraw/Matrix2D.cpp Normal file
View file

@ -0,0 +1,32 @@
#include "SDraw.h"
NAMESPACE_UPP
Matrix2D Translate2D(double x, double y)
{
Matrix2D m;
m.tx = x;
m.ty = y;
return m;
}
Matrix2D Rotate2D(double angle)
{
Matrix2D m;
*(agg::trans_affine *)&m = agg::trans_affine_rotation(angle);
return m;
}
Matrix2D Scale2D(double scalex, double scaley)
{
Matrix2D m;
*(agg::trans_affine *)&m = agg::trans_affine_scaling(scalex, scaley);
return m;
}
Matrix2D Scale2D(double scale)
{
return Scale2D(scale, scale);
}
END_UPP_NAMESPACE

View file

@ -4,7 +4,7 @@ NAMESPACE_UPP
#define LTIMING(x) RTIMING(x)
inline void SDraw::PathPoint(double x, double y)
void SDraw::PathPoint(double x, double y)
{
if(inpath) {
pathrect.left = min(pathrect.left, x);
@ -16,6 +16,7 @@ inline void SDraw::PathPoint(double x, double y)
path.remove_all();
pathrect.left = pathrect.right = x;
pathrect.top = pathrect.bottom = y;
pathattr = attr;
}
inpath = true;
current = Pointf(x, y);
@ -87,7 +88,7 @@ SDraw& SDraw::Close()
inline void SDraw::MinMax(Pointf& minv, Pointf& maxv, Pointf p) const
{
p = attr.mtx.Transformed(p);
p = pathattr.mtx.Transformed(p);
minv.x = min(minv.x, p.x);
minv.y = min(minv.y, p.y);
maxv.x = max(maxv.x, p.x);
@ -96,11 +97,11 @@ inline void SDraw::MinMax(Pointf& minv, Pointf& maxv, Pointf p) const
bool SDraw::PathVisible(double w) const
{
Pointf h = attr.mtx.Transformed(w, w);
Pointf h = pathattr.mtx.Transformed(w, w);
w = max(abs(h.x), abs(h.y));
Pointf min;
Pointf max;
min = max = attr.mtx.Transformed(pathrect.TopLeft());
min = max = pathattr.mtx.Transformed(pathrect.TopLeft());
MinMax(min, max, pathrect.TopRight());
MinMax(min, max, pathrect.BottomLeft());
MinMax(min, max, pathrect.BottomRight());
@ -114,30 +115,19 @@ SDraw& SDraw::Fill(const RGBA& color)
path.close_polygon();
if(PathVisible(0)) {
rasterizer.reset();
rasterizer.filling_rule(attr.evenodd ? agg::fill_even_odd : agg::fill_non_zero);
rasterizer.filling_rule(pathattr.evenodd ? agg::fill_even_odd : agg::fill_non_zero);
rasterizer.add_path(curved_trans);
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 *)&color);
agg::render_scanlines(rasterizer, sl, renderer);
}
else {
rendererb.color(*(color_type *)&color);
agg::render_scanlines(rasterizer, sl, rendererb);
}
}
else
if(attr.antialiased) {
renderer.color(*(color_type *)&color);
agg::render_scanlines(rasterizer, scanline_p, renderer);
agg::render_scanlines(rasterizer, sl, renderer);
}
else {
rendererb.color(*(color_type *)&color);
agg::render_scanlines(rasterizer, scanline_p, rendererb);
renderer.color(*(color_type *)&color);
agg::render_scanlines(rasterizer, scanline_p, renderer);
}
rasterizer.reset();
}
@ -164,29 +154,22 @@ SDraw& SDraw::FillMask(int alpha)
if(inpath)
path.close_polygon();
rasterizer.reset();
rasterizer.filling_rule(attr.evenodd ? agg::fill_even_odd : agg::fill_non_zero);
rasterizer.filling_rule(pathattr.evenodd ? agg::fill_even_odd : agg::fill_non_zero);
rasterizer.add_path(curved_trans);
if(attr.antialiased) {
agg::renderer_scanline_aa_solid<ren_base> r(rb);
r.color(agg::gray8(alpha, 255));
agg::render_scanlines(rasterizer, sl, r);
}
else {
agg::renderer_scanline_bin_solid<ren_base> r(rb);
r.color(agg::gray8(alpha, 255));
agg::render_scanlines(rasterizer, sl, r);
}
agg::renderer_scanline_aa_solid<ren_base> r(rb);
r.color(agg::gray8(alpha, 255));
agg::render_scanlines(rasterizer, sl, r);
rasterizer.reset();
inpath = false;
return *this;
}
SDraw& SDraw::Fill(const Image& image, const Matrix2D& transsrc, int alpha, dword flags)
SDraw& SDraw::Fill(const Image& image, const Matrix2D& transsrc, dword flags, int alpha)
{
if(image.GetWidth() == 0 || image.GetHeight() == 0)
return *this;
span_alloc sa;
Matrix2D m = attr.mtx * transsrc;
Matrix2D m = pathattr.mtx * transsrc;
m.invert();
interpolator_type interpolator(m);
Size isz = image.GetSize();
@ -195,7 +178,7 @@ SDraw& SDraw::Fill(const Image& image, const Matrix2D& transsrc, int alpha, dwor
if(inpath)
path.close_polygon();
rasterizer.reset();
rasterizer.filling_rule(attr.evenodd ? agg::fill_even_odd : agg::fill_non_zero);
rasterizer.filling_rule(pathattr.evenodd ? agg::fill_even_odd : agg::fill_non_zero);
path.arrange_orientations_all_paths(agg::path_flags_cw);
rasterizer.add_path(curved_trans);
span_gen_type sg(img_pixf, agg::rgba8_pre(0, 0, 0, 0), interpolator);
@ -215,75 +198,78 @@ SDraw& SDraw::Fill(const Image& image, const Matrix2D& transsrc, int alpha, dwor
return *this;
}
SDraw& SDraw::Stroke(const RGBA& color, double width)
SDraw::path_storage SDraw::MakeStroke(double width)
{
double scl = attr.mtx.scale();
double scl = pathattr.mtx.scale();
curved.approximation_scale(scl);
curved.angle_tolerance(0.0);
curved_stroked.width(width);
curved_stroked.line_join((agg::line_join_e)attr.join);
curved_stroked.line_cap((agg::line_cap_e)attr.cap);
curved_stroked.miter_limit(attr.miter_limit);
curved_stroked.approximation_scale(scl);
if(width * scl > 1.0)
curved.angle_tolerance(0.2);
rasterizer.reset();
rasterizer.filling_rule(agg::fill_non_zero);
inpath = false;
path_storage b;
b.concat_path(curved_stroked);
b.Swap(path);
Fill(color);
b.Swap(path);
return *this;
/*
rasterizer.add_path(curved_stroked_trans);
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 *)&color);
agg::render_scanlines(rasterizer, sl, renderer);
}
else {
rendererb.color(*(color_type *)&color);
agg::render_scanlines(rasterizer, sl, rendererb);
}
}
else
if(attr.antialiased) {
renderer.color(*(color_type *)&color);
agg::render_scanlines(rasterizer, scanline_p, renderer);
if(pathattr.dash.GetCount()) {
agg::conv_dash<Curved> dashed(curved);
dashed.Set(&pathattr.dash, pathattr.dash_start);
agg::conv_stroke<agg::conv_dash<Curved>> curved_stroked(dashed);
curved_stroked.width(width);
curved_stroked.line_join((agg::line_join_e)pathattr.join);
curved_stroked.line_cap((agg::line_cap_e)pathattr.cap);
curved_stroked.miter_limit(pathattr.miter_limit);
curved_stroked.approximation_scale(scl);
b.concat_path(curved_stroked);
}
else {
rendererb.color(*(color_type *)&color);
agg::render_scanlines(rasterizer, scanline_p, rendererb);
agg::conv_stroke<Curved> curved_stroked(curved);
curved_stroked.width(width);
curved_stroked.line_join((agg::line_join_e)pathattr.join);
curved_stroked.line_cap((agg::line_cap_e)pathattr.cap);
curved_stroked.miter_limit(pathattr.miter_limit);
curved_stroked.approximation_scale(scl);
b.concat_path(curved_stroked);
}
rasterizer.reset();
return b;
}
SDraw& SDraw::Stroke(double width, const RGBA& color)
{
path_storage b = MakeStroke(width);
Swap(b, path);
inpath = false;
return *this;*/
Fill(color);
Swap(b, path);
return *this;
}
SDraw& SDraw::Stroke(double width, const Image& image, const Matrix2D& transsrc,
dword flags, int alpha)
{
path_storage b = MakeStroke(width);
Swap(b, path);
inpath = false;
Fill(image, transsrc, flags, alpha);
Swap(b, path);
return *this;
}
void SDraw::Translate(double x, double y)
{
Apply(Translate2D(x, y));
Transform(Translate2D(x, y));
}
void SDraw::Rotate(double a)
{
attr.mtx *= agg::trans_affine_rotation(a);
Transform(Rotate2D(a));
}
void SDraw::Scale(double scalex, double scaley)
{
attr.mtx *= agg::trans_affine_scaling(scalex, scaley);
Transform(Scale2D(scalex, scaley));
}
void SDraw::Scale(double scale)
{
attr.mtx *= agg::trans_affine_scaling(scale);
Transform(Scale2D(scale));
}
void SDraw::Begin()
@ -300,10 +286,42 @@ void SDraw::End()
attr = attrstack.Pop();
}
void SDraw::Transform(const Matrix2D& m) { Cttr().mtx = m * attr.mtx; }
SDraw& SDraw::LineCap(int linecap) { Cttr().cap = linecap; return *this; }
SDraw& SDraw::LineJoin(int linejoin) { Cttr().join = linejoin; return *this; }
SDraw& SDraw::MiterLimit(double l) { Cttr().miter_limit = l; return *this; }
SDraw& SDraw::EvenOdd(bool evenodd) { Cttr().evenodd = evenodd; return *this; }
SDraw& SDraw::Dash(const Vector<double>& dash, double start)
{
Attr& a = Cttr();
a.dash <<= dash;
if(dash.GetCount() & 1)
a.dash.Append(dash);
a.dash_start = start;
return *this;
}
SDraw& SDraw::Dash(const char *dash, double start)
{
Vector<double> d;
CParser p(dash);
try {
while(!p.IsEof())
if(p.Char(':'))
start = p.ReadDouble();
else
d.Add(p.ReadDouble());
}
catch(CParser::Error) {}
Dash(d, start);
return *this;
}
SDraw::SDraw(ImageBuffer& ib)
: buffer(ib),
curved(path),
curved_stroked(curved),
curved_trans(curved, attr.mtx)
{
size = ib.GetSize();
@ -313,7 +331,6 @@ SDraw::SDraw(ImageBuffer& ib)
pixf.attach(rbuf);
renb.attach(pixf);
renderer.attach(renb);
rendererb.attach(renb);
inpath = false;
pathrect = Null;
control = current = Null;
@ -322,7 +339,7 @@ SDraw::SDraw(ImageBuffer& ib)
attr.join = LINEJOIN_MITER;
attr.miter_limit = 4;
attr.evenodd = false;
attr.antialiased = true;
attr.masklevel = 0;
}
END_UPP_NAMESPACE

View file

@ -16,8 +16,10 @@
#include "agg_scanline_u.h"
#include "agg_scanline_p.h"
#include "agg_path_storage.h"
#include "agg_conv_transform.h"
#include "agg_conv_stroke.h"
#include "agg_conv_curve.h"
#include "agg_conv_dash.h"
#include "agg_span_allocator.h"
#include "agg_span_interpolator_linear.h"
#include "agg_image_accessors.h"
@ -35,9 +37,10 @@ struct Matrix2D : agg::trans_affine {
Matrix2D Inverted() const { Matrix2D h = *this; h.invert(); return h; }
};
struct Translate2D : Matrix2D {
Translate2D(double x, double y) { tx = x; ty = y; }
};
Matrix2D Translate2D(double x, double y);
Matrix2D Rotate2D(double angle);
Matrix2D Scale2D(double scalex, double scaley);
Matrix2D Scale2D(double scale);
enum {
LINECAP_BUTT = agg::butt_cap,
@ -116,9 +119,7 @@ private:
*y = v[i].y;
return c[i];
}
unsigned command(unsigned i) const { return c[i]; }
void Swap(vertex_upp_storage& b) { UPP::Swap(v, b.v); UPP::Swap(c, b.c); }
unsigned command(unsigned i) const { return i < c.GetCount() ? c[i] : agg::path_cmd_stop; }
};
typedef agg::path_base<vertex_upp_storage> path_storage;
@ -126,7 +127,6 @@ private:
typedef agg::pixfmt_rgba32_pre pixfmt;
typedef agg::rgba8 color_type;
typedef agg::renderer_base<agg::pixfmt_rgba32_pre> renderer_base;
typedef agg::renderer_scanline_bin_solid<renderer_base> renderer_solid_bin;
typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_solid;
typedef agg::span_interpolator_linear<> interpolator_type;
typedef agg::image_accessor_clip<pixfmt> img_source_type;
@ -140,15 +140,19 @@ private:
Array< Buffer<byte> > mask;
struct Attr : Moveable<Attr> {
Matrix2D mtx;
bool evenodd;
byte join;
byte cap;
double miter_limit;
bool antialiased;
Matrix2D mtx;
bool evenodd;
byte join;
byte cap;
double miter_limit;
WithDeepCopy< Vector<double> > dash;
double dash_start;
int masklevel;
bool hasmask;
};
Attr attr;
Attr pathattr;
Vector<Attr> attrstack;
path_storage path;
@ -159,15 +163,12 @@ private:
agg::scanline_p8 scanline_p;
renderer_base renb;
renderer_solid renderer;
renderer_solid_bin rendererb;
agg::pixfmt_rgba32_pre pixf;
typedef agg::conv_curve<path_storage> Curved;
typedef agg::conv_stroke<Curved> CurvedStroked;
typedef agg::conv_transform<Curved> CurvedTrans;
Curved curved;
CurvedStroked curved_stroked;
CurvedTrans curved_trans;
Rectf pathrect;
@ -180,11 +181,10 @@ private:
Pointf Reflection() const;
Pointf Current() const { return current; }
Rectf PathRect() const { return pathrect; }
Attr& Cttr() { return inpath ? pathattr : attr; }
path_storage MakeStroke(double width);
public:
void Begin();
void End();
SDraw& Move(double x, double y);
SDraw& Line(double x, double y);
SDraw& Quadratic(double x1, double y1, double x, double y);
@ -193,12 +193,15 @@ public:
SDraw& Cubic(double x2, double y2, double x, double y);
SDraw& Close();
SDraw& Fill(const Image& image, const Matrix2D& transsrc = Matrix2D(),
int alpha = 255, dword flags = false);
SDraw& FillMask(int alpha);
SDraw& Fill(const RGBA& rgba);
SDraw& Stroke(const RGBA& rgba, double width);
SDraw& Fill(const Image& image, const Matrix2D& transsrc = Matrix2D(),
dword flags = 0, int alpha = 255);
SDraw& Stroke(double width, const RGBA& rgba);
SDraw& Stroke(double width, const Image& image, const Matrix2D& transsrc,
dword flags = 0, int alpha = 255);
SDraw& FillMask(int alpha);
SDraw& Arc(double x, double y, double rx, double ry,
double start_angle, double sweep_angle, bool startline = false);
@ -209,24 +212,26 @@ public:
SDraw& Text(double x, double y, const String& s, Font fnt, double *dx = NULL);
SDraw& Text(double x, double y, const char *text, Font fnt, int n = -1, double *dx = NULL);
SDraw& LineCap(int linecap) { attr.cap = linecap; return *this; }
SDraw& LineJoin(int linejoin) { attr.join = linejoin; return *this; }
SDraw& MiterLimit(double l) { attr.miter_limit = l; return *this; }
SDraw& EvenOdd(bool evenodd) { attr.evenodd = evenodd; return *this; }
SDraw& AntiAliased(bool aa) { attr.antialiased = aa; return *this; }
SDraw& LineCap(int linecap);
SDraw& LineJoin(int linejoin);
SDraw& MiterLimit(double l);
SDraw& EvenOdd(bool evenodd);
SDraw& Dash(const Vector<double>& dash, double start = 0);
SDraw& Dash(const char *dash, double start = 0);
void Transform(const Matrix2D& m);
void Begin();
void End();
void Translate(double x, double y);
void Rotate(double a);
void Scale(double scalex, double scaley);
void Scale(double scale);
void Apply(const Matrix2D& m) { attr.mtx *= m; }
void operator*=(const Matrix2D& m) { Apply(m); }
SDraw(ImageBuffer& ib);
};
END_UPP_NAMESPACE
#endif

View file

@ -2,6 +2,7 @@ optimize_speed;
file
SDraw.h,
Matrix2D.cpp,
SDraw.cpp,
FontX11.cpp,
FontWin32.cpp,
@ -12,14 +13,13 @@ file
agg_array.h,
agg_alpha_mask_u8.h,
agg_basics.h,
agg_bezier_arc.h,
agg_bezier_arc.cpp,
agg_clip_liang_barsky.h,
agg_color_rgba.h,
agg_color_gray.h,
agg_config.h,
agg_conv_adaptor_vcgen.h,
agg_conv_curve.h,
agg_conv_dash.h,
agg_conv_stroke.h,
agg_conv_transform.h,
agg_curves.h,
@ -41,7 +41,6 @@ file
agg_renderer_scanline.h,
agg_rendering_buffer.h,
agg_scanline_p.h,
agg_scanline_u.h,
agg_span_allocator.h,
agg_span_image_filter.h,
agg_span_image_filter_upp.h,
@ -51,5 +50,7 @@ file
agg_shorten_path.h,
agg_vcgen_stroke.h,
agg_vcgen_stroke.cpp,
agg_vcgen_dash.h,
agg_vcgen_dash.cpp,
agg_vertex_sequence.h;

View file

@ -1,258 +0,0 @@
//----------------------------------------------------------------------------
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
//----------------------------------------------------------------------------
// Contact: mcseem@antigrain.com
// 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.
//
//----------------------------------------------------------------------------
#include <math.h>
#include "agg_bezier_arc.h"
namespace agg
{
// This epsilon is used to prevent us from adding degenerate curves
// (converging to a single point).
// The value isn't very critical. Function arc_to_bezier() has a limit
// of the sweep_angle. If fabs(sweep_angle) exceeds pi/2 the curve
// becomes inaccurate. But slight exceeding is quite appropriate.
//-------------------------------------------------bezier_arc_angle_epsilon
const double bezier_arc_angle_epsilon = 0.01;
//------------------------------------------------------------arc_to_bezier
void arc_to_bezier(double cx, double cy, double rx, double ry,
double start_angle, double sweep_angle,
double* curve)
{
double x0 = cos(sweep_angle / 2.0);
double y0 = sin(sweep_angle / 2.0);
double tx = (1.0 - x0) * 4.0 / 3.0;
double ty = y0 - tx * x0 / y0;
double px[4];
double py[4];
px[0] = x0;
py[0] = -y0;
px[1] = x0 + tx;
py[1] = -ty;
px[2] = x0 + tx;
py[2] = ty;
px[3] = x0;
py[3] = y0;
double sn = sin(start_angle + sweep_angle / 2.0);
double cs = cos(start_angle + sweep_angle / 2.0);
unsigned i;
for(i = 0; i < 4; i++)
{
curve[i * 2] = cx + rx * (px[i] * cs - py[i] * sn);
curve[i * 2 + 1] = cy + ry * (px[i] * sn + py[i] * cs);
}
}
//------------------------------------------------------------------------
void bezier_arc::init(double x, double y,
double rx, double ry,
double start_angle,
double sweep_angle)
{
start_angle = fmod(start_angle, 2.0 * pi);
if(sweep_angle >= 2.0 * pi) sweep_angle = 2.0 * pi;
if(sweep_angle <= -2.0 * pi) sweep_angle = -2.0 * pi;
if(fabs(sweep_angle) < 1e-10)
{
m_num_vertices = 4;
m_cmd = path_cmd_line_to;
m_vertices[0] = x + rx * cos(start_angle);
m_vertices[1] = y + ry * sin(start_angle);
m_vertices[2] = x + rx * cos(start_angle + sweep_angle);
m_vertices[3] = y + ry * sin(start_angle + sweep_angle);
return;
}
double total_sweep = 0.0;
double local_sweep = 0.0;
double prev_sweep;
m_num_vertices = 2;
m_cmd = path_cmd_curve4;
bool done = false;
do
{
if(sweep_angle < 0.0)
{
prev_sweep = total_sweep;
local_sweep = -pi * 0.5;
total_sweep -= pi * 0.5;
if(total_sweep <= sweep_angle + bezier_arc_angle_epsilon)
{
local_sweep = sweep_angle - prev_sweep;
done = true;
}
}
else
{
prev_sweep = total_sweep;
local_sweep = pi * 0.5;
total_sweep += pi * 0.5;
if(total_sweep >= sweep_angle - bezier_arc_angle_epsilon)
{
local_sweep = sweep_angle - prev_sweep;
done = true;
}
}
arc_to_bezier(x, y, rx, ry,
start_angle,
local_sweep,
m_vertices + m_num_vertices - 2);
m_num_vertices += 6;
start_angle += local_sweep;
}
while(!done && m_num_vertices < 26);
}
//--------------------------------------------------------------------
void bezier_arc_svg::init(double x0, double y0,
double rx, double ry,
double angle,
bool large_arc_flag,
bool sweep_flag,
double x2, double y2)
{
m_radii_ok = true;
if(rx < 0.0) rx = -rx;
if(ry < 0.0) ry = -rx;
// Calculate the middle point between
// the current and the final points
//------------------------
double dx2 = (x0 - x2) / 2.0;
double dy2 = (y0 - y2) / 2.0;
double cos_a = cos(angle);
double sin_a = sin(angle);
// Calculate (x1, y1)
//------------------------
double x1 = cos_a * dx2 + sin_a * dy2;
double y1 = -sin_a * dx2 + cos_a * dy2;
// Ensure radii are large enough
//------------------------
double prx = rx * rx;
double pry = ry * ry;
double px1 = x1 * x1;
double py1 = y1 * y1;
// Check that radii are large enough
//------------------------
double radii_check = px1/prx + py1/pry;
if(radii_check > 1.0)
{
rx = sqrt(radii_check) * rx;
ry = sqrt(radii_check) * ry;
prx = rx * rx;
pry = ry * ry;
if(radii_check > 10.0) m_radii_ok = false;
}
// Calculate (cx1, cy1)
//------------------------
double sign = (large_arc_flag == sweep_flag) ? -1.0 : 1.0;
double sq = (prx*pry - prx*py1 - pry*px1) / (prx*py1 + pry*px1);
double coef = sign * sqrt((sq < 0) ? 0 : sq);
double cx1 = coef * ((rx * y1) / ry);
double cy1 = coef * -((ry * x1) / rx);
//
// Calculate (cx, cy) from (cx1, cy1)
//------------------------
double sx2 = (x0 + x2) / 2.0;
double sy2 = (y0 + y2) / 2.0;
double cx = sx2 + (cos_a * cx1 - sin_a * cy1);
double cy = sy2 + (sin_a * cx1 + cos_a * cy1);
// Calculate the start_angle (angle1) and the sweep_angle (dangle)
//------------------------
double ux = (x1 - cx1) / rx;
double uy = (y1 - cy1) / ry;
double vx = (-x1 - cx1) / rx;
double vy = (-y1 - cy1) / ry;
double p, n;
// Calculate the angle start
//------------------------
n = sqrt(ux*ux + uy*uy);
p = ux; // (1 * ux) + (0 * uy)
sign = (uy < 0) ? -1.0 : 1.0;
double v = p / n;
if(v < -1.0) v = -1.0;
if(v > 1.0) v = 1.0;
double start_angle = sign * acos(v);
// Calculate the sweep angle
//------------------------
n = sqrt((ux*ux + uy*uy) * (vx*vx + vy*vy));
p = ux * vx + uy * vy;
sign = (ux * vy - uy * vx < 0) ? -1.0 : 1.0;
v = p / n;
if(v < -1.0) v = -1.0;
if(v > 1.0) v = 1.0;
double sweep_angle = sign * acos(v);
if(!sweep_flag && sweep_angle > 0)
{
sweep_angle -= pi * 2.0;
}
else
if (sweep_flag && sweep_angle < 0)
{
sweep_angle += pi * 2.0;
}
// We can now build and transform the resulting arc
//------------------------
m_arc.init(0.0, 0.0, rx, ry, start_angle, sweep_angle);
trans_affine mtx = trans_affine_rotation(angle);
mtx *= trans_affine_translation(cx, cy);
for(unsigned i = 2; i < m_arc.num_vertices()-2; i += 2)
{
mtx.transform(m_arc.vertices() + i, m_arc.vertices() + i + 1);
}
// We must make sure that the starting and ending points
// exactly coincide with the initial (x0,y0) and (x2,y2)
m_arc.vertices()[0] = x0;
m_arc.vertices()[1] = y0;
if(m_arc.num_vertices() > 2)
{
m_arc.vertices()[m_arc.num_vertices() - 2] = x2;
m_arc.vertices()[m_arc.num_vertices() - 1] = y2;
}
}
}

View file

@ -1,159 +0,0 @@
//----------------------------------------------------------------------------
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
//----------------------------------------------------------------------------
// Contact: mcseem@antigrain.com
// 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.
//
//----------------------------------------------------------------------------
#ifndef AGG_BEZIER_ARC_INCLUDED
#define AGG_BEZIER_ARC_INCLUDED
#include "agg_conv_transform.h"
namespace agg
{
//-----------------------------------------------------------------------
void arc_to_bezier(double cx, double cy, double rx, double ry,
double start_angle, double sweep_angle,
double* curve);
//==============================================================bezier_arc
//
// See implemantaion agg_bezier_arc.cpp
//
class bezier_arc
{
public:
//--------------------------------------------------------------------
bezier_arc() : m_vertex(26), m_num_vertices(0), m_cmd(path_cmd_line_to) {}
bezier_arc(double x, double y,
double rx, double ry,
double start_angle,
double sweep_angle)
{
init(x, y, rx, ry, start_angle, sweep_angle);
}
//--------------------------------------------------------------------
void init(double x, double y,
double rx, double ry,
double start_angle,
double sweep_angle);
//--------------------------------------------------------------------
void rewind(unsigned)
{
m_vertex = 0;
}
//--------------------------------------------------------------------
unsigned vertex(double* x, double* y)
{
if(m_vertex >= m_num_vertices) return path_cmd_stop;
*x = m_vertices[m_vertex];
*y = m_vertices[m_vertex + 1];
m_vertex += 2;
return (m_vertex == 2) ? path_cmd_move_to : m_cmd;
}
// Supplemantary functions. num_vertices() actually returns doubled
// number of vertices. That is, for 1 vertex it returns 2.
//--------------------------------------------------------------------
unsigned num_vertices() const { return m_num_vertices; }
const double* vertices() const { return m_vertices; }
double* vertices() { return m_vertices; }
private:
unsigned m_vertex;
unsigned m_num_vertices;
double m_vertices[26];
unsigned m_cmd;
};
//==========================================================bezier_arc_svg
// Compute an SVG-style bezier arc.
//
// Computes an elliptical arc from (x1, y1) to (x2, y2). The size and
// orientation of the ellipse are defined by two radii (rx, ry)
// and an x-axis-rotation, which indicates how the ellipse as a whole
// is rotated relative to the current coordinate system. The center
// (cx, cy) of the ellipse is calculated automatically to satisfy the
// constraints imposed by the other parameters.
// large-arc-flag and sweep-flag contribute to the automatic calculations
// and help determine how the arc is drawn.
class bezier_arc_svg
{
public:
//--------------------------------------------------------------------
bezier_arc_svg() : m_arc(), m_radii_ok(false) {}
bezier_arc_svg(double x1, double y1,
double rx, double ry,
double angle,
bool large_arc_flag,
bool sweep_flag,
double x2, double y2) :
m_arc(), m_radii_ok(false)
{
init(x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2);
}
//--------------------------------------------------------------------
void init(double x1, double y1,
double rx, double ry,
double angle,
bool large_arc_flag,
bool sweep_flag,
double x2, double y2);
//--------------------------------------------------------------------
bool radii_ok() const { return m_radii_ok; }
//--------------------------------------------------------------------
void rewind(unsigned)
{
m_arc.rewind(0);
}
//--------------------------------------------------------------------
unsigned vertex(double* x, double* y)
{
return m_arc.vertex(x, y);
}
// Supplemantary functions. num_vertices() actually returns doubled
// number of vertices. That is, for 1 vertex it returns 2.
//--------------------------------------------------------------------
unsigned num_vertices() const { return m_arc.num_vertices(); }
const double* vertices() const { return m_arc.vertices(); }
double* vertices() { return m_arc.vertices(); }
private:
bezier_arc m_arc;
bool m_radii_ok;
};
}
#endif

View file

@ -0,0 +1,57 @@
//----------------------------------------------------------------------------
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
//----------------------------------------------------------------------------
// Contact: mcseem@antigrain.com
// mcseemagg@yahoo.com
// http://www.antigrain.com
//----------------------------------------------------------------------------
//
// conv_dash
//
//----------------------------------------------------------------------------
#ifndef AGG_CONV_DASH_INCLUDED
#define AGG_CONV_DASH_INCLUDED
#include "agg_basics.h"
#include "agg_vcgen_dash.h"
#include "agg_conv_adaptor_vcgen.h"
namespace agg
{
//---------------------------------------------------------------conv_dash
template<class VertexSource, class Markers=null_markers>
struct conv_dash : public conv_adaptor_vcgen<VertexSource, vcgen_dash, Markers>
{
typedef Markers marker_type;
typedef conv_adaptor_vcgen<VertexSource, vcgen_dash, Markers> base_type;
conv_dash(VertexSource& vs) :
conv_adaptor_vcgen<VertexSource, vcgen_dash, Markers>(vs)
{
}
void Set(const Upp::Vector<double> *dash, double start) {
base_type::generator().Set(dash, start);
}
void shorten(double s) { base_type::generator().shorten(s); }
double shorten() const { return base_type::generator().shorten(); }
private:
conv_dash(const conv_dash<VertexSource, Markers>&);
const conv_dash<VertexSource, Markers>&
operator = (const conv_dash<VertexSource, Markers>&);
};
}
#endif

View file

@ -20,7 +20,7 @@
#include <math.h>
#include "agg_math.h"
#include "agg_array.h"
#include "agg_bezier_arc.h"
//#include "agg_bezier_arc.h"
namespace agg
{
@ -834,9 +834,6 @@ namespace agg
}
}
// AGGUPP
void Swap(path_base& b) { UPP::Swap(m_iterator, b.m_iterator); m_vertices.Swap(b.m_vertices); }
private:
unsigned perceive_polygon_orientation(unsigned start, unsigned end);
void invert_polygon(unsigned start, unsigned end);

View file

@ -0,0 +1,224 @@
//----------------------------------------------------------------------------
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
//----------------------------------------------------------------------------
// Contact: mcseem@antigrain.com
// mcseemagg@yahoo.com
// http://www.antigrain.com
//----------------------------------------------------------------------------
//
// Line dash generator
//
//----------------------------------------------------------------------------
#include <math.h>
#include "agg_vcgen_dash.h"
#include "agg_shorten_path.h"
namespace agg
{
//------------------------------------------------------------------------
vcgen_dash::vcgen_dash() :
m_total_dash_len(0.0),
m_dash_start(0.0),
m_shorten(0.0),
m_curr_dash_start(0.0),
m_curr_dash(0),
m_src_vertices(),
m_closed(0),
m_status(initial),
m_src_vertex(0)
{
}
//------------------------------------------------------------------------
/*void vcgen_dash::remove_all_dashes()
{
m_dashes.Clear();
m_total_dash_len = 0.0;
m_curr_dash_start = 0.0;
m_curr_dash = 0;
}
*/
//------------------------------------------------------------------------
void vcgen_dash::Set(const Upp::Vector<double> *dash, double start)
{
m_dashes = dash;
m_total_dash_len += Sum0(*dash);
m_dash_start = start;
calc_dash_start(fabs(start));
}
//------------------------------------------------------------------------
void vcgen_dash::calc_dash_start(double ds)
{
m_curr_dash = 0;
m_curr_dash_start = 0.0;
while(ds > 0.0)
{
if(ds > (*m_dashes)[m_curr_dash])
{
ds -= (*m_dashes)[m_curr_dash];
++m_curr_dash;
m_curr_dash_start = 0.0;
if((int)m_curr_dash >= (*m_dashes).GetCount()) m_curr_dash = 0;
}
else
{
m_curr_dash_start = ds;
ds = 0.0;
}
}
}
//------------------------------------------------------------------------
void vcgen_dash::remove_all()
{
m_status = initial;
m_src_vertices.remove_all();
m_closed = 0;
}
//------------------------------------------------------------------------
void vcgen_dash::add_vertex(double x, double y, unsigned cmd)
{
m_status = initial;
if(is_move_to(cmd))
{
m_src_vertices.modify_last(vertex_dist(x, y));
}
else
{
if(is_vertex(cmd))
{
m_src_vertices.add(vertex_dist(x, y));
}
else
{
m_closed = get_close_flag(cmd);
}
}
}
//------------------------------------------------------------------------
void vcgen_dash::rewind(unsigned)
{
if(m_status == initial)
{
m_src_vertices.close(m_closed != 0);
shorten_path(m_src_vertices, m_shorten, m_closed);
}
m_status = ready;
m_src_vertex = 0;
}
//------------------------------------------------------------------------
unsigned vcgen_dash::vertex(double* x, double* y)
{
unsigned cmd = path_cmd_move_to;
while(!is_stop(cmd))
{
switch(m_status)
{
case initial:
rewind(0);
case ready:
if((*m_dashes).GetCount() < 2 || m_src_vertices.size() < 2)
{
cmd = path_cmd_stop;
break;
}
m_status = polyline;
m_src_vertex = 1;
m_v1 = &m_src_vertices[0];
m_v2 = &m_src_vertices[1];
m_curr_rest = m_v1->dist;
*x = m_v1->x;
*y = m_v1->y;
if(m_dash_start >= 0.0) calc_dash_start(m_dash_start);
return path_cmd_move_to;
case polyline:
{
double dash_rest = (*m_dashes)[m_curr_dash] - m_curr_dash_start;
unsigned cmd = (m_curr_dash & 1) ?
path_cmd_move_to :
path_cmd_line_to;
if(m_curr_rest > dash_rest)
{
m_curr_rest -= dash_rest;
++m_curr_dash;
if((int)m_curr_dash >= (*m_dashes).GetCount()) m_curr_dash = 0;
m_curr_dash_start = 0.0;
*x = m_v2->x - (m_v2->x - m_v1->x) * m_curr_rest / m_v1->dist;
*y = m_v2->y - (m_v2->y - m_v1->y) * m_curr_rest / m_v1->dist;
}
else
{
m_curr_dash_start += m_curr_rest;
*x = m_v2->x;
*y = m_v2->y;
++m_src_vertex;
m_v1 = m_v2;
m_curr_rest = m_v1->dist;
if(m_closed)
{
if(m_src_vertex > m_src_vertices.size())
{
m_status = stop;
}
else
{
m_v2 = &m_src_vertices
[
(m_src_vertex >= m_src_vertices.size()) ? 0 :
m_src_vertex
];
}
}
else
{
if(m_src_vertex >= m_src_vertices.size())
{
m_status = stop;
}
else
{
m_v2 = &m_src_vertices[m_src_vertex];
}
}
}
return cmd;
}
break;
case stop:
cmd = path_cmd_stop;
break;
}
}
return path_cmd_stop;
}
}

View file

@ -0,0 +1,87 @@
//----------------------------------------------------------------------------
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
//----------------------------------------------------------------------------
// Contact: mcseem@antigrain.com
// mcseemagg@yahoo.com
// http://www.antigrain.com
//----------------------------------------------------------------------------
//
// Line dash generator
//
//----------------------------------------------------------------------------
#ifndef AGG_VCGEN_DASH_INCLUDED
#define AGG_VCGEN_DASH_INCLUDED
#include "agg_basics.h"
#include "agg_vertex_sequence.h"
#include <Core/Core.h>
namespace agg
{
//---------------------------------------------------------------vcgen_dash
//
// See Implementation agg_vcgen_dash.cpp
//
class vcgen_dash
{
enum status_e
{
initial,
ready,
polyline,
stop
};
public:
typedef vertex_sequence<vertex_dist, 6> vertex_storage;
vcgen_dash();
void Set(const Upp::Vector<double> *dash, double start);
void shorten(double s) { m_shorten = s; }
double shorten() const { return m_shorten; }
// Vertex Generator Interface
void remove_all();
void add_vertex(double x, double y, unsigned cmd);
// Vertex Source Interface
void rewind(unsigned path_id);
unsigned vertex(double* x, double* y);
private:
vcgen_dash(const vcgen_dash&);
const vcgen_dash& operator = (const vcgen_dash&);
void calc_dash_start(double ds);
const UPP::Vector<double> *m_dashes; //AGGUPP
double m_dash_start;
double m_total_dash_len;
double m_shorten;
double m_curr_dash_start;
unsigned m_curr_dash;
double m_curr_rest;
const vertex_dist* m_v1;
const vertex_dist* m_v2;
vertex_storage m_src_vertices;
unsigned m_closed;
status_e m_status;
unsigned m_src_vertex;
};
}
#endif

View file

@ -4,6 +4,7 @@ uses
file
app.tpp,
test.iml,
main.cpp charset "windows-1250";
mainconfig

View file

@ -6,6 +6,14 @@ using namespace Upp;
#define TOPICFILE <SDrawTest/app.tpp/all.i>
#include <Core/topic_group.h>
#define IMAGECLASS TestImg
#define IMAGEFILE <SDrawTest/test.iml>
#include <Draw/iml_header.h>
#define IMAGECLASS TestImg
#define IMAGEFILE <SDrawTest/test.iml>
#include <Draw/iml_source.h>
static char g_lion[] =
"f2cc99\n"
"M 69,18 L 82,8 L 99,3 L 118,5 L 135,12 L 149,21 L 156,13 L 165,9 L 177,13 L 183,28 L 180,50 L 164,91 L 155,107 L 154,114 L 151,121 L 141,127 L 139,136 L 155,206 L 157,251 L 126,342 L 133,357 L 128,376 L 83,376 L 75,368 L 67,350 L 61,350 L 53,369 L 4,369 L 2,361 L 5,354 L 12,342 L 16,321 L 4,257 L 4,244 L 7,218 L 9,179 L 26,127 L 43,93 L 32,77 L 30,70 L 24,67 L 16,49 L 17,35 L 18,23 L 30,12 L 40,7 L 53,7 L 62,12 L 69,18 L 69,18 L 69,18\n"
@ -233,27 +241,12 @@ void PaintLion(SDraw *sw, Draw *w)
w->DrawPolygon(p, color);
}
struct App : TopWindow {
Point p;
void PaintExample(SDraw& sw)
{
virtual void MouseMove(Point _p, dword keyflags) {
p = _p;
Refresh();
}
virtual void Paint(Draw& w) {
RTIMING("Paint");
Size sz = GetSize();
ImageBuffer ib(sz);
Fill(~ib, White(), ib.GetLength());
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();
@ -284,24 +277,24 @@ struct App : TopWindow {
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(100, 200).Cubic(100,100, 250,100, 250,200).Cubic(400,300, 400,200).Stroke(4, Cyan());
// 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"
sw.EvenOdd(false);
sw.Move(500, 500).Line(600, 500).Line(600, 600).Close()
.Move(520, 510).Line(580, 510).Line(580, 580).Fill(Black());
.Move(520, 510).Line(580, 510).Line(580, 570).Fill(Black());
sw.Translate(150, 0);
sw.EvenOdd(false);
sw.Move(500, 500).Line(600, 500).Line(600, 600).Close()
.Move(520, 510).Line(580, 510).Line(580, 580).Fill(Red());
.Move(580, 570).Line(580, 510).Line(520, 510).Fill(Red());
sw.Translate(150, 0);
sw.EvenOdd(true);
sw.Move(500, 500).Line(600, 500).Line(600, 600).Close()
.Move(520, 510).Line(580, 510).Line(580, 580).Fill(Blue());
.Move(520, 510).Line(580, 510).Line(580, 570).Fill(Blue());
sw.Arc(20, 30, 40, 10, 0, M_2PI).FillMask(50);
for(int i = 0; i < 0; i++) {
@ -349,7 +342,6 @@ struct App : TopWindow {
// .Stroke(Black(), 1);
#if 0
sw.EvenOdd(true);
Text(sw, p.x / 10.0, 0, "Ahoj Jáchyme jak se máš?", Roman(30));
sw.Fill(StreamRaster::LoadFileAny("U:/ImgTest/Jachym.bmp"), m, 255, true);
sw.Stroke(Black(), 1);
// sw.Fill(Black()).Stroke(LtRed(), 2);
@ -367,12 +359,36 @@ struct App : TopWindow {
sw.Fill(LtRed());
sw.Stroke(Black(), 2);
Arc(sw, 500, 300, 100, 100, 0, M_PI * 2, false);
#endif
w.DrawImage(0, 0, ib);
w.DrawText(550, 300, p.y, "R", Courier(14), Black());
sw.Text(50, 250, "Ahoj jak se máš?", Roman(300)).Dash("5 5 1 5").Stroke(1, Black());
sw.Text(50, 150, "Ahoj jak se máš?", Roman(100)).Fill(Gray()).Stroke(2, Red());
sw.Arc(800, 800, 100, 100, 0, M_PI, false).Dash("10 5 1 5").Stroke(5, Black());
sw.Text(500, 500, "HELLO WORLD!", Arial(300).Bold())
.Fill(TestImg::test(), m, true);
sw.Text(500, 800, "HELLO WORLD!", Roman(600).Bold())
.Stroke(35, Black())
.Stroke(30, TestImg::test(), m, true);
}
struct App : TopWindow {
Point p;
virtual void MouseMove(Point _p, dword keyflags) {
p = _p;
Refresh();
}
virtual void Paint(Draw& w) {
RTIMING("Paint");
Size sz = GetSize();
ImageBuffer ib(sz);
Fill(~ib, White(), ib.GetLength());
SDraw sw(ib);
sw.Scale(0.0005 * p.x);
sw.Rotate(0.01 * p.y - M_PI);
PaintExample(sw);
w.DrawImage(0, 0, ib);
ImageDraw iw(500, 500);
iw.DrawRect(0, 0, 500, 500, LtGray());
for(int i = 0; i < 1; i++) {
@ -394,6 +410,14 @@ struct App : TopWindow {
GUI_APP_MAIN
{
SetDefaultCharset(CHARSET_WIN1250);
#ifndef _DEBUG
ImageBuffer ib(500, 500);
for(int i = 0; i < 100; i++) {
RTIMING("Benchmark");
SDraw sw(ib);
PaintExample(sw);
}
#endif
App().Run();
}

179825
uppdev/SDrawTest/test.iml Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,25 @@
#include "MainWorkSpace.h"
namespace UA{
void MainWorkSpace::mainMenu(Bar& CurrentBar){
CurrentBar.Add(t_("File"), THISBACK(menuFile));
CurrentBar.Add(t_("Tools"), THISBACK(menuTools));
CurrentBar.Add(t_("Help"), THISBACK(menuHelp));
};
void MainWorkSpace::menuFile(Bar& CurrentBar){
CurrentBar.Add(t_("Exit"), UAImg::UAExitImg(), THISBACK(Exit));
};
void MainWorkSpace::menuTools(Bar& CurrentBar){
CurrentBar.Add(t_("Hide"), THISBACK(Hide));
CurrentBar.Add(t_("Minimize"), THISBACK1(Minimize, true));
CurrentBar.Add(t_("Options"), THISBACK(Options));
};
void MainWorkSpace::menuHelp(Bar& CurrentBar){
CurrentBar.Add(AsString(t_("About")) + "...", THISBACK(About));
};
};

View file

@ -0,0 +1,156 @@
#include "MainWorkSpace.h"
namespace UA{
#define IMAGECLASS UAImg
#define IMAGEFILE <UApplication/UApplication.iml>
#include <Draw/iml_source.h>
MainWorkSpace::MainWorkSpace() {
isHidden = false;
Sizeable();
Zoomable();
CtrlLayout(*this);
AddFrame(menu);
AddFrame(status);
BackPaint();
Icon(UAImg::MainIcon());
whenMinimize = THISBACK(onMinimize);
WhenClose = THISBACK(onClose);
suportedLanguagies.Add(LNGC_('E','N','U','S', CHARSET_UNICODE), ToUnicode("English", CHARSET_UNICODE));
suportedLanguagies.Add(LNGC_('R','O','R','O', CHARSET_UNICODE), ToUnicode("Română", CHARSET_UNICODE));
suportedLanguagies.Add(LNGC_('R','U','R','U', CHARSET_UNICODE), ToUnicode("Руский", CHARSET_UNICODE));
currentLanguage = GetCurrentLanguage();
if(suportedLanguagies.Find(currentLanguage)<=0){
currentLanguage = suportedLanguagies.GetKey(0);
SetLanguage(currentLanguage);
}
trayicon.WhenLeftDouble = THISBACK(launch);
trayicon.WhenBar = THISBACK(trayMenu);
trayicon.Icon(UAImg::TrayIcon());
trayiconAlwaysShowTrayIcon = false;
trayicon.Hide();
hideInTrayIconOnMinimize = false;
hideInTrayIconOnClose = false;
refreshData();
}
#ifdef PLATFORM_WIN32
LRESULT MainWorkSpace::WindowProc(UINT message, WPARAM wParam, LPARAM lParam){
if (message == WM_SYSCOMMAND && wParam == SC_MINIMIZE){
whenMinimize(); // callback
return 0;
}
TopWindow::WindowProc(message, wParam, lParam);
}
#endif
void MainWorkSpace::onClose(){
if(hideInTrayIconOnClose)
hide();
else
Exit();
}
void MainWorkSpace::Exit(){
// Bug when prompt message
if(PromptOKCancel(t_("Exit from application?"))){
Break();
};
};
void MainWorkSpace::onMinimize(){
if(hideInTrayIconOnMinimize)
hide();
};
void MainWorkSpace::Options(){
TabDlg dlg;
WithOptionsGeneralLayout<ParentCtrl> tab_options_general;
WithOptionsPluginsLayout<ParentCtrl> tab_options_plugins;
tab_options_plugins.PluginList.AddColumn(t_("Module"), 30);
tab_options_plugins.PluginList.AddColumn(t_("Name"), 35);
tab_options_plugins.PluginList.AddColumn(t_("Version"), 30);
tab_options_plugins.PluginList.AddColumn("", 5);
// tab_options_general
for(int i=0;i<suportedLanguagies.GetCount();i++){
tab_options_general.lang.Add(suportedLanguagies.GetKey(i), suportedLanguagies[i].ToString());
}
int cur_index = tab_options_general.lang.FindKey(currentLanguage);
if(cur_index>=0)
tab_options_general.lang.SetIndex(cur_index);
tab_options_general.OptionAlwaysShowTrayIcon = trayiconAlwaysShowTrayIcon;
tab_options_general.OptionHideInTrayIconOnMinimize = hideInTrayIconOnMinimize;
tab_options_general.OptionHideInTrayIconOnClose = hideInTrayIconOnClose;
// Add
dlg(tab_options_general, t_("General"))(tab_options_plugins, t_("Plugins"))
.OKCancel()
.Sizeable()
.Title(t_("Options"));
if(dlg.Execute() != IDOK)
return;
currentLanguage = ~tab_options_general.lang;
SetLanguage(currentLanguage);
refreshData();
trayiconAlwaysShowTrayIcon = ~tab_options_general.OptionAlwaysShowTrayIcon;
hideInTrayIconOnMinimize = ~tab_options_general.OptionHideInTrayIconOnMinimize;
hideInTrayIconOnClose = ~tab_options_general.OptionHideInTrayIconOnClose;
if(trayiconAlwaysShowTrayIcon){
trayicon.Show();
}else
trayicon.Hide();
};
void MainWorkSpace::refreshData(){
menu.Set(THISBACK(mainMenu));
SetAppName(t_("Ultimate Automation"));
Title(t_("Ultimate Automation"));
trayicon.Tip(t_("Ultimate Automation"));
};
void MainWorkSpace::hide(){
if(!trayicon.IsVisible()){
trayicon.Show();
};
isHidden = true;
TopWindow::Hide();
};
void MainWorkSpace::launch()
{
perform(LAUNCH);
}
void MainWorkSpace::perform(int newstate)
{
if(newstate==LAUNCH){
if(!IsOpen())
OpenMain();
Show();
SetForeground();
isHidden = false;
if(!trayiconAlwaysShowTrayIcon)
trayicon.Hide();
};
}
void MainWorkSpace::About(){
WithAboutLayout<TopWindow> dlg;
CtrlLayoutOK(dlg, t_("About"));
if(dlg.Execute() != IDOK)
return;
}
}

View file

@ -0,0 +1,58 @@
#ifndef _UApplication_MainWorkSpace_h_
#define _UApplication_MainWorkSpace_h_
#include <CtrlLib/CtrlLib.h>
namespace UA{
using namespace UPP;
#define IMAGECLASS UAImg
#define IMAGEFILE <UApplication/UApplication.iml>
#include <Draw/iml_header.h>
#define LAYOUTFILE <UApplication/UApplication.lay>
#include <CtrlCore/lay.h>
#define TFILE <UApplication/UApplication.t>
#include <Core/t.h>
class MainWorkSpace : public WithUApplicationLayout<TopWindow> {
public:
typedef MainWorkSpace CLASSNAME;
MainWorkSpace();
void Exit();
void Options();
void About();
#ifdef PLATFORM_WIN32
// Overriding default WindowProc
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
#endif
private:
enum { LAUNCH };
MenuBar menu;
StatusBar status;
int currentLanguage;
ArrayMap<int, WString> suportedLanguagies;
void mainMenu(Bar& CurrentBar);
void menuFile(Bar& CurrentBar);
void menuTools(Bar& CurrentBar);
void menuHelp(Bar& CurrentBar);
void trayMenu(Bar& CurrentBar);
void refreshData();
void hide();
void launch();
void perform(int NewState);
TrayIcon trayicon;
bool trayiconvisible;
bool trayiconAlwaysShowTrayIcon;
bool hideInTrayIconOnMinimize;
bool hideInTrayIconOnClose;
bool isHidden;
Callback whenMinimize;
void onMinimize();
void onClose();
};
};
#endif

View file

@ -0,0 +1,16 @@
#include "MainWorkSpace.h"
namespace UA{
void MainWorkSpace::trayMenu(Bar& CurrentBar){
if(isHidden)
CurrentBar.Add(t_("Show application"), THISBACK(launch));
else
CurrentBar.Add(t_("Hide application"), THISBACK(hide));
CurrentBar.Add(t_("Minimize"), THISBACK1(Minimize, true));
CurrentBar.Add(t_("Maximize"), THISBACK1(Maximize, true));
//CurrentBar.Add(t_("Restore"), THISBACK(Restore));
CurrentBar.Add(AsString(t_("About")) + "...", THISBACK(About));
CurrentBar.Add(t_("Exit"), THISBACK(Exit));
}
}

View file

@ -0,0 +1,9 @@
#ifndef _UApplication_UApplication_h
#define _UApplication_UApplication_h
#include <CtrlLib/CtrlLib.h>
#include <UApplication/MainWorkSpace.h>
#endif

View file

@ -0,0 +1,40 @@
PREMULTIPLIED
IMAGE_ID(UnloadedPlugin)
IMAGE_ID(LoadedPlugin)
IMAGE_ID(TrayIcon)
IMAGE_ID(MainIcon)
IMAGE_ID(UAExitImg)
IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,237,150,73,79,20,81,20,133,95,226,128,19,138,35,162,34,67,3,210,12,138,52,40,32,14,4,197,49,81,23)
IMAGE_DATA(46,140,194,198,173,43,249,1,66,84,68,131,162,198,104,156,135,133,137,9,81,163,11,19,19,227,194,196,184,53,186,112)
IMAGE_DATA(239,194,31,96,162,210,213,85,199,123,222,235,130,110,173,169,53,24,19,121,112,169,78,241,190,123,207,61,247,85,165,85)
IMAGE_DATA(129,42,80,65,11,242,235,21,129,80,6,235,20,20,192,41,44,132,83,84,4,103,201,18,96,254,124,96,214,172,192,28)
IMAGE_DATA(110,13,238,183,227,113,164,154,154,144,106,110,134,93,95,15,187,188,28,144,124,152,51,199,87,139,102,101,143,221,208,0)
IMAGE_DATA(107,199,14,36,15,30,212,97,109,219,6,187,177,17,118,69,5,176,120,49,48,123,246,47,188,102,23,46,132,93,91,139)
IMAGE_DATA(228,206,157,24,61,122,20,95,135,135,117,36,15,29,130,181,101,11,236,186,58,216,37,37,166,151,25,51,198,114,104,61)
IMAGE_DATA(162,203,145,255,89,173,173,72,30,62,172,185,111,253,253,248,126,236,152,214,144,234,232,64,74,52,56,101,101,112,150,46)
IMAGE_DATA(53,26,166,79,31,247,86,252,178,99,49,164,218,219,49,218,221,173,249,239,189,189,24,61,114,4,214,222,189,166,254,154)
IMAGE_DATA(53,176,171,170,140,15,212,240,19,239,136,71,244,203,218,189,27,201,158,30,173,59,185,111,31,172,237,219,145,90,191,94)
IMAGE_DATA(243,78,105,41,176,124,57,144,159,63,214,131,142,121,243,224,20,23,107,175,83,109,109,176,186,186,180,111,86,103,39,82)
IMAGE_DATA(45,45,176,101,22,78,101,37,192,57,44,90,164,235,101,213,103,63,210,23,53,232,28,137,132,174,201,158,233,189,67,221)
IMAGE_DATA(228,169,157,51,224,89,200,228,243,242,76,206,101,203,180,70,187,186,218,68,77,13,28,241,5,156,29,125,115,207,0,249)
IMAGE_DATA(41,83,178,103,48,115,166,201,65,29,210,35,231,193,158,192,153,241,12,146,101,223,212,58,117,170,231,25,208,158,112,15)
IMAGE_DATA(123,100,144,89,176,192,124,102,93,31,54,235,153,97,47,212,55,119,174,97,120,165,54,70,154,13,125,14,166,77,51,254)
IMAGE_DATA(48,151,251,57,163,223,176,149,211,243,203,151,65,94,250,199,107,173,56,174,224,21,81,132,112,95,217,89,133,216,176,66)
IMAGE_DATA(229,5,115,141,13,41,148,158,14,206,225,214,136,157,87,136,95,87,168,191,167,80,119,95,226,142,66,245,53,133,170,139)
IMAGE_DATA(146,119,208,95,11,239,85,72,189,250,187,10,137,71,10,235,158,43,180,72,36,158,40,172,125,160,80,115,67,114,92,18)
IMAGE_DATA(29,131,191,242,110,93,178,205,207,20,54,189,81,216,250,65,161,243,189,194,198,215,230,30,115,196,175,153,158,74,7,198)
IMAGE_DATA(115,184,253,82,51,235,146,221,245,73,225,0,76,116,74,158,13,47,21,26,71,20,86,75,254,170,203,198,143,149,39,199)
IMAGE_DATA(123,161,71,236,151,154,89,151,220,254,47,10,123,62,11,255,78,161,77,248,230,199,226,133,236,137,95,149,253,231,198,53)
IMAGE_DATA(48,168,137,94,177,95,106,38,79,182,235,163,194,230,183,194,191,72,215,151,61,171,174,136,79,82,175,100,32,187,62,125)
IMAGE_DATA(166,87,236,151,154,89,151,108,251,43,169,253,84,248,135,226,225,45,153,197,213,244,60,51,249,33,51,35,122,68,175,216)
IMAGE_DATA(47,53,179,46,217,196,136,209,94,123,83,180,94,52,251,75,50,250,231,217,224,124,57,35,230,160,86,246,203,43,235,146)
IMAGE_DATA(173,187,109,188,211,254,203,254,149,39,126,154,193,160,153,47,103,68,159,201,176,95,106,102,93,205,242,12,157,145,218,167)
IMAGE_DATA(188,207,0,207,6,243,115,47,125,166,87,236,151,28,239,251,177,153,231,151,190,176,63,206,168,34,125,246,221,243,239,178)
IMAGE_DATA(97,207,1,207,6,243,112,70,250,122,50,187,223,176,149,211,243,27,246,205,32,183,5,143,34,136,252,22,243,227,245,223)
IMAGE_DATA(72,57,38,142,143,150,99,98,249,240,28,225,124,112,14,255,249,69,251,102,24,173,190,191,134,232,188,119,142,191,203,135)
IMAGE_DATA(231,8,102,189,121,151,11,103,131,115,252,198,154,124,25,68,227,163,229,152,124,25,68,187,55,249,50,240,231,93,238,31)
IMAGE_DATA(123,25,32,135,229,199,27,173,193,17,198,247,245,249,199,255,200,187,190,229,194,43,213,23,169,190,199,92,199,120,175,28)
IMAGE_DATA(94,188,187,215,47,38,178,254,159,246,63,17,243,11,139,32,62,234,242,226,115,93,63,0,42,1,107,225,0,0,0,0)
IMAGE_END_DATA(992, 5)

View file

@ -0,0 +1,26 @@
LAYOUT(UApplicationLayout, 284, 128)
END_LAYOUT
LAYOUT(AboutLayout, 248, 92)
ITEM(Button, ok, SetLabel(t_("OK")).RightPosZ(6, 74).VCenterPosZ(24, 30))
END_LAYOUT
LAYOUT(OptionsGeneralLayout, 272, 104)
ITEM(StaticText, dv___0, SetText(t_("Language:")).LeftPosZ(4, 60).TopPosZ(4, 18))
ITEM(DropList, lang, LeftPosZ(68, 144).TopPosZ(4, 19))
ITEM(Option, OptionAlwaysShowTrayIcon, SetLabel(t_("Always show tray icon")).HSizePosZ(4, 8).TopPosZ(28, 16))
ITEM(Option, OptionHideInTrayIconOnMinimize, SetLabel(t_("Hide in tray icon when Minimize application")).HSizePosZ(4, 8).TopPosZ(48, 16))
ITEM(Option, OptionHideInTrayIconOnClose, SetLabel(t_("Hide in tray icon when Close application")).HSizePosZ(4, 8).TopPosZ(68, 16))
END_LAYOUT
LAYOUT(OptionsPluginsLayout, 344, 220)
ITEM(ArrayCtrl, PluginList, HorzGrid(false).AutoHideSb(true).HSizePosZ(4, 4).VSizePosZ(4, 148))
ITEM(LabelBox, dv___1, SetLabel(t_("Plugins")).HSizePosZ(4, 4).BottomPosZ(4, 140))
ITEM(Label, LabelDescription, SetLabel(t_("Description:")).LeftPosZ(16, 60).BottomPosZ(113, 19))
ITEM(Label, LabelAuthosr, SetLabel(t_("Author(s):")).LeftPosZ(16, 60).BottomPosZ(93, 15))
ITEM(Label, LabelEmail, SetLabel(t_("E-mail:")).LeftPosZ(16, 60).BottomPosZ(73, 15))
ITEM(Label, LabelWebSite, SetLabel(t_("Web-site")).LeftPosZ(16, 60).BottomPosZ(53, 15))
ITEM(Label, LabelUUID, SetLabel(t_("UUID:")).LeftPosZ(16, 60).BottomPosZ(33, 15))
ITEM(Label, LabelCopyrite, SetLabel(t_("Rights:")).LeftPosZ(16, 60).BottomPosZ(13, 15))
END_LAYOUT

View file

@ -0,0 +1,140 @@
#ifdef _MSC_VER
#pragma setlocale("C")
#endif
// TrayMenu.cpp
T_("Show application")
roRO("Afişează aplicaţia")
ruRU("")
T_("Hide application")
roRO("Ascunde aplicaţia")
ruRU("")
T_("Minimize")
roRO("Minimizează")
ruRU("")
T_("Maximize")
roRO("Maximizează")
ruRU("")
T_("Restore")
roRO("Refă")
ruRU("")
T_("About")
roRO("Despre")
ruRU("О программе")
T_("Exit")
roRO("Ieşire")
ruRU("Выход")
// MainWorkSpace.cpp
T_("Module")
roRO("Module")
ruRU("")
T_("Name")
roRO("Nume")
ruRU("Имя")
T_("Version")
roRO("Versiunea")
ruRU("")
T_("General")
roRO("De bază")
ruRU("")
T_("Plugins")
roRO("Plugin-uri")
ruRU("")
T_("Options")
roRO("Opţiuni")
ruRU("Своиства")
T_("Ultimate Automation")
roRO("Ultimate Automatizare")
ruRU("Ultimate Automation")
// MainMenu.cpp
T_("File")
roRO("Fişer")
ruRU("Файл")
T_("Tools")
roRO("Instrumente")
ruRU("Инструменты")
T_("Help")
roRO("Ajutor")
ruRU("Помощь")
T_("Hide")
roRO("Ascunde")
ruRU("")
// UApplication.lay
T_("OK")
roRO("OK")
ruRU("ОК")
T_("Language:")
roRO("Limba:")
ruRU("Язык:")
T_("Always show tray icon")
roRO("Permanent afişează in tray")
ruRU("")
T_("Hide in tray icon when Minimize application")
roRO("Ascunde in tray la minimizare aplicaţiei")
ruRU("")
T_("Hide in tray icon when Close application")
roRO("Ascunde in tray la închiderea aplicaţiei")
ruRU("")
T_("Description:")
roRO("Descriere:")
ruRU("Описание:")
T_("Author(s):")
roRO("Autor(i):")
ruRU("Автор(ы):")
T_("E-mail:")
roRO("E-mail:")
ruRU("E-mail:")
T_("Web-site")
roRO("Adresa web:")
ruRU("Сайт:")
T_("UUID:")
roRO("ID Unic:")
ruRU("Уник. ID:")
T_("Rights:")
roRO("Drepturi:")
ruRU("Права:")
// Obsolete
T_("Exit from application?")
roRO("Ieşiţi din aplicaţie?")
ruRU("Выйти из программы?")
T_("Cancel")
roRO("Revocare")
ruRU("Отмена")

View file

@ -0,0 +1,18 @@
uses
CtrlLib,
GridCtrl;
file
UApplication.h charset "UTF-8",
MainWorkSpace.h charset "UTF-8",
TrayMenu.cpp,
MainWorkSpace.cpp charset "UTF-8",
MainMenu.cpp charset "UTF-8",
UApplication.iml,
UApplication.t charset "UTF-8",
main.cpp charset "UTF-8",
UApplication.lay charset "UTF-8";
mainconfig
"" = "GUI";

View file

@ -0,0 +1,10 @@
#ifndef UAPPLICATION_H_COMMON
#define UAPPLICATION_H_COMMON
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
namespace UA{
}
#endif

5
uppdev/UApplication/init Normal file
View file

@ -0,0 +1,5 @@
#ifndef _UApplication_icpp_init_stub
#define _UApplication_icpp_init_stub
#include "CtrlLib/init"
#include "GridCtrl/init"
#endif

View file

@ -0,0 +1,8 @@
#include <UApplication/UApplication.h>
using namespace UA;
GUI_APP_MAIN {
//SetLanguage(LNGC_('R','O','R','O', CHARSET_UNICODE));
MainWorkSpace().Run();
};