improve nana::picture

This commit is contained in:
Jinhao
2015-02-23 01:43:23 +08:00
parent baa8f4a9e9
commit 723dea218d
4 changed files with 111 additions and 262 deletions

View File

@@ -17,59 +17,39 @@
namespace nana
{
namespace xpicture
namespace drawerbase
{
class picture_drawer: public drawer_trigger
namespace picture
{
public:
picture_drawer();
void attached(widget_reference, graph_reference) override;
void load(const nana::char_t* file);
void load(const nana::paint::image&);
void set_shadow_background(const ::nana::color& from, const ::nana::color& to, bool horizontal);
bool bgstyle(bool is_stretch, nana::arrange, int beg, int end);
private:
void refresh(graph_reference) override;
void _m_draw_background();
private:
widget* widget_;
nana::paint::graphics* graph_;
struct implement;
struct
class drawer : public drawer_trigger
{
::nana::color gradual_from;
::nana::color gradual_to;
bool horizontal;
}bground_;
public:
drawer();
~drawer();
void attached(widget_reference, graph_reference) override;
private:
void refresh(graph_reference) override;
void _m_draw_background();
public:
implement * const impl_;
};
}//end namespace picture
}//end namespace drawerbase
struct back_image_tag
{
nana::paint::image image;
bool is_stretch;
nana::arrange arg;
int beg, end;
}backimg_;
};
}//end namespace xpicture
/// Rectangle area for displaying a bitmap file
class picture
: public widget_object<category::widget_tag, xpicture::picture_drawer>
: public widget_object<category::widget_tag, drawerbase::picture::drawer>
{
public:
picture();
picture(window, bool visible);
picture(window, const rectangle& = rectangle(), bool visible = true);
picture(window, const rectangle& ={}, bool visible = true);
void load(const nana::paint::image&);
void load(nana::paint::image);
/// Sets the background image style.
void bgstyle(bool stretchable, ///< if false the other arguments will be ignored
nana::arrange arg, ///< stretching the image horizontally or vertically
int beg, ///< specify the stretchy area of image.
int end ///< specify the stretchy area of image.
);
void stretchable(unsigned left, unsigned top, unsigned right, unsigned bottom);
/// Fills a gradual-change color in background. If One of colors is invisible or clr_from is equal to clr_to, it draws background in bgcolor.
void set_gradual_background(const ::nana::color& clr_from, const ::nana::color& clr_to, bool horizontal);

View File

@@ -128,6 +128,7 @@ namespace nana
unsigned height() const; ///< Returns the height of the off-screen buffer.
::nana::size size() const;
void setsta(); ///< Clears the status if the graphics object had been changed
void set_changed();
void release();
void save_as_file(const char*);