Nana C++ Library. Reference for users.
What we need to use nana
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
nana::paint::graphics Class Reference

off-screen resource defined as ref-counting, can refer one resource More...

Classes

struct  implementation
 

Public Member Functions

 graphics ()
 
 graphics (const ::nana::size &)
 size in pixel More...
 
 graphics (const graphics &)
 the resource is not copyed, the two graphics objects refer to the SAME resource More...
 
graphicsoperator= (const graphics &)
 
 graphics (graphics &&)
 
graphicsoperator= (graphics &&)
 
 ~graphics ()
 
bool changed () const
 Returns true if the graphics object is operated. More...
 
bool empty () const
 Returns true if the graphics object does not refer to any resource. More...
 
 operator bool () const noexcept
 
drawable_type handle () const
 
const void * pixmap () const
 
const void * context () const
 
void swap (graphics &other) noexcept
 
void make (const ::nana::size &sz)
 Creates a graphics/drawable resource. More...
 
void resize (const ::nana::size &)
 
void typeface (const font &)
 Selects a specified font type into the graphics object. More...
 
font typeface () const
 
::nana::size text_extent_size (const ::std::string &) const
 
::nana::size text_extent_size (const char *, std::size_t len) const
 
::nana::size text_extent_size (const wchar_t *) const
 Computes the width and height of the specified string of text. More...
 
::nana::size text_extent_size (const ::std::wstring &) const
 Computes the width and height of the specified string of text. More...
 
::nana::size text_extent_size (const wchar_t *, std::size_t length) const
 Computes the width and height of the specified string of text with the specified length. More...
 
::nana::size text_extent_size (const ::std::wstring &, std::size_t length) const
 Computes the width and height of the specified string of text with the specified length. More...
 
::nana::size glyph_extent_size (const wchar_t *, std::size_t length, std::size_t begin, std::size_t end) const
 
::nana::size glyph_extent_size (const ::std::wstring &, std::size_t length, std::size_t begin, std::size_t end) const
 
bool glyph_pixels (const wchar_t *, std::size_t length, unsigned *pxbuf) const
 
::nana::size bidi_extent_size (const std::wstring &) const
 
::nana::size bidi_extent_size (const std::string &) const
 
bool text_metrics (unsigned &ascent, unsigned &descent, unsigned &internal_leading) const
 
void line_begin (int x, int y)
 
void bitblt (int x, int y, const graphics &source)
 Transfers the source to the specified point. More...
 
void bitblt (const ::nana::rectangle &r_dst, native_window_type src)
 Transfers the color data corresponding to r_dst from the src window to this graphics. More...
 
void bitblt (const ::nana::rectangle &r_dst, native_window_type src, const point &p_src)
 Transfers the color data corresponding to r_dst from the src window at point p_src to this graphics. More...
 
void bitblt (const ::nana::rectangle &r_dst, const graphics &src)
 Transfers the color data corresponding to r_dst from the src graphics to this graphics. More...
 
void bitblt (const ::nana::rectangle &r_dst, const graphics &src, const point &p_src)
 Transfers the color data corresponding to r_dst from the src graphics at point p_src to this graphics. More...
 
void blend (const ::nana::rectangle &r, const ::nana::color &, double fade_rate)
 
void blend (const ::nana::rectangle &blend_r, const graphics &blend_graph, const point &blend_graph_point, double fade_rate)
 blends with the blend_graph. More...
 
void blur (const ::nana::rectangle &r, std::size_t radius)
 Blur process. More...
 
void paste (graphics &dst, int x, int y) const
 Paste the graphics object into the dest at (x, y) More...
 
void paste (native_window_type dst, const ::nana::rectangle &, int sx, int sy) const
 Paste the graphics object into a platform-dependent window at (x, y) More...
 
void paste (native_window_type dst, int dx, int dy, unsigned width, unsigned height, int sx, int sy) const
 
void paste (drawable_type dst, int x, int y) const
 
void paste (const ::nana::rectangle &r_src, graphics &dst, int x, int y) const
 
void rgb_to_wb ()
 Transform a color graphics into black&white. More...
 
void stretch (const ::nana::rectangle &src_r, graphics &dst, const ::nana::rectangle &r) const
 
void stretch (graphics &dst, const ::nana::rectangle &) const
 
void flush ()
 
unsigned width () const
 Returns the width of the off-screen buffer. More...
 
unsigned height () const
 Returns the height of the off-screen buffer. More...
 
::nana::size size () const
 
void setsta ()
 Clears the status if the graphics object had been changed. More...
 
void set_changed ()
 
void release ()
 
void save_as_file (const char *file_utf8) const noexcept
 
::nana::color palette (bool for_text) const
 
graphicspalette (bool for_text, const ::nana::color &)
 
void set_pixel (int x, int y, const ::nana::color &)
 
void set_pixel (int x, int y)
 
unsigned bidi_string (const nana::point &, const wchar_t *, std::size_t len)
 
unsigned bidi_string (const point &pos, const char *, std::size_t len)
 
void string (const point &, const std::string &text_utf8)
 
void string (const point &, const std::string &text_utf8, const color &)
 
