Debian Codegraph @

t/t9.t

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 use strict; use warnings;
2 use Test::More;
3 use Config;
4 # Stop f77-linking causing spurious undefined symbols (alpha)
5 $ENV{'PERL_DL_NONLAZY'}=0 if $Config{'osname'} eq "dec_osf";
6 require PGPLOT;
7 plan skip_all => 'CI fails with bus error' if $^O eq 'darwin' and $ENV{CI};
8
9 my $dev = $ENV{PGPLOT_DEV} || '/NULL';
10
11 $ENV{PGPLOT_XW_WIDTH}=0.3;
12
13 note "Testing PGPLOT 5.0 colour image routines";
14
15 # Read in image (int*2)
16
17 my $img="";
18 open(my $fh,"test.img") || die "Data file test.img not found";
19 if($^O =~ /mswin32/i) {binmode($fh)}
20 read($fh, $img, 32768);
21 close($fh) or die "Can't close test.img: $!";
22
23 note length($img)," bytes read";
24
25 my @image = unpack("n*",$img);
26
27 note $#image+1," element image stored";
28
29 PGPLOT::pgbegin(0,$dev,1,1); # Open plot device
30
31 note "Plotting...";
32
33 PGPLOT::pgsci(3);
34 PGPLOT::pgwnad(12000,13000,13000,12000);
35
36 my @tr=(12000,8,0,12000,0,8);
37
38 PGPLOT::pgimag(\@image,128,128,1,128,1,128,0,5000,\@tr);
39 PGPLOT::pglabel("\\ga","\\gd","Galaxy");
40 PGPLOT::pgtbox("ZYHBCNST",0,0,"ZYDBCNST",0,0);
41
42 # Note: pgimag() usually defaults to a grey scale unless you explicitly set
43 # a colour ramp look-up table with pgctab(). Because it is a look
44 # up table it can be set after drawing the image. It is best to set an
45 # explicit LUT as a grey scale default can not be guaranteed on all devices.
46
47 # Set PHIL2 colour table
48
49 my @l=(0,0.004,0.502,0.941,1); my @r=(0,0,1,1,1);
50 my @g=(0,0,0.2,1,1); my @b=(0,0.2,0,0.1,1);
51
52 PGPLOT::pgctab(\@l,\@r,\@g,\@b,5,1,0.5);
53
54 PGPLOT::pgsci(4); PGPLOT::pgsls(1);
55 my @cont = (-1,1000,2000,3000,4000,5000);
56 PGPLOT::pgcons(\@image, 128, 128, 1,128,1,128, \@cont, 6, \@tr);
57
58 for(@cont){
59 PGPLOT::pgconl(\@image, 128, 128, 1,128,1,128, $_, \@tr, $_,200,100);
60 }
61
62 PGPLOT::pgsci(4); PGPLOT::pgscf(2);
63 my (@xbox, @ybox);
64 PGPLOT::pgqtxt(12125,12100,45,0.5,'PGPLOT...',\@xbox,\@ybox);
65 PGPLOT::pgpoly(4,\@xbox, \@ybox);
66 PGPLOT::pgsci(7);
67 PGPLOT::pgptxt(12125,12100,45,0.5,'PGPLOT...');
68
69 PGPLOT::pgqinf("CURSOR",my $ans,my $l);
70 # x/y are input/output for pgband: they set the initial cursor position,
71 # so initialise them (and let the position carry over between modes)
72 my ($x,$y,$ch) = (12500,12500,'');
73 if ($ans eq "YES") { for(my $mode=0; $mode<8; $mode++){
74
75 note "Entering interactive PGBAND test MODE=$mode, hit any key, Q to exit early...";
76
77 PGPLOT::pgsci($mode+1);
78 PGPLOT::pgband($mode,0,12500,12500,$x,$y,$ch);
79 last if $ch eq "q" || $ch eq "Q";
80 PGPLOT::pgqtxt($x,$y,45,0.5,'PGPLOT...',\@xbox,\@ybox);
81 PGPLOT::pgpoly(4,\@xbox, \@ybox);
82 PGPLOT::pgsci($mode+2);
83 PGPLOT::pgptxt($x,$y,45,0.5,'PGPLOT...');
84
85 }}
86
87 PGPLOT::pgend();
88
89 pass;
90 done_testing;