#!/usr/bin/perl
use warnings;
use strict;
use feature qw(say);
use Time::Piece;
use Image::Imlib2;
my $aspect=9/16;
my $x=640;
my $y=$x*$aspect;
my $mx=0.15;
#my $mx=0.1;
my $image=Image::Imlib2->new($x,$y);
$image->has_alpha(255);
$image->set_color(255,255,255,255);
$image->add_font_path("/usr/share/fonts/truetype/noto");
$image->load_font("NotoSansMono-Regular.ttf/8");
$image->fill_rectangle(0,0,$x,$y);
$image->set_color(200,200,200,255);
#my $bx=$x/4;
#my $by=$y/4;
#$image->fill_rectangle(0,0,$bx,$by);
#$image->fill_rectangle($bx*2,0,$bx,$by);
#$image->fill_rectangle($bx,$by,$bx,$by);
#$image->fill_rectangle($bx*3,$by,$bx,$by);
#$image->fill_rectangle(0,$by*2,$bx,$by);
#$image->fill_rectangle($bx*2,$by*2,$bx,$by);

#$image->fill_rectangle($bx,$by*3,$bx,$by);
#$image->fill_rectangle($bx*3,$by*3,$bx,$by);

$image->set_color(0,0,0,255);
my $f=$mx/2;
for(my $a=$mx;$a<=1;$a+=$mx){
for(my $c=$mx;$c<=1;$c+=$mx){
my $pos_x= int(($a*$x)-($x/2));
my $pos_y= int(($c*$y)-($y/2));
$image->fill_ellipse($a*$x,$c*$y,2,2);
#$image->draw_point($a*$x,$c*$y);
$image->draw_text($a*$x,$c*$y,"$pos_x $pos_y");
$pos_x= int((($a-$f)*$x)-($x/2));
$pos_y= int((($c-$f)*$y)-($y/2));
$image->fill_ellipse(($a-$f)*$x,($c-$f)*$y,2,2);
#$image->draw_point(($a-$f)*$x,($c-$f)*$y);
$image->draw_text(($a-$f)*$x,($c-$f)*$y,"$pos_x $pos_y");




}
}
$image->save('./test-grid.png');

