| 1 | use strictscip-perl cpan PGPLOT 2.36 strict/; use warningsscip-perl cpan PGPLOT 2.36 warnings/; |
| 2 | use Test::Morescip-perl cpan PGPLOT 2.36 Test/More/; |
| 3 | use Configscip-perl cpan PGPLOT 2.36 Config/; |
| 4 | # Stop f77-linking causing spurious undefined symbols (alpha) |
| 5 | $ENVscip-perl cpan PGPLOT 2.36 main/`%ENV`.{'PERL_DL_NONLAZY'}=0 if $Configscip-perl cpan PGPLOT 2.36 main/`%Config`.{'osname'} eq "dec_osf"; |
| 6 | requirescip-perl cpan PGPLOT 2.36 main/require(). PGPLOT; |
| 7 | |
| 8 | my $dev = $ENVscip-perl cpan PGPLOT 2.36 main/`%ENV`.{PGPLOT_DEV} || '/NULL'; |
| 9 | |
| 10 | $ENVscip-perl cpan PGPLOT 2.36 main/`%ENV`.{PGPLOT_XW_WIDTH}=0.3; |
| 11 | |
| 12 | notescip-perl cpan PGPLOT 2.36 main/note(). "Testing pghi2d routine"; |
| 13 | |
| 14 | # Read in image (int*2) |
| 15 | |
| 16 | my $img=""; |
| 17 | openscip-perl cpan PGPLOT 2.36 main/open().(my $fh,"test.img") || diescip-perl cpan PGPLOT 2.36 main/die(). "Data file test.img not found"; |
| 18 | if($^Oscip-perl cpan PGPLOT 2.36 main/`$^O`. =~ /mswin32/i) {binmodescip-perl cpan PGPLOT 2.36 main/binmode().($fh)} |
| 19 | readscip-perl cpan PGPLOT 2.36 main/read().($fh, $img, 32768); |
| 20 | closescip-perl cpan PGPLOT 2.36 main/close().($fh) or diescip-perl cpan PGPLOT 2.36 main/die(). "Can't close test.img: $!"; |
| 21 | |
| 22 | notescip-perl cpan PGPLOT 2.36 main/note(). lengthscip-perl cpan PGPLOT 2.36 main/length().($img)," bytes read"; |
| 23 | |
| 24 | my @image = unpackscip-perl cpan PGPLOT 2.36 main/unpack().("n*",$img); |
| 25 | |
| 26 | note $#imagescip-perl cpan PGPLOT 2.36 main/`$#image`.+1," element image stored"; |
| 27 | |
| 28 | PGPLOT::pgbeginscip-perl cpan PGPLOT 2.36 PGPLOT/pgbegin().(0,$dev,1,1); |
| 29 | |
| 30 | notescip-perl cpan PGPLOT 2.36 main/note(). "Plotting\n"; |
| 31 | |
| 32 | PGPLOT::pgenvscip-perl cpan PGPLOT 2.36 PGPLOT/pgenv().(0,256,0,65000,0,0); |
| 33 | |
| 34 | PGPLOT::pgsciscip-perl cpan PGPLOT 2.36 PGPLOT/pgsci().(5); |
| 35 | |
| 36 | my @xvals = (1..128); |
| 37 | my @work = (1..128); |
| 38 | |
| 39 | PGPLOT::pgbbufscip-perl cpan PGPLOT 2.36 PGPLOT/pgbbuf().(); # buffer so giza does not flush to screen per primitive |
| 40 | PGPLOT::pghi2dscip-perl cpan PGPLOT 2.36 PGPLOT/pghi2d().(\@image, 128, 128, 1,128,1,128, \@xvals, 1, 200, 1, \@work); |
| 41 | PGPLOT::pgebufscip-perl cpan PGPLOT 2.36 PGPLOT/pgebuf().(); |
| 42 | |
| 43 | PGPLOT::pgendscip-perl cpan PGPLOT 2.36 PGPLOT/pgend().(); |
| 44 | |
| 45 | pass; |
| 46 | done_testing; |