Adding initial cairo printing of forest box to the pokemon editor.

This commit is contained in:
Sergiotarxz 2024-03-06 01:51:55 +01:00
parent 3ab70cefe5
commit 3ace9d4438
4 changed files with 17 additions and 3 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "pokeemerald"]
path = pokeemerald
url = https://github.com/pret/pokeemerald

View File

@ -325,15 +325,25 @@ sub activate_about {
sub activate_view_pc {
my $gtk_window = Gtk4::Window->new;
my $canvas = Gtk4::DrawingArea->new;
$gtk_window->set_default_size(312,340);
$gtk_window->set_resizable(0);
$canvas->set_draw_func(sub {
my $canvas = shift;
my $cairo = shift;
my $width = shift;
my $height = shift;
print Data::Dumper::Dumper \%Cairo::;
my $root = path(__FILE__)->parent->parent->parent->parent;
$cairo->rectangle(0, 0, $width, $height);
$cairo->set_source_rgb(255, 0, 0);
$cairo->fill;
my $surface = Cairo::ImageSurface->create_from_png($root->child('resources/forest.png'));
$cairo->set_source_rgb(0, 0, 0);
$cairo->paint;
$cairo->scale(2, 2);
$cairo->set_source_surface($surface, 0, 0);
$cairo->get_source()->set_filter('nearest');
$cairo->paint;
});
$gtk_window->set_child($canvas);
$gtk_window->present;

1
pokeemerald Submodule

@ -0,0 +1 @@
Subproject commit 954ba0a15590d1eaf4929238cec4e0ea3d2e8dd4

BIN
resources/forest.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB