xtd 0.2.0
xtd::forms::style_sheets::background_image Class Reference

Definition

The image data allows you to specify the url or gradient mode.

class forms_export_ background_image : public xtd::object
Inheritance
xtd::objectxtd::forms::style_sheets::background_image
Header
#include <xtd/forms/style_sheets/background_image>
Namespace
xtd::forms::style_sheets
Library
xtd.forms
Remarks
This class is used by xtd::forms::style_sheets::ibox_model.

Fields

static const background_image empty
 Provides an empty xtd::forms::style_sheets::background_image object. More...
 

Constructors

 background_image ()=default
 Initializes a new instance of the xtd::forms::style_sheets::background_image class. More...
 
 background_image (const xtd::ustring &url)
 Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified url. More...
 
 background_image (const std::vector< xtd::drawing::color > &colors)
 Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified colors array. More...
 
 background_image (const std::vector< xtd::drawing::color > &colors, int32 angle)
 Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified colors and angle. More...
 
 background_image (xtd::forms::style_sheets::image_type image_type, const std::vector< xtd::drawing::color > &colors)
 Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified style and colors. More...
 
 background_image (xtd::forms::style_sheets::image_type image_type, const std::vector< xtd::drawing::color > &colors, int32 angle)
 Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified style, colors and angle. More...
 

Properties

int32 angle () const noexcept
 Gets the angle specifies the gradient direction. More...
 
void angle (int32 value) noexcept
 Sets the angle specifies the gradient direction. More...
 
const std::vector< xtd::drawing::color > & colors () const noexcept
 Gets the colors specifies what colors to display. More...
 
void colors (const std::vector< xtd::drawing::color > &value)
 Sets the colors that specifies what colors to display. More...
 
const xtd::uriurl () const noexcept
 Gets the url of image to display. More...
 
void url (const xtd::uri &value) noexcept
 Sets the url of image to display. More...
 
xtd::forms::style_sheets::image_type image_type () const noexcept
 Gets the image type that specifies what kind of image to display. More...
 
void image_type (xtd::forms::style_sheets::image_type value) noexcept
 Sets the style specifies what kind of image to display. More...
 

Methods

bool equals (const background_image &other) const noexcept override
 
xtd::ustring to_string () const noexcept override
 Returns a sxd::ustring that represents the current object. More...
 
static std::unique_ptr< xtd::drawing::brushmake_brush (const xtd::forms::style_sheets::background_image &image, const xtd::drawing::rectangle &rect)
 Creates a xtd::drawing::brush from specified image data and rectangle. More...
 

Additional Inherited Members

- Public Member Functions inherited from xtd::iequatable< background_image >
virtual bool equals (const background_image &) const noexcept=0
 Indicates whether the current object is equal to another object of the same type. More...
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object. More...
 
bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object. More...
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type. More...
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance. More...
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const noexcept
 Creates a shallow copy of the current object. More...
 
- 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. More...
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance. More...
 

Constructor & Destructor Documentation

◆ background_image() [1/6]

xtd::forms::style_sheets::background_image::background_image ( )
default

Initializes a new instance of the xtd::forms::style_sheets::background_image class.

Remarks
The following table shows the default values for the properties :
Property Default value
xtd::forms::style_sheets::background_image::angle 180
xtd::forms::style_sheets::background_image::colors An array with one color : xtd::drawing::color::black)
xtd::forms::style_sheets::background_image::image_type xtd::forms::style_sheets::image_type::none
xtd::forms::style_sheets::background_image::url An empty tring ("")
A value of 0 for angle is equivalent to "to top", a value of 90 for rangle is equivalent to "to right". a value of 180 for angle is equivalent to "to bottom", ...

◆ background_image() [2/6]

xtd::forms::style_sheets::background_image::background_image ( const xtd::ustring url)
explicit

Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified url.

Parameters
urlThe url of image to display.
Property Default value
xtd::forms::style_sheets::background_image::angle 180
xtd::forms::style_sheets::background_image::colors An array with one color : xtd::drawing::color::black)
xtd::forms::style_sheets::background_image::image_type xtd::forms::style_sheets::image_type::url
Remarks
A value of 0 for angle is equivalent to "to top", a value of 90 for rangle is equivalent to "to right". a value of 180 for angle is equivalent to "to bottom", ...

◆ background_image() [3/6]

xtd::forms::style_sheets::background_image::background_image ( const std::vector< xtd::drawing::color > &  colors)
explicit

Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified colors array.

Parameters
colorThe colors that specifies the color for gradient image to display.
Property Default value
xtd::forms::style_sheets::background_image::angle 180
xtd::forms::style_sheets::background_image::image_type xtd::forms::style_sheets::image_type::linera_gradient
xtd::forms::style_sheets::background_image::url An empty tring ("")
Remarks
A value of 0 for angle is equivalent to "to top", a value of 90 for rangle is equivalent to "to right". a value of 180 for angle is equivalent to "to bottom", ...

◆ background_image() [4/6]

xtd::forms::style_sheets::background_image::background_image ( const std::vector< xtd::drawing::color > &  colors,
int32  angle 
)

Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified colors and angle.

Parameters
colorThe colors that specifies the color for gradient image to display.
angleThe angle specifies the gradient direction.
Remarks
A value of 0 for angle is equivalent to "to top", a value of 90 for rangle is equivalent to "to right". a value of 180 for angle is equivalent to "to bottom", ...
Exceptions
xtd::argument_exceptioncolors is less than 2.

◆ background_image() [5/6]

xtd::forms::style_sheets::background_image::background_image ( xtd::forms::style_sheets::image_type  image_type,
const std::vector< xtd::drawing::color > &  colors 
)

Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified style and colors.

Parameters
image_typeThe style specifies what kind of image to display.
colorThe colors that specifies the color for gradient image to display.
Remarks
A value of 0 for angle is equivalent to "to top", a value of 90 for rangle is equivalent to "to right". a value of 180 for angle is equivalent to "to bottom", ...
Exceptions
xtd::argument_exceptioncolors is less than 2.
xtd::not_supported_exceptionif xtd::forms::style_sheets::background_image::image_type is not of xtd::forms::style_sheets::image_type::url and not xtd::forms::style_sheets::image_type::linear_gradient.

◆ background_image() [6/6]

xtd::forms::style_sheets::background_image::background_image ( xtd::forms::style_sheets::image_type  image_type,
const std::vector< xtd::drawing::color > &  colors,
int32  angle 
)

Initializes a new instance of the xtd::forms::style_sheets::background_image class with specified style, colors and angle.

Parameters
image_typeThe style specifies what kind of image to display.
colorThe colors that specifies the color for gradient image to display.
angleThe angle specifies the gradient direction.
Remarks
A value of 0 for angle is equivalent to "to top", a value of 90 for rangle is equivalent to "to right". a value of 180 for angle is equivalent to "to bottom", ...
Exceptions
xtd::argument_exceptioncolors is less than 2.
xtd::not_supported_exceptionif xtd::forms::style_sheets::background_image::image_type is not of xtd::forms::style_sheets::image_type::url and not xtd::forms::style_sheets::image_type::linear_gradient.

Member Function Documentation

◆ angle() [1/2]

int32 xtd::forms::style_sheets::background_image::angle ( ) const
noexcept

Gets the angle specifies the gradient direction.

Returns
The angle specifies the gradient direction.
Remarks
A value of 0 for angle is equivalent to "to top", a value of 90 for rangle is equivalent to "to right". a value of 180 for angle is equivalent to "to bottom", ...

◆ angle() [2/2]

void xtd::forms::style_sheets::background_image::angle ( int32  value)
noexcept

Sets the angle specifies the gradient direction.

Parameters
valueThe angle specifies the gradient direction.
Remarks
A value of 0 for angle is equivalent to "to top", a value of 90 for rangle is equivalent to "to right". a value of 180 for angle is equivalent to "to bottom", ...

◆ colors() [1/2]

const std::vector<xtd::drawing::color>& xtd::forms::style_sheets::background_image::colors ( ) const
noexcept

Gets the colors specifies what colors to display.

Returns
The colors specifies what colors to display.
Remarks
For xtd::forms::style_sheets::image_type::color, only the first color is used.

◆ colors() [2/2]

void xtd::forms::style_sheets::background_image::colors ( const std::vector< xtd::drawing::color > &  value)

Sets the colors that specifies what colors to display.

Parameters
valueThe colors specifies what colors to display.
Remarks
For xtd::forms::style_sheets::image_type::color, only the first color is used.
Exceptions
xtd::argument_exceptioncolors is less than 2.

◆ image_type() [1/2]

xtd::forms::style_sheets::image_type xtd::forms::style_sheets::background_image::image_type ( ) const
noexcept

Gets the image type that specifies what kind of image to display.

Returns
The image type tht specifies what kind of image to display.

◆ image_type() [2/2]

void xtd::forms::style_sheets::background_image::image_type ( xtd::forms::style_sheets::image_type  value)
noexcept

Sets the style specifies what kind of image to display.

Parameters
valueThe style specifies what kind of image to display.

◆ make_brush()

static std::unique_ptr<xtd::drawing::brush> xtd::forms::style_sheets::background_image::make_brush ( const xtd::forms::style_sheets::background_image image,
const xtd::drawing::rectangle rect 
)
static

Creates a xtd::drawing::brush from specified image data and rectangle.

Parameters
imageContains image data.
rectThe xtd::drawing::rectangle neeed for linear gradient brush
Returns
New instance of brush.

◆ to_string()

xtd::ustring xtd::forms::style_sheets::background_image::to_string ( ) const
overridevirtualnoexcept

Returns a sxd::ustring that represents the current object.

Returns
A string that represents the current object.
Examples
The following code example demonstrates what to_string returns.

Reimplemented from xtd::object.

◆ url() [1/2]

const xtd::uri& xtd::forms::style_sheets::background_image::url ( ) const
noexcept

Gets the url of image to display.

Returns
The url of image to display.

◆ url() [2/2]

void xtd::forms::style_sheets::background_image::url ( const xtd::uri value)
noexcept

Sets the url of image to display.

Parameters
valueThe url of image to display.

Member Data Documentation

◆ empty

const background_image xtd::forms::style_sheets::background_image::empty
static

Provides an empty xtd::forms::style_sheets::background_image object.


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