Skip to content

Commit 9479efe

Browse files
committed
::Image add FullScreen option
1 parent 84d6e65 commit 9479efe

File tree

3 files changed

+22
-18
lines changed

3 files changed

+22
-18
lines changed

lib/PDL/Graphics/TriD.pm

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -795,13 +795,13 @@ sub realcoords {
795795
}
796796

797797
sub checkargs {
798-
if(ref $_[$#_] eq "HASH" and $PDL::Graphics::TriD::verbose) {
798+
if(ref $_[-1] eq "HASH" and $PDL::Graphics::TriD::verbose) {
799799

800800
print "enter checkargs \n";
801801
for(['KeepTwiddling',\&keeptwiddling3d]) {
802802
print "checkargs >$_<\n";
803-
if(defined $_[$#_]{$_->[0]}) {
804-
&{$_->[1]}(delete $_[$#_]{$_->[0]});
803+
if(defined $_[-1]{$_->[0]}) {
804+
&{$_->[1]}(delete $_[-1]{$_->[0]});
805805
}
806806
}
807807
}
@@ -855,13 +855,15 @@ sub PDL::describe3d {
855855

856856
*imagrgb=*imagrgb=\&PDL::imagrgb;
857857
sub PDL::imagrgb {
858-
require PDL::Graphics::TriD::Image;
859-
my (@data) = @_; &checkargs;
860-
my $win = PDL::Graphics::TriD::get_current_window();
861-
my $imag = PDL::Graphics::TriD::Image->new(@data);
862-
$win->clear_viewports();
863-
$win->current_viewport()->add_object($imag);
864-
$win->twiddle();
858+
require PDL::Graphics::TriD::Image;
859+
my ($color, $opts) = @_; &checkargs;
860+
my $win = PDL::Graphics::TriD::get_current_window();
861+
$opts //= {};
862+
$opts->{FullScreen} = 1;
863+
my $imag = PDL::Graphics::TriD::Image->new($color, $opts);
864+
$win->clear_viewports();
865+
$win->current_viewport()->add_object($imag);
866+
$win->twiddle();
865867
}
866868

867869
# Plotting routines that use the 3D graph

lib/PDL/Graphics/TriD/GL.pm

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,13 @@ sub PDL::Graphics::TriD::STrigrid::gdraw {
402402

403403
sub PDL::Graphics::TriD::Image::togl {
404404
# A special construct which always faces the display and takes the entire window
405-
glMatrixMode(GL_MODELVIEW);
406-
glLoadIdentity();
407-
glMatrixMode(GL_PROJECTION);
408-
glLoadIdentity();
409-
glOrtho(0,1,0,1,-1,1);
405+
if ($_[0]{Options}{FullScreen}) {
406+
glMatrixMode(GL_MODELVIEW);
407+
glLoadIdentity();
408+
glMatrixMode(GL_PROJECTION);
409+
glLoadIdentity();
410+
glOrtho(0,1,0,1,-1,1);
411+
}
410412
goto &PDL::Graphics::TriD::GObject::togl;
411413
}
412414

lib/PDL/Graphics/TriD/Image.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ sub new {
2525
my $im = PDL::Graphics::TriD::realcoords('COLOR',$color);
2626
my $this = {
2727
Im => $im,
28-
Opts => $opts,
28+
Options => $opts,
2929
Points => $defaultvert,
3030
};
3131
if(defined $opts->{Points}) {
@@ -99,8 +99,8 @@ sub flatten {
9999
my $p = PDL->zeroes(PDL::float(),3,$xxd,$yyd);
100100

101101

102-
if(defined $this->{Opts}{Bg}) {
103-
$p .= $this->{Opts}{Bg};
102+
if(defined $this->{Options}{Bg}) {
103+
$p .= $this->{Options}{Bg};
104104
}
105105

106106
# print "MKFOOP\n";

0 commit comments

Comments
 (0)