Commit 8993a0d9 authored by Davis King's avatar Davis King

Changed the overlay_circle so you can give a double radius rather than just an

integer radius. Also made the circles centered on the center of the pixel at
their center when you zoom in.
parent 4b907532
...@@ -6383,8 +6383,8 @@ namespace dlib ...@@ -6383,8 +6383,8 @@ namespace dlib
// now draw all the overlay circles // now draw all the overlay circles
for (unsigned long i = 0; i < overlay_circles.size(); ++i) for (unsigned long i = 0; i < overlay_circles.size(); ++i)
{ {
const point center = zoom_in_scale*overlay_circles[i].center/zoom_out_scale + origin; const dpoint center = (double)zoom_in_scale*(overlay_circles[i].center+dpoint(0.5,0.5))/zoom_out_scale + origin;
const int radius = zoom_in_scale*overlay_circles[i].radius/zoom_out_scale; const double radius = zoom_in_scale*overlay_circles[i].radius/zoom_out_scale;
draw_circle(c, draw_circle(c,
center, center,
radius, radius,
...@@ -6392,7 +6392,7 @@ namespace dlib ...@@ -6392,7 +6392,7 @@ namespace dlib
if (overlay_circles[i].label.size() != 0) if (overlay_circles[i].label.size() != 0)
{ {
const point temp = center + point(0,radius); const point temp = center + dpoint(0,radius);
// make a rectangle that is at the spot we want to draw our string // make a rectangle that is at the spot we want to draw our string
rectangle r(temp, c.br_corner()); rectangle r(temp, c.br_corner());
......
...@@ -3350,15 +3350,15 @@ namespace dlib ...@@ -3350,15 +3350,15 @@ namespace dlib
overlay_circle():radius(0) { assign_pixel(color, 0);} overlay_circle():radius(0) { assign_pixel(color, 0);}
template <typename pixel_type> template <typename pixel_type>
overlay_circle(const point& center_, const int radius_, pixel_type p) overlay_circle(const point& center_, const double radius_, pixel_type p)
: center(center_), radius(radius_) { assign_pixel(color, p); } : center(center_), radius(radius_) { assign_pixel(color, p); }
template <typename pixel_type> template <typename pixel_type>
overlay_circle(const point& center_, const int radius_, pixel_type p, const std::string& l) overlay_circle(const point& center_, const double radius_, pixel_type p, const std::string& l)
: center(center_), radius(radius_), label(l) { assign_pixel(color, p); } : center(center_), radius(radius_), label(l) { assign_pixel(color, p); }
point center; point center;
int radius; double radius;
rgb_alpha_pixel color; rgb_alpha_pixel color;
std::string label; std::string label;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment