xtd - Reference Guide  0.1.1
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 {
20  public:
23  explicit bitmap(const image& original) : xtd::drawing::image(original) {}
27  bitmap(const image& original, const xtd::drawing::size& new_size) : xtd::drawing::image(original, new_size.width(), new_size.height()) {}
31  bitmap(const image& original, const rectangle& new_rect) : xtd::drawing::image(original, new_rect) {}
35  explicit bitmap(const xtd::ustring& filename) : xtd::drawing::image(filename) {}
38  explicit bitmap(std::istream& stream) : xtd::drawing::image(stream) {}
41  explicit bitmap(const char* const* bits) : xtd::drawing::image(bits) {}
45  bitmap(int32_t width, int32_t height) : xtd::drawing::image(width, height) {}
48  explicit bitmap(const xtd::drawing::size& size) : xtd::drawing::image(size.width(), size.height()) {}
49 
52  bitmap clone(const rectangle& rect) {return bitmap(*this, rect);}
55  bitmap clone(const rectangle_f& rect) {return bitmap(*this, xtd::drawing::rectangle::ceiling(rect));}
56 
58  bitmap(const bitmap& bitmap) = default;
59  bitmap& operator=(const bitmap& bitmap) = default;
61 
66  drawing::color get_pixel(int32_t x, int32_t y) const;
67 
72  void set_pixel(int32_t x, int32_t y, const drawing::color& color);
73 
75  static bitmap empty;
76 
77  private:
78  bitmap() = default;
79  };
80  }
81 }
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes....
Definition: bitmap.h:19
drawing::color get_pixel(int32_t x, int32_t y) const
Gets the color of the specified pixel in this bitmap.
bitmap(std::istream &stream)
Initializes a new instance of the bitmap class from the specified data stream.
Definition: bitmap.h:38
bitmap(const image &original)
Initializes a new instance of the bitmap class from the specified existing image.
Definition: bitmap.h:23
static bitmap empty
Represent an empty bitmap.
Definition: bitmap.h:75
bitmap(int32_t width, int32_t height)
Initializes a new instance of the Bitmap class with the specified size.
Definition: bitmap.h:45
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:27
bitmap clone(const rectangle &rect)
Creates a copy of the section of this Bitmap defined with a specified rectangle.
Definition: bitmap.h:52
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:31
bitmap clone(const rectangle_f &rect)
Creates a copy of the section of this Bitmap defined with a specified rectangle.
Definition: bitmap.h:55
void set_pixel(int32_t x, int32_t y, const drawing::color &color)
Sets the color of the specified pixel in this bitmap.
bitmap(const char *const *bits)
Initializes a new instance of the bitmap class from the specified data xpm.
Definition: bitmap.h:41
bitmap(const xtd::ustring &filename)
Initializes a new instance of the bitmap class from the specified file.
Definition: bitmap.h:35
bitmap(const xtd::drawing::size &size)
Initializes a new instance of the Bitmap class with the specified size.
Definition: bitmap.h:48
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:39
An abstract base class that provides functionality for the bitmap and metafile descended classes.
Definition: image.h:34
Stores a set of four floating-points that represent the location and size of a rectangle.
Definition: rectangle_f.h:28
Stores a set of four integers that represent the location and size of a rectangle.
Definition: rectangle.h:25
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:25
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
#define drawing_export_
Define shared library export.
Definition: drawing_export.h:13
Contains xtd::drawing::image class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17