Commit f432c967 authored by Davis King's avatar Davis King

Improved the image_window a bit.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402967
parent 55283b46
...@@ -3159,6 +3159,11 @@ namespace dlib ...@@ -3159,6 +3159,11 @@ namespace dlib
image_window( image_window(
); );
template < typename image_type >
image_window(
const image_type& img
) : gui_img(*this) { set_image(img); show(); }
~image_window( ~image_window(
); );
...@@ -3167,11 +3172,12 @@ namespace dlib ...@@ -3167,11 +3172,12 @@ namespace dlib
const image_type& img const image_type& img
) )
{ {
const unsigned long padding = scrollable_region_style_default().get_border_size();
auto_mutex M(wm); auto_mutex M(wm);
gui_img.set_image(img); gui_img.set_image(img);
// set the size of this window to match the size of the input image // set the size of this window to match the size of the input image
set_size(img.nc(),img.nr()); set_size(img.nc()+padding*2,img.nr()+padding*2);
// call this to make sure everything else is setup properly // call this to make sure everything else is setup properly
on_window_resized(); on_window_resized();
......
...@@ -2234,6 +2234,19 @@ namespace dlib ...@@ -2234,6 +2234,19 @@ namespace dlib
- this object is properly initialized - this object is properly initialized
!*/ !*/
template <typename image_type>
image_window(
const image_type& img
);
/*!
requires
- image_type == an implementation of array2d/array2d_kernel_abstract.h
- pixel_traits<typename image_type::type> must be defined
ensures
- this object is properly initialized
- #*this window is now displaying the given image img.
!*/
~image_window( ~image_window(
); );
/*! /*!
...@@ -2241,7 +2254,7 @@ namespace dlib ...@@ -2241,7 +2254,7 @@ namespace dlib
- any resources associated with this object have been released - any resources associated with this object have been released
!*/ !*/
template < typename image_type > template <typename image_type>
void set_image ( void set_image (
const image_type& img const image_type& img
); );
...@@ -2250,7 +2263,7 @@ namespace dlib ...@@ -2250,7 +2263,7 @@ namespace dlib
- image_type == an implementation of array2d/array2d_kernel_abstract.h - image_type == an implementation of array2d/array2d_kernel_abstract.h
- pixel_traits<typename image_type::type> must be defined - pixel_traits<typename image_type::type> must be defined
ensures ensures
- #*this window is now displaying the given image new_img. - #*this window is now displaying the given image img.
!*/ !*/
void add_overlay ( void add_overlay (
......
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