xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
bitmap.h
Go to the documentation of this file.
1 #pragma once
5 #include "../drawing_export.h"
6 #include "image.h"
7 
9 namespace xtd {
11  namespace drawing {
19  class drawing_export_ bitmap : public xtd::drawing::image {
20  public:
22 
25  static bitmap empty;
27 
29 
33  explicit bitmap(const image& original) : xtd::drawing::image(original) {}
37  bitmap(const image& original, const xtd::drawing::size& new_size) : xtd::drawing::image(original, new_size.width(), new_size.height()) {}
41  bitmap(const image& original, const rectangle& new_rect) : xtd::drawing::image(original, new_rect) {}
45  explicit bitmap(const xtd::ustring& filename) : xtd::drawing::image(filename) {}
48  explicit bitmap(std::istream& stream) : xtd::drawing::image(stream) {}
51  explicit bitmap(const char* const* bits) : xtd::drawing::image(bits) {}
55  bitmap(int32_t width, int32_t height) : xtd::drawing::image(width, height) {}
58  explicit bitmap(const xtd::drawing::size& size) : xtd::drawing::image(size.width(), size.height()) {}
60 
62 
66  bitmap clone(const rectangle& rect) {return bitmap(*this, rect);}
69  bitmap clone(const rectangle_f& rect) {return bitmap(*this, xtd::drawing::rectangle::ceiling(rect));}
70 
72  bitmap(const bitmap& bitmap) = default;
73  bitmap& operator=(const bitmap& bitmap) = default;
75 
80  drawing::color get_pixel(int32_t x, int32_t y) const;
81 
86  void set_pixel(int32_t x, int32_t y, const drawing::color& color);
88 
89  private:
90  bitmap() = default;
91  };
92  }
93 }
bitmap(const image &original, const rectangle &new_rect)
Initializes a new instance of the bitmap class from the specified existing image, scaled to the speci...
Definition: bitmap.h:41
bitmap(std::istream &stream)
Initializes a new instance of the bitmap class from the specified data stream.
Definition: bitmap.h:48
bitmap clone(const rectangle_f &rect)
Creates a copy of the section of this Bitmap defined with a specified rectangle.
Definition: bitmap.h:69
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:25
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
bitmap(const xtd::drawing::size &size)
Initializes a new instance of the Bitmap class with the specified size.
Definition: bitmap.h:58
Stores a set of four floating-points that represent the location and size of a rectangle.
Definition: rectangle_f.h:28
bitmap(const char *const *bits)
Initializes a new instance of the bitmap class from the specified data xpm.
Definition: bitmap.h:51
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:50
Contains xtd::drawing::image class.
bitmap(const xtd::ustring &filename)
Initializes a new instance of the bitmap class from the specified file.
Definition: bitmap.h:45
bitmap clone(const rectangle &rect)
Creates a copy of the section of this Bitmap defined with a specified rectangle.
Definition: bitmap.h:66
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes...
Definition: bitmap.h:19
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:39
Stores a set of four integers that represent the location and size of a rectangle.
Definition: rectangle.h:25
An abstract base class that provides functionality for the bitmap and metafile descended classes...
Definition: image.h:34
bitmap(int32_t width, int32_t height)
Initializes a new instance of the Bitmap class with the specified size.
Definition: bitmap.h:55
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 speci...
Definition: bitmap.h:37
static bitmap empty
Represent an empty bitmap.
Definition: bitmap.h:25
bitmap(const image &original)
Initializes a new instance of the bitmap class from the specified existing image. ...
Definition: bitmap.h:33