The classic first application "Hello, World!" with GDI+ drawing objects.
#include <xtd/xtd>
auto main() -> int {
auto hello_world_bitmap =
bitmap {300, 300};
auto graphics = graphics::from_image(hello_world_bitmap);
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);
process::start(hello_world_path);
}
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes....
Definition bitmap.h:26
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition graphics.h:70
void draw_string(const xtd::string &s, const xtd::drawing::font &font, const xtd::drawing::brush &brush, const xtd::drawing::rectangle_f &layout_rectangle)
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.h:30
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition assert_dialog_result.h:10
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.h:11
The xtd::io namespace contains types that allow reading and writing to files and data streams,...
Definition binary_reader.h:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10