Nana C++ Library  

An open-source C++ framework project
The Programmer's Guide 
nana::paint::graphics

Description

A graphics is a off-screen resource that is used for various operations. the class graphics is defined as ref-counting, these graphics objects can refer one rescource.

Model of

None 

Public base classes

None

Members

graphics() Default constructor
graphics(unsigned width, unsigned height) Creates a graphics object that size is width by height in pixel.
graphics(const graphics&) Copy constructor, the resource is not copyed, the tow graphics objects refer to the same resource.
graphics& operator=(const graphics&) Assigns an existing resource to another graphics object.
void bitblt(int x, int y, const graphics& src) Transfers the src to the specified point.
void bitblt(const nana::rectangle& d_r, native_window_type src) Transfers the color data corresponding to a rectangle that specified by d_r from the src window to this graphics.
void bitblt(const nana::rectangle& d_r, native_window_type src, const nana::point& s_pos) Transfers the color data corresponding to a rectangle that specified by d_r from the src window at point s_pos to this graphics.
void bitblt(const nana::rectangle& d_r, const graphics& src) Transfers the color data corresponding to a rectangle that specified by d_r from the src graphics to this graphics.
void bitblt(const nana::rectangle& d_r, const graphics& src, const nana::point& s_pos) Transfers the color data corresponding to a rectangle that specified by d_r from the src graphics at point s_pos to this graphics.
void blend(const nana::rectangle& s_r, graphics& dst, const nana::point& d_pos, double fade_rate) blends with the dst object.
void blend(const nana::rectangle& r, nana::color_t col, double fade_rate) blends the specifed block width the specified color.
void blur(const nana::rectangle& r, std::size_t radius) Blur process.
bool changed() const Returns true if the graphics object is operated
bool empty() const Returns true if the graphics object does not refer to any resource.
hdc_type handle() const Returns the platform-dependent resource handle.
unsigned height() const Returns the height of the off-screen buffer.
void line(int x1, int y1, int x2, int y2, colour_t color) Draws a line from point (x1, y1) to point (x2, y2) in the specified color.
void make(unsigned width, unsigned height) Creates a bitmap resource that size is width by height in pixel
static colour_t mix(colour_t color1, colour_t color2, unsigned persent) Mixs the color1 and color2
void paste(const graphics& dest, int x, int y) const Paste the graphics object into the dest at (x, y)
void paste(const nana::gui::native_window_type wnd, int x, int y) const Paste the graphics object into a platform-dependent window at (x, y)
void paste(hdc_type hdc, int x, int y) const Paste the graphics object into a platform-dependent DC at (x, y)
void rectangle(int x, int y, unsigned width, unsigned height, colour_t color, bool solid) Draws a width and height rectangle at (x, y) in the specified color. 
void release() Release the resource graphics object refers to.
void resize(unsigned width, unsigned height) Adjusts the resource size into specified size in width by height in pixel
void rgb_to_wb() Transform a color graphics into black&white.
void set_pixel(int x, int y, colour_t color) Sets the colour of the specified pixel
void setsta() Clears the status if the graphics object had been changed
void shadow_rectangle(int x, int y, unsigned width, unsigned height, colour_t begin, color_t end, bool vertical) Draws a width and height rectangle at (x, y) and the color in range of [begin, end]
void stretch_paste(const graphics& dest, int x, int y, unsigned length, int x2, int y2, unsigned length2) Pastes the graphics object into dest, and top line is at (x, y) in length, and bottom line is at (x2, y2) in length2.
void stretch_paste(hdc_type dc, int x, int y, unsigned length, int x2, int y2, unsigned length2) Pastes the graphics object into platform-dependent DC, and top line is at(x, y) in length, and bottom line is at(x2, y2) in length2 
void string(int x, int y, colour_t color, const nana::string& text) Prints a string of text at the position (x, y) in the specified color.
void string(int x, int y, colour_t color, const nana::string& text, unsigned length) Prints a string of text at the position (x, y) in the specified color and
nana::size text_extent_size(const nana::char_t*) const Computes the width and height of the specified string of text.
nana::size text_extent_size(const nana::string&) const Computes the width and height of the specified string of text.
nana::size text_extent_size(const nana::string& text, unsigned length) const Computes the width and height of the specified string of text with the specified length.
void transparent_paste(graphics& gc, int x, int y, colour_t color) const Pastes the graphics object at (x, y) into gc, and ignroe the color of gixel 
void typeface(const font&) Selects a specified font type into the graphics object. 
unsigned width() const Returns the width of the off-screen buffer

Notes

1. A graphics refers to a resource through reference-counting technique.

See also

image


Move to The Nana Programmer's Guide Main Page