void string (point, const wchar_t *, std::size_t len)
 
void string (const point &, const wchar_t *)
 
void string (const point &, const ::std::wstring &)
 
void string (const point &, const ::std::wstring &, const color &)
 
void line (const point &, const point &)
 
void line (const point &, const point &, const color &)
 
void line_to (const point &, const color &)
 
void line_to (const point &)
 
void rectangle (bool solid)
 
void rectangle (bool solid, const color &)
 
void rectangle (const ::nana::rectangle &, bool solid)
 
void rectangle (const ::nana::rectangle &, bool solid, const color &)
 
void frame_rectangle (const ::nana::rectangle &, const color &left, const color &top, const color &right, const color &bottom)
 
void frame_rectangle (const ::nana::rectangle &, const color &, unsigned gap)
 
void gradual_rectangle (const ::nana::rectangle &, const color &from, const color &to, bool vertical)
 
void round_rectangle (const ::nana::rectangle &, unsigned radius_x, unsigned radius_y, const color &, bool solid, const color &color_if_solid)
 

Detailed Description

off-screen resource defined as ref-counting, can refer one resource

Load a bitmap into a graphics:

* nana::paint::image img("C:\\ABitmap.bmp");
* img.paste(graph, 0, 0); //graph may create if it is empty
*
Examples:
a_group_impl.cpp, background-effects.cpp, categ.cpp, draw.cpp, and stretch_image.cpp.

Constructor & Destructor Documentation

nana::paint::graphics::graphics ( )
nana::paint::graphics::graphics ( const ::nana::size )

size in pixel

nana::paint::graphics::graphics ( const graphics rhs)

the resource is not copyed, the two graphics objects refer to the SAME resource

nana::paint::graphics::graphics ( graphics &&  other)
nana::paint::graphics::~graphics ( )

Member Function Documentation

nana::size nana::paint::graphics::bidi_extent_size ( const std::wstring str) const
nana::size nana::paint::graphics::bidi_extent_size ( const std::string str) const
unsigned nana::paint::graphics::bidi_string ( const nana::point pos,
const wchar_t *  str,
std::size_t  len 
)
unsigned nana::paint::graphics::bidi_string ( const point pos,
const char *  str,
std::size_t  len 
)
void nana::paint::graphics::bitblt ( int  x,
int  y,
const graphics source 
)

Transfers the source to the specified point.

void nana::paint::graphics::bitblt ( const ::nana::rectangle r_dst,
native_window_type  src 
)

Transfers the color data corresponding to r_dst from the src window to this graphics.

void nana::paint::graphics::bitblt ( const ::nana::rectangle r_dst,
native_window_type  src,
const point p_src 
)

Transfers the color data corresponding to r_dst from the src window at point p_src to this graphics.

void nana::paint::graphics::bitblt ( const ::nana::rectangle r_dst,
const graphics src 
)

Transfers the color data corresponding to r_dst from the src graphics to this graphics.

void nana::paint::graphics::bitblt ( const ::nana::rectangle r_dst,
const graphics src,
const point p_src 
)

Transfers the color data corresponding to r_dst from the src graphics at point p_src to this graphics.

void nana::paint::graphics::blend ( const ::nana::rectangle r,
const ::nana::color ,
double  fade_rate 
)
void nana::paint::graphics::blend ( const ::nana::rectangle blend_r,
const graphics blend_graph,
const point blend_graph_point,
double  fade_rate 
)

blends with the blend_graph.

Parameters
fade_rateblends with the blend_graph.
void nana::paint::graphics::blur ( const ::nana::rectangle r,
std::size_t  radius 
)

Blur process.

bool nana::paint::graphics::changed ( ) const

Returns true if the graphics object is operated.

const void * nana::paint::graphics::context ( ) const
bool nana::paint::graphics::empty ( ) const

Returns true if the graphics object does not refer to any resource.

void nana::paint::graphics::flush ( )
void nana::paint::graphics::frame_rectangle ( const ::nana::rectangle ,
const color left,
const color top,
const color right,
const color bottom 
)
void nana::paint::graphics::frame_rectangle ( const ::nana::rectangle r,
const color clr,
unsigned  gap 
)
nana::size nana::paint::graphics::glyph_extent_size ( const wchar_t *  str,
std::size_t  length,
std::size_t  begin,
std::size_t  end 
) const
::nana::size nana::paint::graphics::glyph_extent_size ( const ::std::wstring ,
std::size_t  length,
std::size_t  begin,
std::size_t  end 
) const
bool nana::paint::graphics::glyph_pixels ( const wchar_t *  str,
std::size_t  length,
unsigned *  pxbuf 
) const
void nana::paint::graphics::gradual_rectangle ( const ::nana::rectangle ,
const color from,
const color to,
bool  vertical 
)
drawable_type nana::paint::graphics::handle ( ) const
unsigned nana::paint::graphics::height ( ) const

Returns the height of the off-screen buffer.

