xtd 0.2.0
bitmap.h
Go to the documentation of this file.
1 #pragma once
5 #include "../drawing_export.h"
6 #include "imaging/bitmap_data.h"
8 #include "image.h"
9 
11 namespace xtd {
13  namespace drawing {
26  class drawing_export_ bitmap : public xtd::drawing::image {
27  public:
29 
32  static bitmap empty;
34 
36 
40  explicit bitmap(const image& original);
44  bitmap(const image& original, const xtd::drawing::size& new_size);
49  bitmap(const image& original, int32 width, int32 height);
53  bitmap(const image& original, const rectangle& new_rect);
57  explicit bitmap(const xtd::ustring& filename);
62  explicit bitmap(const xtd::ustring& filename, bool use_icm);
66  explicit bitmap(std::istream& stream);
72  explicit bitmap(std::istream& stream, bool use_icm);
75  explicit bitmap(const char* const* bits);
79  bitmap(int32 width, int32 height);
85  bitmap(int32 width, int32 height, const graphics& g);
97  bitmap(int32 width, int32 height, int32 stride, xtd::drawing::imaging::pixel_format format, intptr scan0);
100  explicit bitmap(const xtd::drawing::size& size);
102 
104 
108  bitmap clone(const rectangle& rect) const;
111  bitmap clone(const rectangle_f& rect) const;
112 
114  bitmap(const bitmap& bitmap) = default;
115  bitmap& operator =(const bitmap& bitmap) = default;
117 
121  static bitmap from_hicon(intptr icon);
122 
126  intptr get_hbitmap() const;
127 
132  intptr get_hbitmap(const color& background) const;
133 
137  intptr get_hicon() const;
138 
143  drawing::color get_pixel(int32 x, int32 y) const;
144 
164 
168  void make_transparent();
172  void make_transparent(const color& transparent_color);
173 
178  void set_pixel(int32 x, int32 y, const drawing::color& color);
179 
184  void set_resolution(int32 x_dpi, int32 y_dpi);
185 
189  void unlock_bits(const xtd::drawing::imaging::bitmap_data& data);
191 
192  private:
193  bitmap() = default;
194  };
195  }
196 }
intmax_t intptr
Represent a pointer or a handle.
Definition: types.h:151
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:31
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
image_lock_mode
Specifies flags that are passed to the flags parameter of the xtd::drawing::bitmap::lock_bits method...
Definition: image_lock_mode.h:20
Stores a set of four floating-point numbers that represent the location and size of a rectangle...
Definition: rectangle_f.h:34
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
Contains xtd::drawing::image class.
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes...
Definition: bitmap.h:26
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:45
Contains xtd::drawing::imaging::image_lock_mode class.
pixel_format
Specifies the format of the color data for each pixel in the image.
Definition: pixel_format.h:23
Contains xtd::drawing::imaging::bitmap_data class.
Specifies the attributes of a bitmap image. The xtd::drawing::imaging::bitmap_data class is used by t...
Definition: bitmap_data.h:22
Stores a set of four integers that represent the location and size of a rectangle.
Definition: rectangle.h:44
An abstract base class that provides functionality for the bitmap and metafile descended classes...
Definition: image.h:48
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition: graphics.h:70
static bitmap empty
Represent an empty bitmap.
Definition: bitmap.h:32
Represents a Windows icon, which is a small bitmap image that is used to represent an object...
Definition: icon.h:28