Removes now useless Arcellipse widget

This commit is contained in:
Pandagrapher 2019-03-30 17:35:23 +01:00
parent 83f70cf9fb
commit fe92d596c9
2 changed files with 0 additions and 234 deletions

View File

@ -930,195 +930,6 @@ void Ellipse::drawToMOChannel (Cairo::RefPtr<Cairo::Context> &cr, unsigned short
}
}
void Arcellipse::drawOuterGeometry (Cairo::RefPtr<Cairo::Context> &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem)
{
if ((flags & F_VISIBLE) && state != INSENSITIVE) {
RGBColor color;
if (flags & F_AUTO_COLOR) {
color = getOuterLineColor();
} else {
color = outerLineColor;
}
cr->set_source_rgb (color.getR(), color.getG(), color.getB());
cr->set_line_width ( getOuterLineWidth() );
rtengine::Coord center_ = center;
double radius_ = radiusInImageSpace ? coordSystem.scaleValueToCanvas (double (radius)) : double (radius);
double radius2_ = radiusInImageSpace ? coordSystem.scaleValueToCanvas (double (radius2)) : double (radius2);
double begang_ = begang;
double endang_ = endang;
if (datum == IMAGE) {
coordSystem.imageCoordToScreen (center.x, center.y, center_.x, center_.y);
} else if (datum == CLICKED_POINT) {
center_ += objectBuffer->getDataProvider()->posScreen;
} else if (datum == CURSOR) {
center_ += objectBuffer->getDataProvider()->posScreen + objectBuffer->getDataProvider()->deltaScreen;
}
if (radius_ > 0 && radius2_ > 0.) {
cr->save();
// To have an ellipse with radius of (rad1, rad2), a circle of radius rad1 shall be twisted with a scale
// of rad2 / rad1 for y axis
// Center of coordinates (x, y) in previous coordinates system becomes (X, Y) = (x, rad2 / rad1 * y) in new one
// To go back to previous location, center shall be translated to t = -Y * (1 - rad1 / rad2) in y axis
// (Y = rad2 / rad1 * y and y = t + Y)
double scale_ = radius2_ / radius_;
cr->scale (1., scale_);
cr->translate (0., - center_.y * (1 - 1 / scale_));
cr->arc (center_.x + 0.5, center_.y + 0.5, radius_, begang_, endang_);
cr->restore();
cr->stroke();
}
}
}
void Arcellipse::drawInnerGeometry (Cairo::RefPtr<Cairo::Context> &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem)
{
if (flags & F_VISIBLE) {
if (state != INSENSITIVE) {
RGBColor color;
if (flags & F_AUTO_COLOR) {
color = getInnerLineColor();
} else {
color = innerLineColor;
}
cr->set_source_rgb (color.getR(), color.getG(), color.getB());
}
cr->set_line_width ( innerLineWidth );
rtengine::Coord center_ = center;
double radius_ = radiusInImageSpace ? coordSystem.scaleValueToCanvas (double (radius)) : double (radius);
double radius2_ = radiusInImageSpace ? coordSystem.scaleValueToCanvas (double (radius2)) : double (radius2);
double begang_ = begang;
double endang_ = endang;
if (datum == IMAGE) {
coordSystem.imageCoordToScreen (center.x, center.y, center_.x, center_.y);
} else if (datum == CLICKED_POINT) {
center_ += objectBuffer->getDataProvider()->posScreen;
} else if (datum == CURSOR) {
center_ += objectBuffer->getDataProvider()->posScreen + objectBuffer->getDataProvider()->deltaScreen;
}
if (filled && state != INSENSITIVE) {
if (radius_ > 0 && radius2_ > 0.) {
cr->save();
// To have an ellipse with radius of (rad1, rad2), a circle of radius rad1 shall be twisted with a scale
// of rad2 / rad1 for y axis
// Center of coordinates (x, y) in previous coordinates system becomes (X, Y) = (x, rad2 / rad1 * y) in new one
// To go back to previous location, center shall be translated to t = -Y * (1 - rad1 / rad2) in y axis
// (Y = rad2 / rad1 * y and y = t + Y)
double scale_ = radius2_ / radius_;
cr->scale (1., scale_);
cr->translate (0., - center_.y * (1 - 1 / scale_));
cr->arc (center_.x + 0.5, center_.y + 0.5, radius_, begang_, endang_);
cr->restore();
cr->stroke();
}
if (innerLineWidth > 0.) {
cr->fill_preserve();
cr->stroke();
} else {
cr->fill();
}
} else if (innerLineWidth > 0.) {
if (radius_ > 0 && radius2_ > 0.) {
cr->save();
// To have an ellipse with radius of (rad1, rad2), a circle of radius rad1 shall be twisted with a scale
// of rad2 / rad1 for y axis
// Center of coordinates (x, y) in previous coordinates system becomes (X, Y) = (x, rad2 / rad1 * y) in new one
// To go back to previous location, center shall be translated to t = -Y * (1 - rad1 / rad2) in y axis
// (Y = rad2 / rad1 * y and y = t + Y)
double scale_ = radius2_ / radius_;
cr->scale (1., scale_);
cr->translate (0., - center_.y * (1 - 1 / scale_));
cr->arc (center_.x + 0.5, center_.y + 0.5, radius_, begang_, endang_);
cr->restore();
cr->stroke();
}
if (state == INSENSITIVE) {
std::valarray<double> ds (1);
ds[0] = 4;
cr->set_source_rgba (1.0, 1.0, 1.0, 0.618);
cr->stroke_preserve();
cr->set_source_rgba (0.0, 0.0, 0.0, 0.618);
cr->set_dash (ds, 0);
cr->stroke();
ds.resize (0);
cr->set_dash (ds, 0);
} else {
cr->stroke();
}
}
}
}
void Arcellipse::drawToMOChannel (Cairo::RefPtr<Cairo::Context> &cr, unsigned short id, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem)
{
if (flags & F_HOVERABLE) {
cr->set_line_width ( getMouseOverLineWidth() );
rtengine::Coord center_ = center;
double radius_ = radiusInImageSpace ? coordSystem.scaleValueToCanvas (double (radius)) : double (radius);
double radius2_ = radiusInImageSpace ? coordSystem.scaleValueToCanvas (double (radius2)) : double (radius2);
double begang_ = begang;
double endang_ = endang;
if (datum == IMAGE) {
coordSystem.imageCoordToCropCanvas (center.x, center.y, center_.x, center_.y);
} else if (datum == CLICKED_POINT) {
center_ += objectBuffer->getDataProvider()->posScreen;
} else if (datum == CURSOR) {
center_ += objectBuffer->getDataProvider()->posScreen + objectBuffer->getDataProvider()->deltaScreen;
}
if (radius_ > 0 && radius2_ > 0.) {
cr->save();
// To have an ellipse with radius of (rad1, rad2), a circle of radius rad1 shall be twisted with a scale
// of rad2 / rad1 for y axis
// Center of coordinates (x, y) in previous coordinates system becomes (X, Y) = (x, rad2 / rad1 * y) in new one
// To go back to previous location, center shall be translated to t = -Y * (1 - rad1 / rad2) in y axis
// (Y = rad2 / rad1 * y and y = t + Y)
double scale_ = radius2_ / radius_;
cr->scale (1., scale_);
cr->translate (0., - center_.y * (1 - 1 / scale_));
cr->arc (center_.x + 0.5, center_.y + 0.5, radius_, begang_, endang_);
cr->restore();
cr->stroke();
}
if (filled) {
if (innerLineWidth > 0.) {
cr->fill_preserve();
cr->stroke();
} else {
cr->fill();
}
} else {
cr->stroke();
}
}
}
void OPIcon::drivenPointToRectangle(const rtengine::Coord &pos,
rtengine::Coord &topLeft, rtengine::Coord &bottomRight, int W, int H)
{

View File

@ -341,33 +341,6 @@ public:
void drawToMOChannel (Cairo::RefPtr<Cairo::Context> &cr, unsigned short id, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem) override;
};
class Arcellipse : public Geometry
{
public:
rtengine::Coord center;
// rtengine::Coord scalx;
// rtengine::Coord scaly;
// TODO translax, translay, scalx and scaly are not used
double radius;
double radius2;
double translax;
double translay;
double scalx;
double scaly;
double begang;
double endang;
bool filled;
bool radiusInImageSpace; /// If true, the radius depend on the image scale; if false, it is a fixed 'screen' size
Arcellipse ();
Arcellipse (rtengine::Coord& center, double radius, double radius2, double translax, double translay, double scalx, double scaly, double begang, double endang, bool filled = false, bool radiusInImageSpace = false);
Arcellipse (int centerX, int centerY, double radius, double radius2, double translax, double translay, double scalx, double scaly, double begang, double endang, bool filled = false, bool radiusInImageSpace = false);
void drawOuterGeometry (Cairo::RefPtr<Cairo::Context> &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem);
void drawInnerGeometry (Cairo::RefPtr<Cairo::Context> &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem);
void drawToMOChannel (Cairo::RefPtr<Cairo::Context> &cr, unsigned short id, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem);
};
class OPIcon : public Geometry // OP stands for "On Preview"
{
@ -568,11 +541,6 @@ inline Ellipse::Ellipse () :
center (100, 100), radYT (5), radY (5), radXL (10), radX (10), filled (false), radiusInImageSpace (false) {
}
inline Arcellipse::Arcellipse () :
center (100, 100), radius (10), radius2 (10), translax (0), translay (0), filled (false), radiusInImageSpace (
false) {
}
inline Circle::Circle (rtengine::Coord& center, int radius, bool filled,
bool radiusInImageSpace) :
center (center), radius (radius), filled (filled), radiusInImageSpace (
@ -599,17 +567,4 @@ inline Ellipse::Ellipse (rtengine::Coord& center, int radYT, int radY, int radXL
radiusInImageSpace (radiusInImageSpace) {
}
inline Arcellipse::Arcellipse (rtengine::Coord& center, double radius, double radius2, double translax, double translay, double scalx, double scaly, double begang, double endang, bool filled,
bool radiusInImageSpace) :
center (center), radius (radius), radius2 (radius2), translax (translax), translay (translay), scalx (scalx), scaly (scaly), begang (begang), endang (endang), filled (filled), radiusInImageSpace (
radiusInImageSpace) {
}
inline Arcellipse::Arcellipse (int centerX, int centerY, double radius, double radius2, double translax, double translay, double scalx, double scaly, double begang, double endang, bool filled,
bool radiusInImageSpace) :
center (centerX, centerY), radius (radius), radius2 (radius2), translax (translax), translay (translay), scalx (scalx), scaly (scaly), begang (begang), endang (endang), filled (filled), radiusInImageSpace (
radiusInImageSpace) {
}
#endif