The classic first application "Hello, World!" with GDI+ drawing objects.
#include <xtd/xtd>
auto main() -> int {
auto hello_world_bitmap =
bitmap {300, 300};
graphics.
draw_string(
"Hello World!", {
system_fonts::default_font(), 32,
font_style::bold |
font_style::italic},
solid_brush {
color_converter::dark(
color::spring_green, 2.0 / 3)},
rectangle::offset({{0, 0}, hello_world_bitmap.size()}, {2, 2}),
string_format {}.
alignment(
string_alignment::center).line_alignment(
string_alignment::center));
graphics.
draw_string(
"Hello World!", {
system_fonts::default_font(), 32,
font_style::bold |
font_style::italic},
brushes::spring_green(),
rectangle::inflate({{0, 0}, hello_world_bitmap.size()}, {-2, -2}),
string_format {}.
alignment(
string_alignment::center).line_alignment(
string_alignment::center));
auto hello_world_path = path::combine(path::get_temp_path(), "hello_world.png");
hello_world_bitmap.save(hello_world_path);
}
Specifies a set of values that are used when you start a process.
Definition process_start_info.hpp:40
bool use_shell_execute() const noexcept
Gets a value indicating whether to use the operating system shell to start the process.
auto start() -> bool
Starts (or reuses) the process resource that is specified by the xtd::diagnostics::process::start_inf...
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes....
Definition bitmap.hpp:26
static auto spring_green() -> xtd::drawing::solid_brush
A system-defined brush object.
static auto dark(const xtd::drawing::color &color) noexcept -> xtd::drawing::color
Creates a new darker color of the specified color with 33% factor.
static const xtd::drawing::color spring_green
Gets a system-defined color that has an ARGB value of 0xFF00FF7F. This field is constant.
Definition color.hpp:449
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition graphics.hpp:67
static auto from_image(const xtd::drawing::image &image) -> graphics
Creates a new xtd::drawing::graphics from the specified xtd::drawing::image.
auto draw_string(const xtd::string &s, const xtd::drawing::font &font, const xtd::drawing::brush &brush, const xtd::drawing::rectangle_f &layout_rectangle) -> void
Draws the specified text string at the specified rectangle with the specified xtd::drawing::brush and...
Defines a xtd::drawing::brush of a single color. Brushes are used to fill graphics shapes,...
Definition solid_brush.hpp:29
static auto default_font() -> xtd::drawing::font
Gets the default font that applications can use for dialog boxes and forms.
@ italic
Italic text.
Definition font_style.hpp:23
@ bold
Bold text.
Definition font_style.hpp:21
@ center
Specifies that text is aligned in the center of the layout rectangle.
Definition string_alignment.hpp:27
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
auto inflate(const xtd::drawing::size &sz) noexcept -> void
Enlarges this xtd::drawing::rectangle by the specified amount.
auto offset(const xtd::drawing::point &pos) noexcept -> void
Adjusts the location of this rectangle by the specified amount.