Removes now useless Arcellipse widget
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user