xtd 0.2.0
Loading...
Searching...
No Matches
xtd::drawing::buffered_graphics Class Reference
Inheritance diagram for xtd::drawing::buffered_graphics:
xtd::object

Definition

Provides a graphics buffer for double buffering.

Provides a graphics buffer for double buffering.
Definition buffered_graphics.h:32
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:32
#define drawing_export_
Define shared library export.
Definition drawing_export.h:13
Inheritance
xtd::objectxtd::drawing::buffered_graphics
Namespace
xtd::drawing
Library
xtd.drawing
Remarks
The xtd::drawing::buffered_graphics class allows you to implement custom double buffering for your graphics. It provides a wrapper for a graphics buffer, along with methods that you can use to write to the buffer and render its contents to an output device.
Graphics that use double buffering can reduce or eliminate flicker that is caused by redrawing a display surface. When you use double buffering, updated graphics are first drawn to a buffer in memory, and the contents of this buffer are then quickly written to some or all of the displayed surface. This relatively brief overwrite of the displayed graphics typically reduces or eliminates the flicker that sometimes occurs when graphics are updated.
Note
The simplest way to use double buffering is to set the xtd::forms::control_styles::optimized_double_buffer control style flag on a control using the xtd::control::set_style method. Setting the xtd::forms::control_styles::optimized_double_buffer flag for a control redirects all painting for the control through a default graphics buffer, without requiring any additional code. This flag is set to
true 
by default.
Remarks
The xtd::drawing::buffered_graphics class has no public constructor and must be created by the xtd::drawing::bffered_graphics_context for an application domain using its xtd::drawing::bffered_graphics_context::allocate method. You can retrieve the xtd::drawing::::buffered_graphics_context for the current application domain from the static xtd::drawing::buffered_graphics_manager::current property.
The xtd::drawing::graphics property can be used for drawing to the graphics buffer. This property provides access to the xtd::drawing::graphics object that draws to the graphics buffer allocated for this xtd::drawing::buffered_graphics object.
The xtd::drawing::buffered_graphics::render method with no arguments draws the contents of the graphics buffer to the surface specified when the buffer was allocated. Other overloads of the xtd::drawing::buffered_graphics::render method allow you to specify a xtd::drawing::graphics object or an xtd::intptr type that points to a device context to which to draw the contents of the graphics buffer.

Protected Member Functions

 buffered_graphics (const xtd::drawing::graphics &buffered_graphics_surface, std::optional< xtd::drawing::graphics > target_graphics, intptr target_dc, const xtd::drawing::point &target_location, xtd::drawing::size virtual_size)
 

Public Properties

const xtd::drawing::graphicsgraphics () const noexcept
 Gets a xtd::drawing::graphics object that outputs to the graphics buffer.
 
xtd::drawing::graphicsgraphics () noexcept
 

Public Methods

void render ()
 Writes the contents of the graphics buffer to the default device.
 
void render (xtd::drawing::graphics &target)
 Writes the contents of the graphics buffer to the specified xtd::drawing::graphics object.
 
void render (intptr target_dc)
 Writes the contents of the graphics buffer to the device context associated with the specified intptr handle.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const noexcept
 Creates a shallow copy of the current object.
 
virtual xtd::ustring to_string () const noexcept
 Returns a xtd::ustring that represents the current object.
 
- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Member Function Documentation

◆ graphics()

const xtd::drawing::graphics & xtd::drawing::buffered_graphics::graphics ( ) const
noexcept

Gets a xtd::drawing::graphics object that outputs to the graphics buffer.

Returns
A xtd::drawing::graphics object that outputs to the graphics buffer.
Remarks
This property provides a xtd::drawing::graphics object that draws to the graphics buffer allocated for this xtd::drawing::buffered_graphics object.

◆ render() [1/3]

void xtd::drawing::buffered_graphics::render ( )

Writes the contents of the graphics buffer to the default device.

Remarks
This method writes the contents of the graphics buffer to the device specified by calling the xtd::drawing::bffered_graphics_context::allocate method of the xtd::drawing::bffered_graphics_context used to create this xtd::drawing::bffered_graphics object.

◆ render() [2/3]

void xtd::drawing::buffered_graphics::render ( intptr  target_dc)

Writes the contents of the graphics buffer to the device context associated with the specified intptr handle.

Parameters
target_dcAn intptr that points to the device context to which to write the contents of the graphics buffer.
Remarks
This method writes the contents of the graphics buffer to the device context associated with the specified intptr handle.

◆ render() [3/3]

void xtd::drawing::buffered_graphics::render ( xtd::drawing::graphics target)

Writes the contents of the graphics buffer to the specified xtd::drawing::graphics object.

Parameters
targetA xtd::drawing::graphics object to which to write the contents of the graphics buffer.
Remarks
This method writes the contents of the graphics buffer to the specified xtd::drawing::graphics object.

The documentation for this class was generated from the following file: