xtd - Reference Guide 0.2.0
xtd::drawing::bitmap Class Reference

#include <bitmap.h>

Definition

Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes. A bitmap is an object used to work with images defined by pixel data.

class drawing_export_ bitmap : public xtd::drawing::image
Inheritance
xtd::objectxtd::drawing::imagextd::drawing::bitmap
Namespace
xtd::drawing
Library
xtd.drawing
Remarks
To draw an image on a Windows Form, you should use one of the draw_image methods.
Examples:
about_box.cpp, about_dialog.cpp, about_dialog_system.cpp, colored_tab_pages.cpp, countries.cpp, and fill_rectangle.cpp.

Fields

static bitmap empty
 Represent an empty bitmap. More...
 

Constructors

 bitmap (const image &original)
 Initializes a new instance of the bitmap class from the specified existing image. More...
 
 bitmap (const image &original, const xtd::drawing::size &new_size)
 Initializes a new instance of the bitmap class from the specified existing image, scaled to the specified size. More...
 
 bitmap (const image &original, const rectangle &new_rect)
 Initializes a new instance of the bitmap class from the specified existing image, scaled to the specified rectangle. More...
 
 bitmap (const xtd::ustring &filename)
 Initializes a new instance of the bitmap class from the specified file. More...
 
 bitmap (std::istream &stream)
 Initializes a new instance of the bitmap class from the specified data stream. More...
 
 bitmap (const char *const *bits)
 Initializes a new instance of the bitmap class from the specified data xpm. More...
 
 bitmap (int32_t width, int32_t height)
 Initializes a new instance of the Bitmap class with the specified size. More...
 
 bitmap (const xtd::drawing::size &size)
 Initializes a new instance of the Bitmap class with the specified size. More...
 

Methods

bitmap clone (const rectangle &rect)
 Creates a copy of the section of this Bitmap defined with a specified rectangle. More...
 
bitmap clone (const rectangle_f &rect)
 Creates a copy of the section of this Bitmap defined with a specified rectangle. More...
 
drawing::color get_pixel (int32_t x, int32_t y) const
 Gets the color of the specified pixel in this bitmap. More...
 
void set_pixel (int32_t x, int32_t y, const drawing::color &color)
 Sets the color of the specified pixel in this bitmap. More...
 

Additional Inherited Members

- Static Public Attributes inherited from xtd::drawing::image
static image empty
 Represent an empty xtd::drawing::image. More...
 
- Public Member Functions inherited from xtd::drawing::image
int32_t flags () const
 Gets attribute flags for the pixel data of this xtd::drawing::image. More...
 
std::vector< guidframe_dimentions_list () const
 Gets an array of GUIDs that represent the dimensions of frames within this image. More...
 
intptr_t handle () const
 Gets the handle of this image. More...
 
int32_t height () const
 Gets the height, in pixels, of this image. More...
 
float horizontal_resolution () const
 Gets the horizontal resolution, in pixels per inch, of this image. More...
 
imaging::color_palette palette () const
 Gets the color palette used for this image. More...
 
void palette (const imaging::color_palette &palette)
 Sets the color palette used for this image. More...
 
const size_fphysical_dimension () const
 Gets the width and height of this image. More...
 
imaging::pixel_format pixel_format () const
 Gets the pixel format for this image. More...
 
const std::vector< int32_t > & property_id_list () const
 Gets IDs of the property items stored in this image. More...
 
const std::vector< imaging::property_item > & property_items () const
 Gets all the property items (pieces of metadata) stored in this image. More...
 
const imaging::image_formatraw_format () const
 Gets the file format of this image. More...
 
const drawing::sizesize () const
 Gets the width and height, in pixels, of this image. More...
 
const std::anytag () const
 Gets an object that provides additional data about the image. More...
 
void tag (const std::any &tag)
 Sets an object that provides additional data about the image. More...
 
float vertical_resolution () const
 Gets the vertical resolution, in pixels per inch, of this image. More...
 
int32_t width () const
 Gets the width, in pixels, of this image. More...
 
graphics create_graphics ()
 Creates the xtd::drawing::graphics for the image. More...
 
xtd::drawing::rectangle_f get_bounds (xtd::drawing::graphics_unit page_unit) const
 Gets the bounds of the image in the specified unit. More...
 
xtd::drawing::imaging::encoder_parameters get_encoder_parameter_list (xtd::guid encoder) const
 Returns information about the parameters supported by the specified image encoder. More...
 
size_t get_frame_count (const xtd::drawing::imaging::frame_dimension &dimension) const
 Returns the number of frames of the specified dimension. More...
 
xtd::drawing::imaging::property_item get_property_item (int32_t propid)
 Gets the specified property item from this xtd::drawing::image. More...
 
xtd::drawing::image get_thmbnail_image (int32_t thumb_width, int32_t thunb_height)
 Returns a thumbnail for this xtd::drawing::image. More...
 
void rotate_flip (xtd::drawing::rotate_flip_type rotate_flip_type)
 Rotates, flips, or rotates and flips the xtd::drawing::image. More...
 
void save (const xtd::ustring &filename) const
 Saves this xtd::drawing::image to the specified file or stream. More...
 
void save (const xtd::ustring &filename, const xtd::drawing::imaging::image_format &format) const
 Saves this xtd::drawing::image to the specified file in the specified format. More...
 
void save (std::ostream &stream, const xtd::drawing::imaging::image_format &format) const
 Saves this image to the specified stream in the specified format. More...
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object. More...
 
virtual 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...
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
 Gets the type of the current instance. More...
 
virtual xtd::ustring to_string () const noexcept
 Returns a sxd::ustring that represents the current object. More...
 
- Static Public Member Functions inherited from xtd::drawing::image
static image from_file (const xtd::ustring &filename)
 Creates an image from the specified file. More...
 
static bitmap from_hbitmap (intptr_t hbitmap)
 Creates a xtd::drawing::bitmap from a handle to a GDI bitmap. More...
 
static image from_stream (std::istream &stream)
 Creates an xtd::drawing::image from the specified data stream. More...
 
static image from_data (const char *const *bits)
 Creates an xtd::drawing::image from the specified data pointer. More...
 
static int32_t get_pixel_format_size (xtd::drawing::imaging::pixel_format pixfmt)
 Returns the color depth, in number of bits per pixel, of the specified pixel format. More...
 
static bool is_alpha_pixel_format (xtd::drawing::imaging::pixel_format pixfmt)
 Returns a value that indicates whether the pixel format for this xtd::drawing::image contains alpha information. More...
 
static bool is_canonical_pixel_format (xtd::drawing::imaging::pixel_format pixfmt)
 Returns a value that indicates whether the pixel format is 32 bits per pixel. More...
 
static bool is_extended_pixel_format (xtd::drawing::imaging::pixel_format pixfmt)
 Returns a value that indicates whether the pixel format is 64 bits per pixel. 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

◆ bitmap() [1/8]

xtd::drawing::bitmap::bitmap ( const image original)
inlineexplicit

Initializes a new instance of the bitmap class from the specified existing image.

Parameters
originalThe xtd::drawing::image from which to create the new bitmap.

◆ bitmap() [2/8]

xtd::drawing::bitmap::bitmap ( const image original,
const xtd::drawing::size new_size 
)
inline

Initializes a new instance of the bitmap class from the specified existing image, scaled to the specified size.

Parameters
originalThe xtd::drawing::image from which to create the new bitmap.
new_sizeThe xtd::drawing::size structure that represent the size of the new bitmap.

◆ bitmap() [3/8]

xtd::drawing::bitmap::bitmap ( const image original,
const rectangle new_rect 
)
inline

Initializes a new instance of the bitmap class from the specified existing image, scaled to the specified rectangle.

Parameters
originalThe xtd::drawing::image from which to create the new bitmap.
new_rectThe xtd::drawing::rect structure that represent the location and size of the new bitmap.

◆ bitmap() [4/8]

xtd::drawing::bitmap::bitmap ( const xtd::ustring filename)
inlineexplicit

Initializes a new instance of the bitmap class from the specified file.

Parameters
filenameThe bitmap file name and path.
Remarks
The file name and path can be relative to the application or an absolute path. Use this constructor to open images with the following file formats: BMP, GIF, EXIF, JPG, PNG and TIFF. For more information about supported formats, see Types of Bitmaps. The file remains locked until the Bitmap is disposed.

◆ bitmap() [5/8]

xtd::drawing::bitmap::bitmap ( std::istream &  stream)
inlineexplicit

Initializes a new instance of the bitmap class from the specified data stream.

Parameters
streamThe data stream used to load the image.

◆ bitmap() [6/8]

xtd::drawing::bitmap::bitmap ( const char *const *  bits)
inlineexplicit

Initializes a new instance of the bitmap class from the specified data xpm.

Parameters
bitsThe data xpm used to load the image.

◆ bitmap() [7/8]

xtd::drawing::bitmap::bitmap ( int32_t  width,
int32_t  height 
)
inline

Initializes a new instance of the Bitmap class with the specified size.

Parameters
widthThe width, in pixels, of the new bitmap.
heightThe height, in pixels, of the new bitmap.

◆ bitmap() [8/8]

xtd::drawing::bitmap::bitmap ( const xtd::drawing::size size)
inlineexplicit

Initializes a new instance of the Bitmap class with the specified size.

Parameters
sizethe size, in pixels, of the new bitmap.

Member Function Documentation

◆ clone() [1/2]

bitmap xtd::drawing::bitmap::clone ( const rectangle rect)
inline

Creates a copy of the section of this Bitmap defined with a specified rectangle.

Parameters
rectDefines the portion of this bitmap to copy.

◆ clone() [2/2]

bitmap xtd::drawing::bitmap::clone ( const rectangle_f rect)
inline

Creates a copy of the section of this Bitmap defined with a specified rectangle.

Parameters
rectDefines the portion of this bitmap to copy.

◆ get_pixel()

drawing::color xtd::drawing::bitmap::get_pixel ( int32_t  x,
int32_t  y 
) const

Gets the color of the specified pixel in this bitmap.

Parameters
xThe x-coordinate of the pixel to retrieve.
yThe y-coordinate of the pixel to retrieve.
Returns
A xtd::drawing::color structure that represents the color of the specified pixel.

◆ set_pixel()

void xtd::drawing::bitmap::set_pixel ( int32_t  x,
int32_t  y,
const drawing::color color 
)

Sets the color of the specified pixel in this bitmap.

Parameters
xThe x-coordinate of the pixel to retrieve.
yThe y-coordinate of the pixel to retrieve.
colorA xtd::drawing::color structure that represents the color of the specified pixel.

Member Data Documentation

◆ empty

bitmap xtd::drawing::bitmap::empty
static

Represent an empty bitmap.


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