xtd 1.0.0
Loading...
Searching...
No Matches
icon.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "bitmap.hpp"
7#include <xtd/iequatable>
8#include <xtd/object>
9#include <xtd/string>
10#include <cstdint>
11#include <memory>
12
14namespace xtd {
16 namespace drawing {
28 class drawing_export_ icon : public xtd::object, public xtd::iequatable<icon> {
29 struct data;
30
31 public:
33
35 static icon empty;
37
39
48 explicit icon(const xtd::string& filename);
54 icon(const xtd::string& filename, const xtd::drawing::size& size);
61 icon(const xtd::string& filename, int32 width, int32 height);
69 explicit icon(std::istream& stream);
73 icon(std::istream& stream, const xtd::drawing::size& size);
78 icon(std::istream& stream, int32 width, int32 height);
87 explicit icon(const char* const* bits);
92 icon(const char* const* bits, const xtd::drawing::size& size);
98 icon(const char* const* bits, int32 width, int32 height);
103 icon(const icon& original, const xtd::drawing::size& size);
109 icon(const icon& original, int32 width, int32 height);
111
113 icon();
114 icon(const icon& icon) = default;
115 icon& operator =(const icon& icon) = default;
116 ~icon();
118
120
124 [[nodiscard]] auto handle() const noexcept -> xtd::intptr;
125
128 [[nodiscard]] auto height() const noexcept -> xtd::int32;
129
132 [[nodiscard]] auto size() const noexcept -> const xtd::drawing::size&;
133
136 [[nodiscard]] auto width() const noexcept -> xtd::int32;
138
140
145 [[nodiscard]] auto equals(const object& obj) const noexcept -> bool override;
149 [[nodiscard]] auto equals(const icon& other) const noexcept -> bool override;
150
153 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
154
157 auto save(const xtd::string& filename) const -> void;
160 auto save(std::ostream& stream) const -> void;
161
165 [[nodiscard]] auto to_bitmap() const -> xtd::drawing::bitmap;
166
169 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
171
173
178 [[nodiscard]] static auto from_bitmap(const xtd::drawing::bitmap& bitmap) -> icon;
179
184 [[nodiscard]] static auto from_handle(intptr handle) -> icon;
186
187 private:
188 explicit icon(const bitmap& bitmap);
189
190 xtd::sptr<data> data_;
191 };
192 }
193}
Contains xtd::drawing::bitmap class.
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes....
Definition bitmap.hpp:26
icon(const icon &original, int32 width, int32 height)
Initializes a new instance of the xtd::drawing::icon class and attempts to find a version of the icon...
icon(const xtd::string &filename, int32 width, int32 height)
Initializes a new instance of the xtd::drawing::icon class with the specified width and height from t...
icon(const char *const *bits)
Initializes a new instance of the xtd::drawing::icon class from the specified data.
icon(const char *const *bits, const xtd::drawing::size &size)
Initializes a new instance of the xtd::drawing::icon class of the specified size from the specified d...
icon(const icon &original, const xtd::drawing::size &size)
Initializes a new instance of the xtd::drawing::icon class and attempts to find a version of the icon...
auto height() const noexcept -> xtd::int32
Gets the height of this xtd::drawing::icon.
icon(std::istream &stream, const xtd::drawing::size &size)
Initializes a new instance of the xtd::drawing::icon class of the specified size from the specified s...
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
icon(const char *const *bits, int32 width, int32 height)
Initializes a new instance of the xtd::drawing::icon class from the specified data and with the speci...
auto width() const noexcept -> xtd::int32
Gets the width of this xtd::drawing::icon.
static auto from_handle(intptr handle) -> icon
Creates a GDI+ xtd::drawing::icon from the specified Windows handle to an icon (HICON).
icon(const xtd::string &filename, const xtd::drawing::size &size)
Initializes a new instance of the xtd::drawing::icon class of the specified size from the specified f...
icon(std::istream &stream, int32 width, int32 height)
Initializes a new instance of the xtd::drawing::icon class from the specified data stream and with th...
auto to_bitmap() const -> xtd::drawing::bitmap
Converts this xtd::drawing::icon to a GDI+ xtd::drawing::bitmap.
auto size() const noexcept -> const xtd::drawing::size &
Gets the size of this xtd::drawing::icon.
auto save(const xtd::string &filename) const -> void
Saves this xtd::drawing::icon to the specified output filename.
static auto from_bitmap(const xtd::drawing::bitmap &bitmap) -> icon
Creates a GDI+ xtd::drawing::icon from the specified bitmap.
auto to_string() const noexcept -> xtd::string override
Gets a human-readable string that describes the xtd::drawing::icon.
auto equals(const object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
icon(std::istream &stream)
Initializes a new instance of the xtd::drawing::icon class from the specified data stream.
auto handle() const noexcept -> xtd::intptr
Gets the handle of this icon. This is not a copy of the handle; do not free it.
icon(const xtd::string &filename)
Initializes a new instance of the xtd::drawing::icon class from the specified file name.
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
Contains drawing_export_ keyword.
#define drawing_export_
Define shared library export.
Definition drawing_export.hpp:13
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
std::intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr auto data() const noexcept -> const_pointer
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:197
Stores an ordered pair of integers, which specify a height and width.
Definition size.hpp:32