mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
Painter fixed to work in X11 and GCC
git-svn-id: svn://ultimatepp.org/upp/trunk@759 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
4dd4a3cf22
commit
a6a9c00dc7
6 changed files with 2350 additions and 2350 deletions
|
|
@ -1,155 +1,155 @@
|
|||
#include "Painter.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
#define LTIMING(x) RTIMING(x)
|
||||
|
||||
void BufferPainter::ClearOp(const RGBA& color)
|
||||
{
|
||||
Upp::Fill(~buffer, color, buffer.GetLength());
|
||||
}
|
||||
|
||||
inline void BufferPainter::PathPoint0(double x, double y)
|
||||
{
|
||||
pathrect.left = min(pathrect.left, x);
|
||||
pathrect.top = min(pathrect.top, y);
|
||||
pathrect.right = max(pathrect.right, x);
|
||||
pathrect.bottom = max(pathrect.bottom, y);
|
||||
}
|
||||
|
||||
inline void BufferPainter::PathPoint(double& x, double& y, bool rel)
|
||||
{
|
||||
x = IsNull(x) ? current.x : rel ? x + current.x : x;
|
||||
y = IsNull(y) ? current.y : rel ? y + current.y : y;
|
||||
if(inpath)
|
||||
PathPoint0(x, y);
|
||||
else {
|
||||
path.remove_all();
|
||||
pathrect.left = pathrect.right = x;
|
||||
pathrect.top = pathrect.bottom = y;
|
||||
pathattr = attr;
|
||||
}
|
||||
inpath = true;
|
||||
}
|
||||
|
||||
inline void BufferPainter::EndPoint(double& x, double& y, bool rel)
|
||||
{
|
||||
PathPoint(x, y, rel);
|
||||
current = Pointf(x, y);
|
||||
}
|
||||
|
||||
void BufferPainter::MoveOp(double x, double y, bool rel)
|
||||
{
|
||||
EndPoint(x, y, rel);
|
||||
ccontrol = qcontrol = current;
|
||||
path.move_to(x, y);
|
||||
inpath = true;
|
||||
}
|
||||
|
||||
void BufferPainter::LineOp(double x, double y, bool rel)
|
||||
{
|
||||
EndPoint(x, y, rel);
|
||||
ccontrol = qcontrol = current;
|
||||
path.line_to(x, y);
|
||||
inpath = true;
|
||||
}
|
||||
|
||||
void BufferPainter::QuadraticOp(double x1, double y1, double x, double y, bool rel)
|
||||
{
|
||||
PathPoint(x1, y1, rel);
|
||||
qcontrol = Pointf(x1, y1);
|
||||
EndPoint(x, y, rel);
|
||||
ccontrol = current;
|
||||
path.curve3(x1, y1, x, y);
|
||||
}
|
||||
|
||||
void BufferPainter::QuadraticOp(double x, double y, bool rel)
|
||||
{
|
||||
qcontrol = current + current - qcontrol;
|
||||
PathPoint0(qcontrol.x, qcontrol.y);
|
||||
EndPoint(x, y, rel);
|
||||
ccontrol = current;
|
||||
path.curve3(qcontrol.x, qcontrol.y, x, y);
|
||||
}
|
||||
|
||||
void BufferPainter::CubicOp(double x1, double y1, double x2, double y2, double x, double y, bool rel)
|
||||
{
|
||||
PathPoint(x1, y1, rel);
|
||||
PathPoint(x2, y2, rel);
|
||||
ccontrol = Pointf(x2, y2);
|
||||
EndPoint(x, y, rel);
|
||||
qcontrol = current;
|
||||
path.curve4(x1, y1, x2, y2, x, y);
|
||||
}
|
||||
|
||||
void BufferPainter::CubicOp(double x2, double y2, double x, double y, bool rel)
|
||||
{
|
||||
Pointf c = current + current - ccontrol;
|
||||
PathPoint0(c.x, c.y);
|
||||
PathPoint(x2, y2, rel);
|
||||
ccontrol = Pointf(x2, y2);
|
||||
EndPoint(x, y, rel);
|
||||
qcontrol = current;
|
||||
path.curve4(c.x, c.y, x2, y2, x, y);
|
||||
}
|
||||
|
||||
void BufferPainter::CloseOp()
|
||||
{
|
||||
path.close_polygon();
|
||||
}
|
||||
|
||||
inline void BufferPainter::MinMax(Pointf& minv, Pointf& maxv, Pointf p) const
|
||||
{
|
||||
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);
|
||||
maxv.y = max(maxv.y, p.y);
|
||||
}
|
||||
|
||||
bool BufferPainter::PathVisible(double w) const
|
||||
{
|
||||
Pointf h = pathattr.mtx.Transformed(w, w);
|
||||
w = max(abs(h.x), abs(h.y));
|
||||
Pointf min;
|
||||
Pointf max;
|
||||
min = max = pathattr.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;
|
||||
}
|
||||
|
||||
void BufferPainter::SetRbuf()
|
||||
{
|
||||
pixf.attach(buffer);
|
||||
renb.attach(pixf);
|
||||
renderer.attach(renb);
|
||||
}
|
||||
|
||||
BufferPainter::BufferPainter(ImageBuffer& ib)
|
||||
: buffer(ib),
|
||||
curved(path),
|
||||
curved_trans(curved, attr.mtx)
|
||||
{
|
||||
size = ib.GetSize();
|
||||
sizef = size;
|
||||
inpath = false;
|
||||
pathrect = Null;
|
||||
ccontrol = qcontrol = current = Point(0, 0);
|
||||
|
||||
attr.cap = LINECAP_BUTT;
|
||||
attr.join = LINEJOIN_MITER;
|
||||
attr.miter_limit = 4;
|
||||
attr.evenodd = false;
|
||||
attr.hasclip = false;
|
||||
attr.cliplevel = 0;
|
||||
attr.dash_start = 0.0;
|
||||
attr.opacity = 1.0;
|
||||
attr.mask = false;
|
||||
pathattr = attr;
|
||||
|
||||
SetRbuf();
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
#include "Painter.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
#define LTIMING(x) RTIMING(x)
|
||||
|
||||
void BufferPainter::ClearOp(const RGBA& color)
|
||||
{
|
||||
Upp::Fill(~buffer, color, buffer.GetLength());
|
||||
}
|
||||
|
||||
inline void BufferPainter::PathPoint0(double x, double y)
|
||||
{
|
||||
pathrect.left = min(pathrect.left, x);
|
||||
pathrect.top = min(pathrect.top, y);
|
||||
pathrect.right = max(pathrect.right, x);
|
||||
pathrect.bottom = max(pathrect.bottom, y);
|
||||
}
|
||||
|
||||
inline void BufferPainter::PathPoint(double& x, double& y, bool rel)
|
||||
{
|
||||
x = IsNull(x) ? current.x : rel ? x + current.x : x;
|
||||
y = IsNull(y) ? current.y : rel ? y + current.y : y;
|
||||
if(inpath)
|
||||
PathPoint0(x, y);
|
||||
else {
|
||||
path.remove_all();
|
||||
pathrect.left = pathrect.right = x;
|
||||
pathrect.top = pathrect.bottom = y;
|
||||
pathattr = attr;
|
||||
}
|
||||
inpath = true;
|
||||
}
|
||||
|
||||
inline void BufferPainter::EndPoint(double& x, double& y, bool rel)
|
||||
{
|
||||
PathPoint(x, y, rel);
|
||||
current = Pointf(x, y);
|
||||
}
|
||||
|
||||
void BufferPainter::MoveOp(double x, double y, bool rel)
|
||||
{
|
||||
EndPoint(x, y, rel);
|
||||
ccontrol = qcontrol = current;
|
||||
path.move_to(x, y);
|
||||
inpath = true;
|
||||
}
|
||||
|
||||
void BufferPainter::LineOp(double x, double y, bool rel)
|
||||
{
|
||||
EndPoint(x, y, rel);
|
||||
ccontrol = qcontrol = current;
|
||||
path.line_to(x, y);
|
||||
inpath = true;
|
||||
}
|
||||
|
||||
void BufferPainter::QuadraticOp(double x1, double y1, double x, double y, bool rel)
|
||||
{
|
||||
PathPoint(x1, y1, rel);
|
||||
qcontrol = Pointf(x1, y1);
|
||||
EndPoint(x, y, rel);
|
||||
ccontrol = current;
|
||||
path.curve3(x1, y1, x, y);
|
||||
}
|
||||
|
||||
void BufferPainter::QuadraticOp(double x, double y, bool rel)
|
||||
{
|
||||
qcontrol = current + current - qcontrol;
|
||||
PathPoint0(qcontrol.x, qcontrol.y);
|
||||
EndPoint(x, y, rel);
|
||||
ccontrol = current;
|
||||
path.curve3(qcontrol.x, qcontrol.y, x, y);
|
||||
}
|
||||
|
||||
void BufferPainter::CubicOp(double x1, double y1, double x2, double y2, double x, double y, bool rel)
|
||||
{
|
||||
PathPoint(x1, y1, rel);
|
||||
PathPoint(x2, y2, rel);
|
||||
ccontrol = Pointf(x2, y2);
|
||||
EndPoint(x, y, rel);
|
||||
qcontrol = current;
|
||||
path.curve4(x1, y1, x2, y2, x, y);
|
||||
}
|
||||
|
||||
void BufferPainter::CubicOp(double x2, double y2, double x, double y, bool rel)
|
||||
{
|
||||
Pointf c = current + current - ccontrol;
|
||||
PathPoint0(c.x, c.y);
|
||||
PathPoint(x2, y2, rel);
|
||||
ccontrol = Pointf(x2, y2);
|
||||
EndPoint(x, y, rel);
|
||||
qcontrol = current;
|
||||
path.curve4(c.x, c.y, x2, y2, x, y);
|
||||
}
|
||||
|
||||
void BufferPainter::CloseOp()
|
||||
{
|
||||
path.close_polygon();
|
||||
}
|
||||
|
||||
inline void BufferPainter::MinMax(Pointf& minv, Pointf& maxv, Pointf p) const
|
||||
{
|
||||
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);
|
||||
maxv.y = max(maxv.y, p.y);
|
||||
}
|
||||
|
||||
bool BufferPainter::PathVisible(double w) const
|
||||
{
|
||||
Pointf h = pathattr.mtx.Transformed(w, w);
|
||||
w = max(fabs(h.x), fabs(h.y));
|
||||
Pointf min;
|
||||
Pointf max;
|
||||
min = max = pathattr.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;
|
||||
}
|
||||
|
||||
void BufferPainter::SetRbuf()
|
||||
{
|
||||
pixf.attach(buffer);
|
||||
renb.attach(pixf);
|
||||
renderer.attach(renb);
|
||||
}
|
||||
|
||||
BufferPainter::BufferPainter(ImageBuffer& ib)
|
||||
: buffer(ib),
|
||||
curved(path),
|
||||
curved_trans(curved, attr.mtx)
|
||||
{
|
||||
size = ib.GetSize();
|
||||
sizef = size;
|
||||
inpath = false;
|
||||
pathrect = Null;
|
||||
ccontrol = qcontrol = current = Point(0, 0);
|
||||
|
||||
attr.cap = LINECAP_BUTT;
|
||||
attr.join = LINEJOIN_MITER;
|
||||
attr.miter_limit = 4;
|
||||
attr.evenodd = false;
|
||||
attr.hasclip = false;
|
||||
attr.cliplevel = 0;
|
||||
attr.dash_start = 0.0;
|
||||
attr.opacity = 1.0;
|
||||
attr.mask = false;
|
||||
pathattr = attr;
|
||||
|
||||
SetRbuf();
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -1,151 +1,151 @@
|
|||
//----------------------------------------------------------------------------
|
||||
// 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 coM_PIes.
|
||||
// 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
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// Recycled for U++ by Miroslav Fidler 2008
|
||||
|
||||
#include "Painter.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(Painter& 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
|
||||
//----------------------------------------------------------------------------
|
||||
// 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 coM_PIes.
|
||||
// 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
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// Recycled for U++ by Miroslav Fidler 2008
|
||||
|
||||
#include "Painter.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
#ifdef PLATFORM_X11
|
||||
|
||||
static inline double ft_dbl(int p)
|
||||
{
|
||||
return double(p) / 64.0;
|
||||
}
|
||||
|
||||
bool RenderOutline(const FT_Outline& outline, Painter& path, double xx, double yy)
|
||||
{
|
||||
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.Move(ft_dbl(v_start.x) + xx, -ft_dbl(v_start.y) + yy);
|
||||
while(point < limit) {
|
||||
point++;
|
||||
tags++;
|
||||
|
||||
tag = FT_CURVE_TAG(tags[0]);
|
||||
switch(tag) {
|
||||
case FT_CURVE_TAG_ON:
|
||||
path.Line(ft_dbl(point->x) + xx, -ft_dbl(point->y) + yy);
|
||||
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) + xx, -ft_dbl(v_control.y) + yy,
|
||||
ft_dbl(vec.x) + xx, -ft_dbl(vec.y) + yy);
|
||||
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) + xx, -ft_dbl(v_control.y) + yy,
|
||||
ft_dbl(v_middle.x) + xx, -ft_dbl(v_middle.y) + yy);
|
||||
v_control = vec;
|
||||
goto Do_Conic;
|
||||
}
|
||||
path.Quadratic(ft_dbl(v_control.x) + xx, -ft_dbl(v_control.y) + yy,
|
||||
ft_dbl(v_start.x) + xx, -ft_dbl(v_start.y) + yy);
|
||||
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) + xx, -ft_dbl(vec1.y) + yy,
|
||||
ft_dbl(vec2.x) + xx, -ft_dbl(vec2.y) + yy,
|
||||
ft_dbl(vec.x) + xx, -ft_dbl(vec.y) + yy);
|
||||
continue;
|
||||
}
|
||||
path.Cubic(ft_dbl(vec1.x) + xx, -ft_dbl(vec1.y) + yy,
|
||||
ft_dbl(vec2.x) + xx, -ft_dbl(vec2.y) + yy,
|
||||
ft_dbl(v_start.x) + xx, -ft_dbl(v_start.y) + yy);
|
||||
goto Close;
|
||||
}
|
||||
}
|
||||
Close:
|
||||
path.Close();
|
||||
first = last + 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Painter::CharacterOp(double x, double y, 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, *this, x, y);
|
||||
XftUnlockFace(fi.GetXftFont());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -1,50 +1,50 @@
|
|||
#include "Painter.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
void BufferPainter::BeginMaskOp()
|
||||
{
|
||||
attr.mask = true;
|
||||
Size sz = buffer.GetSize();
|
||||
mask.Add() = buffer;
|
||||
buffer.Create(sz);
|
||||
SetRbuf();
|
||||
Clear(RGBAZero());
|
||||
Begin();
|
||||
}
|
||||
|
||||
void BufferPainter::FinishMask()
|
||||
{
|
||||
RGBA *s = ~buffer;
|
||||
RGBA *e = ~buffer + buffer.GetLength();
|
||||
byte *t, *cs;
|
||||
if(clip.GetCount())
|
||||
cs = ~clip.Top();
|
||||
if(!attr.hasclip) {
|
||||
clip.Add().Alloc(size.cx * size.cy);
|
||||
attr.hasclip = true;
|
||||
attr.cliplevel = clip.GetCount();
|
||||
}
|
||||
t = ~clip.Top();
|
||||
if(clip.GetCount() == 1)
|
||||
while(s < e) {
|
||||
byte v = ((s->a + (s->a >> 7)) * (77 * s->r + 151 * s->g + 28 * s->b)) >> 16;
|
||||
*t = v;
|
||||
s++;
|
||||
t++;
|
||||
}
|
||||
else
|
||||
while(s < e) {
|
||||
byte v = ((s->a + (s->a >> 7)) * (77 * s->r + 151 * s->g + 28 * s->b)) >> 16;
|
||||
*t = (*cs * (v + (v >> 7))) >> 8;
|
||||
s++;
|
||||
t++;
|
||||
cs++;
|
||||
}
|
||||
buffer = mask.Top();
|
||||
mask.Drop();
|
||||
SetRbuf();
|
||||
attr.mask = false;
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
#include "Painter.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
void BufferPainter::BeginMaskOp()
|
||||
{
|
||||
attr.mask = true;
|
||||
Size sz = buffer.GetSize();
|
||||
mask.Add() = buffer;
|
||||
buffer.Create(sz);
|
||||
SetRbuf();
|
||||
Clear(RGBAZero());
|
||||
Begin();
|
||||
}
|
||||
|
||||
void BufferPainter::FinishMask()
|
||||
{
|
||||
RGBA *s = ~buffer;
|
||||
RGBA *e = ~buffer + buffer.GetLength();
|
||||
byte *t, *cs;
|
||||
if(clip.GetCount())
|
||||
cs = ~clip.Top();
|
||||
if(!attr.hasclip) {
|
||||
clip.Add().Alloc(size.cx * size.cy);
|
||||
attr.hasclip = true;
|
||||
attr.cliplevel = clip.GetCount();
|
||||
}
|
||||
t = ~clip.Top();
|
||||
if(clip.GetCount() == 1)
|
||||
while(s < e) {
|
||||
byte v = ((s->a + (s->a >> 7)) * (77 * s->r + 151 * s->g + 28 * s->b)) >> 16;
|
||||
*t = v;
|
||||
s++;
|
||||
t++;
|
||||
}
|
||||
else
|
||||
while(s < e) {
|
||||
byte v = ((s->a + (s->a >> 7)) * (77 * s->r + 151 * s->g + 28 * s->b)) >> 16;
|
||||
*t = (*cs * (v + (v >> 7))) >> 8;
|
||||
s++;
|
||||
t++;
|
||||
cs++;
|
||||
}
|
||||
buffer = mask.Top();
|
||||
mask.Drop();
|
||||
SetRbuf();
|
||||
attr.mask = false;
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -1,266 +1,266 @@
|
|||
#include "Painter.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
void Painter::OffsetOp(Point p)
|
||||
{
|
||||
Begin();
|
||||
Translate(p.x, p.y);
|
||||
}
|
||||
|
||||
void Painter::RectPath(int x, int y, int cx, int cy)
|
||||
{
|
||||
Move(x, y).Line(x + cx - 1, y).Line(x + cx - 1, y + cy - 1).Line(x, y + cy - 1).Close();
|
||||
}
|
||||
|
||||
void Painter::RectPath(const Rect& r)
|
||||
{
|
||||
RectPath(r.left, r.top, r.GetWidth(), r.GetHeight());
|
||||
}
|
||||
|
||||
bool Painter::ClipOp(const Rect& r)
|
||||
{
|
||||
Begin();
|
||||
RectPath(r);
|
||||
Clip();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Painter::ClipoffOp(const Rect& r)
|
||||
{
|
||||
Begin();
|
||||
RectPath(r);
|
||||
Clip();
|
||||
Translate(r.left, r.top);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Painter::ExcludeClipOp(const Rect& r)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Painter::IntersectClipOp(const Rect& r)
|
||||
{
|
||||
RectPath(r);
|
||||
Clip();
|
||||
return true;
|
||||
}
|
||||
|
||||
Rect Painter::GetClipOp() const
|
||||
{
|
||||
return Rect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
bool Painter::IsPaintingOp(const Rect& r) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Painter::DrawRectOp(int x, int y, int cx, int cy, Color color)
|
||||
{
|
||||
RTIMING("Rect");
|
||||
RectPath(x, y, cx, cy);
|
||||
Fill(color);
|
||||
}
|
||||
|
||||
void Painter::DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color)
|
||||
{
|
||||
RectPath(x, y, cx, cy);
|
||||
Fill(img, Translate2D(x, y));
|
||||
}
|
||||
|
||||
void Painter::DrawDataOp(int x, int y, int cx, int cy, const String& data, const char *id)
|
||||
{
|
||||
}
|
||||
|
||||
void Painter::DrawLineOp(int x1, int y1, int x2, int y2, int width, Color color)
|
||||
{
|
||||
Move(x1, y1);
|
||||
Line(x2, y2);
|
||||
Stroke(width, color);
|
||||
}
|
||||
|
||||
void Painter::DrawPolyPolylineOp(const Point *vertices, int vertex_count, const int *counts,
|
||||
int count_count, int width, Color color, Color doxor)
|
||||
{
|
||||
}
|
||||
|
||||
void Painter::DrawPolyPolyPolygonOp(const Point *vertices, int vertex_count,
|
||||
const int *subpolygon_counts, int scc, const int *disjunct_polygon_counts,
|
||||
int dpcc, Color color, int width, Color outline, uint64 pattern, Color doxor)
|
||||
{
|
||||
}
|
||||
|
||||
void Painter::DrawArcOp(const Rect& rc, Point start, Point end, int width, Color color)
|
||||
{
|
||||
}
|
||||
|
||||
void Painter::DrawEllipseOp(const Rect& r, Color color, int pen, Color pencolor)
|
||||
{
|
||||
}
|
||||
|
||||
void Painter::DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink, int n, const int *dx)
|
||||
{
|
||||
RTIMING("DrawTextOp");
|
||||
Begin();
|
||||
EvenOdd(true);
|
||||
if(angle)
|
||||
Rotate(angle * M_2PI / 36000);
|
||||
if(n < 0)
|
||||
n = wstrlen(text);
|
||||
double *ddx = NULL;
|
||||
Buffer<double> h;
|
||||
if(dx) {
|
||||
h.Alloc(n);
|
||||
ddx = h;
|
||||
for(int i = 0; i < n; i++)
|
||||
ddx[i] = dx[i];
|
||||
}
|
||||
Text(x, y, text, font, n, ddx);
|
||||
Fill(ink);
|
||||
End();
|
||||
}
|
||||
|
||||
Painter& Painter::Move(double x, double y)
|
||||
{
|
||||
return Move(x, y, false);
|
||||
}
|
||||
|
||||
Painter& Painter::Line(double x, double y)
|
||||
{
|
||||
return Line(x, y, false);
|
||||
}
|
||||
|
||||
Painter& Painter::Quadratic(double x1, double y1, double x, double y)
|
||||
{
|
||||
return Quadratic(x1, y1, x, y, false);
|
||||
}
|
||||
|
||||
Painter& Painter::Quadratic(double x, double y)
|
||||
{
|
||||
return Quadratic(x, y, false);
|
||||
}
|
||||
|
||||
Painter& Painter::Cubic(double x1, double y1, double x2, double y2, double x, double y)
|
||||
{
|
||||
return Cubic(x1, y1, x2, y2, x, y, false);
|
||||
}
|
||||
|
||||
Painter& Painter::Cubic(double x2, double y2, double x, double y)
|
||||
{
|
||||
return Cubic(x2, y2, x, y, false);
|
||||
}
|
||||
|
||||
Painter& Painter::RelMove(double x, double y)
|
||||
{
|
||||
return Move(x, y, true);
|
||||
}
|
||||
|
||||
Painter& Painter::RelLine(double x, double y)
|
||||
{
|
||||
return Line(x, y, true);
|
||||
}
|
||||
|
||||
Painter& Painter::RelQuadratic(double x1, double y1, double x, double y)
|
||||
{
|
||||
return Quadratic(x1, y1, x, y, true);
|
||||
}
|
||||
|
||||
Painter& Painter::RelQuadratic(double x, double y)
|
||||
{
|
||||
return Quadratic(x, y, true);
|
||||
}
|
||||
|
||||
Painter& Painter::RelCubic(double x1, double y1, double x2, double y2, double x, double y)
|
||||
{
|
||||
return Cubic(x1, y1, x2, y2, x, y, true);
|
||||
}
|
||||
|
||||
Painter& Painter::RelCubic(double x2, double y2, double x, double y)
|
||||
{
|
||||
return Cubic(x2, y2, x, y, true);
|
||||
}
|
||||
|
||||
Matrix2D GetImageLineMatrix(double x1, double y1, double x2, double y2, const Image& image)
|
||||
{
|
||||
Matrix2D m;
|
||||
Size sz = image.GetSize();
|
||||
m.scale(agg::calc_distance(x1, y1, x2, y2) / sz.cx);
|
||||
if(abs(x2 - x1) < abs(y2 - y1) * 1e-6)
|
||||
m.rotate(y2 > y1 ? M_PI_2 : -M_PI_2);
|
||||
else
|
||||
m.rotate(atan((y2 - y1) / (x2 - x1)));
|
||||
m.translate(x1, y1);
|
||||
return m;
|
||||
}
|
||||
|
||||
Painter& Painter::Fill(const Image& image, double x1, double y1,
|
||||
double x2, double y2, dword flags)
|
||||
{
|
||||
return Fill(image, GetImageLineMatrix(x1, y1, x2, y2, image), flags);
|
||||
}
|
||||
|
||||
Painter& Painter::Stroke(double width, const Image& image, double x1, double y1,
|
||||
double x2, double y2, dword flags)
|
||||
{
|
||||
return Stroke(width, image, GetImageLineMatrix(x1, y1, x2, y2, image), flags);
|
||||
}
|
||||
|
||||
Painter& Painter::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;
|
||||
}
|
||||
|
||||
void Painter::Translate(double x, double y)
|
||||
{
|
||||
Transform(Translate2D(x, y));
|
||||
}
|
||||
|
||||
void Painter::Rotate(double a)
|
||||
{
|
||||
Transform(Rotate2D(a));
|
||||
}
|
||||
|
||||
void Painter::Scale(double scalex, double scaley)
|
||||
{
|
||||
Transform(Scale2D(scalex, scaley));
|
||||
}
|
||||
|
||||
void Painter::Scale(double scale)
|
||||
{
|
||||
Transform(Scale2D(scale));
|
||||
}
|
||||
|
||||
Painter& Painter::Ellipse(double x, double y, double rx, double ry)
|
||||
{
|
||||
return Arc(x, y, rx, ry, 0, M_2PI);
|
||||
}
|
||||
|
||||
Painter& Painter::Circle(double x, double y, double r)
|
||||
{
|
||||
return Ellipse(x, y, r, r);
|
||||
}
|
||||
|
||||
Painter& Painter::Rectangle(double x, double y, double cx, double cy)
|
||||
{
|
||||
Move(x, y);
|
||||
Line(x + cx, y);
|
||||
Line(x + cx, y + cy);
|
||||
Line(x, y + cy);
|
||||
Close();
|
||||
return *this;
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
#include "Painter.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
void Painter::OffsetOp(Point p)
|
||||
{
|
||||
Begin();
|
||||
Translate(p.x, p.y);
|
||||
}
|
||||
|
||||
void Painter::RectPath(int x, int y, int cx, int cy)
|
||||
{
|
||||
Move(x, y).Line(x + cx - 1, y).Line(x + cx - 1, y + cy - 1).Line(x, y + cy - 1).Close();
|
||||
}
|
||||
|
||||
void Painter::RectPath(const Rect& r)
|
||||
{
|
||||
RectPath(r.left, r.top, r.GetWidth(), r.GetHeight());
|
||||
}
|
||||
|
||||
bool Painter::ClipOp(const Rect& r)
|
||||
{
|
||||
Begin();
|
||||
RectPath(r);
|
||||
Clip();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Painter::ClipoffOp(const Rect& r)
|
||||
{
|
||||
Begin();
|
||||
RectPath(r);
|
||||
Clip();
|
||||
Translate(r.left, r.top);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Painter::ExcludeClipOp(const Rect& r)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Painter::IntersectClipOp(const Rect& r)
|
||||
{
|
||||
RectPath(r);
|
||||
Clip();
|
||||
return true;
|
||||
}
|
||||
|
||||
Rect Painter::GetClipOp() const
|
||||
{
|
||||
return Rect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
bool Painter::IsPaintingOp(const Rect& r) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Painter::DrawRectOp(int x, int y, int cx, int cy, Color color)
|
||||
{
|
||||
RTIMING("Rect");
|
||||
RectPath(x, y, cx, cy);
|
||||
Fill(color);
|
||||
}
|
||||
|
||||
void Painter::DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color)
|
||||
{
|
||||
RectPath(x, y, cx, cy);
|
||||
Fill(img, Translate2D(x, y));
|
||||
}
|
||||
|
||||
void Painter::DrawDataOp(int x, int y, int cx, int cy, const String& data, const char *id)
|
||||
{
|
||||
}
|
||||
|
||||
void Painter::DrawLineOp(int x1, int y1, int x2, int y2, int width, Color color)
|
||||
{
|
||||
Move(x1, y1);
|
||||
Line(x2, y2);
|
||||
Stroke(width, color);
|
||||
}
|
||||
|
||||
void Painter::DrawPolyPolylineOp(const Point *vertices, int vertex_count, const int *counts,
|
||||
int count_count, int width, Color color, Color doxor)
|
||||
{
|
||||
}
|
||||
|
||||
void Painter::DrawPolyPolyPolygonOp(const Point *vertices, int vertex_count,
|
||||
const int *subpolygon_counts, int scc, const int *disjunct_polygon_counts,
|
||||
int dpcc, Color color, int width, Color outline, uint64 pattern, Color doxor)
|
||||
{
|
||||
}
|
||||
|
||||
void Painter::DrawArcOp(const Rect& rc, Point start, Point end, int width, Color color)
|
||||
{
|
||||
}
|
||||
|
||||
void Painter::DrawEllipseOp(const Rect& r, Color color, int pen, Color pencolor)
|
||||
{
|
||||
}
|
||||
|
||||
void Painter::DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink, int n, const int *dx)
|
||||
{
|
||||
RTIMING("DrawTextOp");
|
||||
Begin();
|
||||
EvenOdd(true);
|
||||
if(angle)
|
||||
Rotate(angle * M_2PI / 36000);
|
||||
if(n < 0)
|
||||
n = wstrlen(text);
|
||||
double *ddx = NULL;
|
||||
Buffer<double> h;
|
||||
if(dx) {
|
||||
h.Alloc(n);
|
||||
ddx = h;
|
||||
for(int i = 0; i < n; i++)
|
||||
ddx[i] = dx[i];
|
||||
}
|
||||
Text(x, y, text, font, n, ddx);
|
||||
Fill(ink);
|
||||
End();
|
||||
}
|
||||
|
||||
Painter& Painter::Move(double x, double y)
|
||||
{
|
||||
return Move(x, y, false);
|
||||
}
|
||||
|
||||
Painter& Painter::Line(double x, double y)
|
||||
{
|
||||
return Line(x, y, false);
|
||||
}
|
||||
|
||||
Painter& Painter::Quadratic(double x1, double y1, double x, double y)
|
||||
{
|
||||
return Quadratic(x1, y1, x, y, false);
|
||||
}
|
||||
|
||||
Painter& Painter::Quadratic(double x, double y)
|
||||
{
|
||||
return Quadratic(x, y, false);
|
||||
}
|
||||
|
||||
Painter& Painter::Cubic(double x1, double y1, double x2, double y2, double x, double y)
|
||||
{
|
||||
return Cubic(x1, y1, x2, y2, x, y, false);
|
||||
}
|
||||
|
||||
Painter& Painter::Cubic(double x2, double y2, double x, double y)
|
||||
{
|
||||
return Cubic(x2, y2, x, y, false);
|
||||
}
|
||||
|
||||
Painter& Painter::RelMove(double x, double y)
|
||||
{
|
||||
return Move(x, y, true);
|
||||
}
|
||||
|
||||
Painter& Painter::RelLine(double x, double y)
|
||||
{
|
||||
return Line(x, y, true);
|
||||
}
|
||||
|
||||
Painter& Painter::RelQuadratic(double x1, double y1, double x, double y)
|
||||
{
|
||||
return Quadratic(x1, y1, x, y, true);
|
||||
}
|
||||
|
||||
Painter& Painter::RelQuadratic(double x, double y)
|
||||
{
|
||||
return Quadratic(x, y, true);
|
||||
}
|
||||
|
||||
Painter& Painter::RelCubic(double x1, double y1, double x2, double y2, double x, double y)
|
||||
{
|
||||
return Cubic(x1, y1, x2, y2, x, y, true);
|
||||
}
|
||||
|
||||
Painter& Painter::RelCubic(double x2, double y2, double x, double y)
|
||||
{
|
||||
return Cubic(x2, y2, x, y, true);
|
||||
}
|
||||
|
||||
Matrix2D GetImageLineMatrix(double x1, double y1, double x2, double y2, const Image& image)
|
||||
{
|
||||
Matrix2D m;
|
||||
Size sz = image.GetSize();
|
||||
m.scale(agg::calc_distance(x1, y1, x2, y2) / sz.cx);
|
||||
if(fabs(x2 - x1) < fabs(y2 - y1) * 1e-6)
|
||||
m.rotate(y2 > y1 ? M_PI_2 : -M_PI_2);
|
||||
else
|
||||
m.rotate(atan((y2 - y1) / (x2 - x1)));
|
||||
m.translate(x1, y1);
|
||||
return m;
|
||||
}
|
||||
|
||||
Painter& Painter::Fill(const Image& image, double x1, double y1,
|
||||
double x2, double y2, dword flags)
|
||||
{
|
||||
return Fill(image, GetImageLineMatrix(x1, y1, x2, y2, image), flags);
|
||||
}
|
||||
|
||||
Painter& Painter::Stroke(double width, const Image& image, double x1, double y1,
|
||||
double x2, double y2, dword flags)
|
||||
{
|
||||
return Stroke(width, image, GetImageLineMatrix(x1, y1, x2, y2, image), flags);
|
||||
}
|
||||
|
||||
Painter& Painter::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;
|
||||
}
|
||||
|
||||
void Painter::Translate(double x, double y)
|
||||
{
|
||||
Transform(Translate2D(x, y));
|
||||
}
|
||||
|
||||
void Painter::Rotate(double a)
|
||||
{
|
||||
Transform(Rotate2D(a));
|
||||
}
|
||||
|
||||
void Painter::Scale(double scalex, double scaley)
|
||||
{
|
||||
Transform(Scale2D(scalex, scaley));
|
||||
}
|
||||
|
||||
void Painter::Scale(double scale)
|
||||
{
|
||||
Transform(Scale2D(scale));
|
||||
}
|
||||
|
||||
Painter& Painter::Ellipse(double x, double y, double rx, double ry)
|
||||
{
|
||||
return Arc(x, y, rx, ry, 0, M_2PI);
|
||||
}
|
||||
|
||||
Painter& Painter::Circle(double x, double y, double r)
|
||||
{
|
||||
return Ellipse(x, y, r, r);
|
||||
}
|
||||
|
||||
Painter& Painter::Rectangle(double x, double y, double cx, double cy)
|
||||
{
|
||||
Move(x, y);
|
||||
Line(x + cx, y);
|
||||
Line(x + cx, y + cy);
|
||||
Line(x, y + cy);
|
||||
Close();
|
||||
return *this;
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -1,185 +1,185 @@
|
|||
NAMESPACE_UPP
|
||||
|
||||
inline void Painter::Clear(const RGBA& color)
|
||||
{
|
||||
ClearOp(color);
|
||||
}
|
||||
|
||||
inline Painter& Painter::Move(double x, double y, bool rel)
|
||||
{
|
||||
MoveOp(x, y, rel);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Line(double x, double y, bool rel)
|
||||
{
|
||||
LineOp(x, y, rel);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Quadratic(double x1, double y1, double x, double y, bool rel)
|
||||
{
|
||||
QuadraticOp(x1, y1, x, y, rel);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Quadratic(double x, double y, bool rel)
|
||||
{
|
||||
QuadraticOp(x, y, rel);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Cubic(double x1, double y1, double x2, double y2, double x, double y, bool rel)
|
||||
{
|
||||
CubicOp(x1, y1, x2, y2, x, y, rel);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Cubic(double x2, double y2, double x, double y, bool rel)
|
||||
{
|
||||
CubicOp(x2, y2, x, y, rel);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Close()
|
||||
{
|
||||
CloseOp();
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Fill(const RGBA& color)
|
||||
{
|
||||
FillOp(color);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Fill(const Image& image, const Matrix2D& transsrc, dword flags)
|
||||
{
|
||||
FillOp(image, transsrc, flags);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Fill(double x1, double y1, const RGBA& color1,
|
||||
double x2, double y2, const RGBA& color2, int style)
|
||||
{
|
||||
FillOp(x1, y1, color1, x2, y2, color2, style);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Fill(double fx, double fy, const RGBA& color1, double x1, double y1, double r, const RGBA& color2, int style)
|
||||
{
|
||||
FillOp(fx, fy, color1, x1, y1, r, color2, style);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Fill(double x1, double y1, const RGBA& color1, double r, const RGBA& color2, int style)
|
||||
{
|
||||
return Fill(x1, y1, color1, x1, y1, r, color2, style);
|
||||
}
|
||||
|
||||
inline Painter& Painter::Stroke(double width, const RGBA& color)
|
||||
{
|
||||
StrokeOp(width, color);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Stroke(double width, const Image& image, const Matrix2D& transsrc, dword flags)
|
||||
{
|
||||
StrokeOp(width, image, transsrc, flags);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Stroke(double width, double x1, double y1, const RGBA& color1,
|
||||
double x2, double y2, const RGBA& color2, int style)
|
||||
{
|
||||
StrokeOp(width, x1, y1, color1, x2, y2, color2, style);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Stroke(double width, double fx, double fy, const RGBA& color1,
|
||||
double x1, double y1, double r, const RGBA& color2, int style)
|
||||
{
|
||||
StrokeOp(width, fx, fy, color1, x1, y1, r, color2, style);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Stroke(double width, double x1, double y1, const RGBA& color1, double r, const RGBA& color2, int style)
|
||||
{
|
||||
return Stroke(width, x1, y1, color1, x1, y1, r, color2, style);
|
||||
}
|
||||
|
||||
inline Painter& Painter::Clip()
|
||||
{
|
||||
ClipOp();
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::ColorStop(double pos, const RGBA& color)
|
||||
{
|
||||
ColorStopOp(pos, color);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::ClearStops()
|
||||
{
|
||||
ClearStopsOp();
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Opacity(double o)
|
||||
{
|
||||
OpacityOp(o);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::LineCap(int linecap)
|
||||
{
|
||||
LineCapOp(linecap);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::LineJoin(int linejoin)
|
||||
{
|
||||
LineJoinOp(linejoin);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::MiterLimit(double l)
|
||||
{
|
||||
MiterLimitOp(l);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::EvenOdd(bool evenodd)
|
||||
{
|
||||
EvenOddOp(evenodd);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Dash(const Vector<double>& dash, double start)
|
||||
{
|
||||
DashOp(dash, start);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void Painter::Transform(const Matrix2D& m)
|
||||
{
|
||||
TransformOp(m);
|
||||
}
|
||||
|
||||
inline void Painter::Begin()
|
||||
{
|
||||
BeginOp();
|
||||
}
|
||||
|
||||
inline void Painter::End()
|
||||
{
|
||||
EndOp();
|
||||
}
|
||||
|
||||
inline void Painter::BeginMask()
|
||||
{
|
||||
BeginMaskOp();
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
NAMESPACE_UPP
|
||||
|
||||
inline void Painter::Clear(const RGBA& color)
|
||||
{
|
||||
ClearOp(color);
|
||||
}
|
||||
|
||||
inline Painter& Painter::Move(double x, double y, bool rel)
|
||||
{
|
||||
MoveOp(x, y, rel);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Line(double x, double y, bool rel)
|
||||
{
|
||||
LineOp(x, y, rel);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Quadratic(double x1, double y1, double x, double y, bool rel)
|
||||
{
|
||||
QuadraticOp(x1, y1, x, y, rel);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Quadratic(double x, double y, bool rel)
|
||||
{
|
||||
QuadraticOp(x, y, rel);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Cubic(double x1, double y1, double x2, double y2, double x, double y, bool rel)
|
||||
{
|
||||
CubicOp(x1, y1, x2, y2, x, y, rel);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Cubic(double x2, double y2, double x, double y, bool rel)
|
||||
{
|
||||
CubicOp(x2, y2, x, y, rel);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Close()
|
||||
{
|
||||
CloseOp();
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Fill(const RGBA& color)
|
||||
{
|
||||
FillOp(color);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Fill(const Image& image, const Matrix2D& transsrc, dword flags)
|
||||
{
|
||||
FillOp(image, transsrc, flags);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Fill(double x1, double y1, const RGBA& color1,
|
||||
double x2, double y2, const RGBA& color2, int style)
|
||||
{
|
||||
FillOp(x1, y1, color1, x2, y2, color2, style);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Fill(double fx, double fy, const RGBA& color1, double x1, double y1, double r, const RGBA& color2, int style)
|
||||
{
|
||||
FillOp(fx, fy, color1, x1, y1, r, color2, style);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Fill(double x1, double y1, const RGBA& color1, double r, const RGBA& color2, int style)
|
||||
{
|
||||
return Fill(x1, y1, color1, x1, y1, r, color2, style);
|
||||
}
|
||||
|
||||
inline Painter& Painter::Stroke(double width, const RGBA& color)
|
||||
{
|
||||
StrokeOp(width, color);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Stroke(double width, const Image& image, const Matrix2D& transsrc, dword flags)
|
||||
{
|
||||
StrokeOp(width, image, transsrc, flags);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Stroke(double width, double x1, double y1, const RGBA& color1,
|
||||
double x2, double y2, const RGBA& color2, int style)
|
||||
{
|
||||
StrokeOp(width, x1, y1, color1, x2, y2, color2, style);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Stroke(double width, double fx, double fy, const RGBA& color1,
|
||||
double x1, double y1, double r, const RGBA& color2, int style)
|
||||
{
|
||||
StrokeOp(width, fx, fy, color1, x1, y1, r, color2, style);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Stroke(double width, double x1, double y1, const RGBA& color1, double r, const RGBA& color2, int style)
|
||||
{
|
||||
return Stroke(width, x1, y1, color1, x1, y1, r, color2, style);
|
||||
}
|
||||
|
||||
inline Painter& Painter::Clip()
|
||||
{
|
||||
ClipOp();
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::ColorStop(double pos, const RGBA& color)
|
||||
{
|
||||
ColorStopOp(pos, color);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::ClearStops()
|
||||
{
|
||||
ClearStopsOp();
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Opacity(double o)
|
||||
{
|
||||
OpacityOp(o);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::LineCap(int linecap)
|
||||
{
|
||||
LineCapOp(linecap);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::LineJoin(int linejoin)
|
||||
{
|
||||
LineJoinOp(linejoin);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::MiterLimit(double l)
|
||||
{
|
||||
MiterLimitOp(l);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::EvenOdd(bool evenodd)
|
||||
{
|
||||
EvenOddOp(evenodd);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Painter& Painter::Dash(const Vector<double>& dash, double start)
|
||||
{
|
||||
DashOp(dash, start);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void Painter::Transform(const Matrix2D& m)
|
||||
{
|
||||
TransformOp(m);
|
||||
}
|
||||
|
||||
inline void Painter::Begin()
|
||||
{
|
||||
BeginOp();
|
||||
}
|
||||
|
||||
inline void Painter::End()
|
||||
{
|
||||
EndOp();
|
||||
}
|
||||
|
||||
inline void Painter::BeginMask()
|
||||
{
|
||||
BeginMaskOp();
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue