xtd 0.2.0
Loading...
Searching...
No Matches
hello_world_png.cpp

The classic first application "Hello, World!" with GDI+ drawing objects.

#include <xtd/xtd>
using namespace xtd;
using namespace xtd::diagnostics;
using namespace xtd::drawing;
using namespace xtd::io;
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.hpp:26
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition graphics.hpp: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.hpp:30
Encapsulates text layout information (such as alignment, orientation and tab stops) display manipulat...
Definition string_format.hpp:30
xtd::drawing::string_alignment alignment() const noexcept
Gets horizontal alignment of the string.
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition assert_dialog_result.hpp:10
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:11
The xtd::io namespace contains types that allow reading and writing to files and data streams,...
Definition binary_reader.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10