Examples:
a_group_impl.cpp.
void nana::paint::graphics::line ( const point pos1,
const point pos2 
)
Examples:
draw.cpp, and stretch_image.cpp.
void nana::paint::graphics::line ( const point pos_a,
const point pos_b,
const color clr 
)
void nana::paint::graphics::line_begin ( int  x,
int  y 
)
Examples:
draw.cpp, and stretch_image.cpp.
void nana::paint::graphics::line_to ( const point pos,
const color clr 
)
Examples:
draw.cpp, and stretch_image.cpp.
void nana::paint::graphics::line_to ( const point pos)
void nana::paint::graphics::make ( const ::nana::size sz)

Creates a graphics/drawable resource.

Parameters
szThe dimension of the graphics to be requested. If sz is empty, it performs as release().
nana::paint::graphics::operator bool ( ) const
explicitnoexcept
graphics & nana::paint::graphics::operator= ( const graphics rhs)
graphics & nana::paint::graphics::operator= ( graphics &&  other)
nana::color nana::paint::graphics::palette ( bool  for_text) const
graphics & nana::paint::graphics::palette ( bool  for_text,
const ::nana::color clr 
)
void nana::paint::graphics::paste ( graphics dst,
int  x,
int  y 
) const

Paste the graphics object into the dest at (x, y)

void nana::paint::graphics::paste ( native_window_type  dst,
const ::nana::rectangle ,
int  sx,
int  sy 
) const

Paste the graphics object into a platform-dependent window at (x, y)

void nana::paint::graphics::paste ( native_window_type  dst,
int  dx,
int  dy,
unsigned  width,
unsigned  height,
int  sx,
int  sy 
) const
void nana::paint::graphics::paste ( drawable_type  dst,
int  x,
int  y 
) const
void nana::paint::graphics::paste ( const ::nana::rectangle r_src,
graphics dst,
int  x,
int  y 
) const
const void * nana::paint::graphics::pixmap ( ) const
void nana::paint::graphics::rectangle ( bool  solid)
void nana::paint::graphics::rectangle ( bool  solid,
const color  
)
void nana::paint::graphics::rectangle ( const ::nana::rectangle r,
bool  solid 
)
void nana::paint::graphics::rectangle ( const ::nana::rectangle r,
bool  solid,
const color clr 
)
void nana::paint::graphics::release ( )
void nana::paint::graphics::resize ( const ::nana::size sz)
void nana::paint::graphics::rgb_to_wb ( )

Transform a color graphics into black&white.

void nana::paint::graphics::round_rectangle ( const ::nana::rectangle r,
unsigned  radius_x,
unsigned  radius_y,
const color clr,
bool  solid,
const color color_if_solid 
)
Examples:
a_group_impl.cpp.
void nana::paint::graphics::save_as_file ( const char *  file_utf8) const
noexcept

Saves images as a windows bitmap file

Parameters
file_utf8A UTF-8 string to a filename
Examples:
draw.cpp.
void nana::paint::graphics::set_changed ( )
void nana::paint::graphics::set_pixel ( int  x,
int  y,
const ::nana::color clr 
)
void nana::paint::graphics::set_pixel ( int  x,
int  y 
)
void nana::paint::graphics::setsta ( )

Clears the status if the graphics object had been changed.

nana::size nana::paint::graphics::size ( ) const
void nana::paint::graphics::stretch ( const ::nana::rectangle src_r,
graphics dst,
const ::nana::rectangle r 
) const
void nana::paint::graphics::stretch ( graphics dst,
const ::nana::rectangle  
) const
void nana::paint::graphics::string ( const point pos,
const std::string text_utf8 
)
void nana::paint::graphics::string ( const point pos,
const std::string text_utf8,
const color clr 
)
void nana::paint::graphics::string ( nana::point  pos,
const wchar_t *  str,
std::size_t  len 
)
void nana::paint::graphics::string ( const point pos,
const wchar_t *  str 
)
void nana::paint::graphics::string ( const point ,
const ::std::wstring  
)
void nana::paint::graphics::string ( const point pos,
const ::std::wstring text,
const color clr 
)
void nana::paint::graphics::swap ( graphics other)
noexcept
nana::size nana::paint::graphics::text_extent_size ( const ::std::string text) const
nana::size nana::paint::graphics::text_extent_size ( const char *  text,
std::size_t  len 
) const
nana::size nana::paint::graphics::text_extent_size ( const wchar_t *  text) const

Computes the width and height of the specified string of text.

::nana::size nana::paint::graphics::text_extent_size ( const ::std::wstring ) const

Computes the width and height of the specified string of text.

nana::size nana::paint::graphics::text_extent_size ( const wchar_t *  str,
std::size_t  length 
) const

Computes the width and height of the specified string of text with the specified length.

::nana::size nana::paint::graphics::text_extent_size ( const ::std::wstring ,
std::size_t  length 
) const

Computes the width and height of the specified string of text with the specified length.

bool nana::paint::graphics::text_metrics ( unsigned &  ascent,
unsigned &  descent,
unsigned &  internal_leading 
) const
void nana::paint::graphics::typeface ( const font f)

Selects a specified font type into the graphics object.

font nana::paint::graphics::typeface ( ) const
unsigned nana::paint::graphics::width ( ) const

Returns the width of the off-screen buffer.

Examples:
a_group_impl.cpp.