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

Definition

Provides methods for creating graphics buffers that can be used for double buffering.

Provides methods for creating graphics buffers that can be used for double buffering.
Definition buffered_graphics_context.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_context
Namespace
xtd::drawing
Library
xtd.drawing
Remarks
The xtd::drawing::buffered_graphics_context class allows you to implement custom double buffering for your graphics. Graphics that use double buffering can reduce or eliminate flicker that is caused by redrawing a display surface.
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::forms::control::set_style method. Setting the xtd::forms::control_styles::optimized_double_buffer control styles 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_context class provides methods for creating and configuring a graphics buffer. The xtd::drawing::buffered_graphics_context::allocate method creates a xtd::drawing::buffered_graphics, which is a wrapper for a graphics buffer that also provides methods you can use to write to the buffer and render its contents to an output device.
You can retrieve the xtd::drawing::buffered_graphics_context for the current application domain from the static xtd::drawing::buffered_graphics_manager::current property. For graphically intensive applications such as animation, you can create a dedicated xtd::drawing::buffered_graphics_context using the constructor, but for most applications the xtd::drawing::buffered_graphics_manager::current property will be sufficient.

Public Constructors

 buffered_graphics_context ()=default
 Initializes a new instance of the BufferedGraphicsContext class.
 

Public Properties

const xtd::drawing::sizemaximum_buffer () const noexcept
 Gets the maximum size of the buffer to use.
 
buffered_graphics_contextmaximum_buffer (const xtd::drawing::size &value)
 Sets the maximum size of the buffer to use.
 

Public Methods

void allocate (const xtd::drawing::graphics &target_graphics, const xtd::drawing::rectangle &targat_rectangle)
 
void allocate (intptr target_dc, const xtd::drawing::rectangle &targat_rectangle)
 
void invalidate ()
 Destroy of the current graphics buffer, if a buffer has been allocated and has not yet been destroyed.
 

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 sxd::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.
 

Constructor & Destructor Documentation

◆ buffered_graphics_context()

xtd::drawing::buffered_graphics_context::buffered_graphics_context ( )
default

Initializes a new instance of the BufferedGraphicsContext class.

Remarks
For graphically intensive applications such as animation, you can sometimes improve performance by using a dedicated xtd::drawing::buffered_graphics_context instead of the default instance provided by the xtd::drawing::buffered_graphics_manager. This allows you to create and manage graphics buffers individually.

Member Function Documentation

◆ invalidate()

void xtd::drawing::buffered_graphics_context::invalidate ( )

Destroy of the current graphics buffer, if a buffer has been allocated and has not yet been destroyed.

Remarks
If the graphics buffer is in use, it will be marked for destroying as soon as it is free; otherwise, it will be destoyed immediately.

◆ maximum_buffer() [1/2]

const xtd::drawing::size & xtd::drawing::buffered_graphics_context::maximum_buffer ( ) const
noexcept

Gets the maximum size of the buffer to use.

Returns
A xtd::drawing::size indicating the maximum size of the buffer dimensions.
Remarks
This property allows you to get or set the maximum dimensions for a buffer that should be retained in memory. You can allocate a buffer of any size, however any buffer with dimensions greater than the xtd::drawing::buffered_graphics_context::MaximumBuffer size will be used temporarily and then discarded when the xtd::drawing::buffered_graphics object is released.

◆ maximum_buffer() [2/2]

buffered_graphics_context & xtd::drawing::buffered_graphics_context::maximum_buffer ( const xtd::drawing::size value)

Sets the maximum size of the buffer to use.

Parameters
valueA xtd::drawing::size indicating the maximum size of the buffer dimensions.
Exceptions
xtd::argument_exceptionThe height or width of the size is less than or equal to zero.
Remarks
This property allows you to get or set the maximum dimensions for a buffer that should be retained in memory. You can allocate a buffer of any size, however any buffer with dimensions greater than the xtd::drawing::buffered_graphics_context::MaximumBuffer size will be used temporarily and then discarded when the xtd::drawing::buffered_graphics object is released.

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