just a small recap on the progress i have made,
If anyones looking for the code that is
#!/usr/local/bin/perl -w
use Tk; #<< NEED THIS
use Tk::widgets qw/JPEG PNG/; #<< NEED THIS FOR PNG IMAGES
use strict;
use warnings;
##start with a new window##
my $mw = MainWindow->new();
$mw->geometry("768x640");
$mw->title(" Tasdawg Window Tk v0.01");
##add icon(marker) and first tile(map)
my $icon = $mw->Photo(-file=>'marker.png');
my $tile1 = $mw->Photo(-file=>'1/1.png');
##Create the canvas to draw these too.
my $c1 = $mw->Canvas(-width => 768, -height => 768,
#-tile => $tile, # tile one image to the background(maybe
add all images togeather?)
-relief => 'sunken',
);
$c1->pack(-side => 'left');
##now create the image on the canvas
$c1->createImage(128, 128, -image => $tile1);
## using button 1 to add marker to the image canvas
$mw->Tk::bind("<ButtonPress-1>", [\&pimg, Ev('x'), Ev('y') ]);
##the sub function for the button being pressed
MainLoop;
sub pimg {
my ($canv, $x, $y) = @_;
my $x1 = $canv->canvasx($x);
my $y1 = $canv->canvasx($y);
# print "$x1 $y1\n";
#$c1->pack(-side => 'left');
$c1->createImage($x1, $y1, -image => $icon, -tags =>
['move']);
$current = $c1;
}
##p.s This code wont work - it is only a snippet from my code, that
has a lot more in it.
But thats the basic's
Now to tile an image see this line
$c1->createImage(128, 128, -image => $tile1);
for every 128,128 is the pixal Y axis and X axis
adding a second image u go like this
$c1->createImage(128, 384, -image => $tile2);
b-cos my images are 256x256 i have to come down 128 pixals at first
and then plus the image and get 384
here is a "768x640" tile'd map - all images displayed the same 3x3
map.
$c1->createImage(128, 128, -image => $tile1);
$c1->createImage(128, 384, -image => $tile2);
$c1->createImage(128, 640, -image => $tile3);
$c1->createImage(384, 128, -image => $tile4);
$c1->createImage(384, 384, -image => $tile5);
$c1->createImage(384, 640, -image => $tile6);
$c1->createImage(640, 128, -image => $tile4);
$c1->createImage(640, 384, -image => $tile5);
$c1->createImage(640, 640, -image => $tile6);
Easy as that - will post again on the improvement of not defining
images and getting them from the directory as and making each 3 images
go down in column's moving to next 3 images and then again for last 3
images. making total of 9 images in the canvas. also going to add a
pixal to LAT LON if anyone is interested in that.