Skip to content

Commit

Permalink
Prima to support actual RGB images
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Apr 21, 2024
1 parent 7d024bb commit 8ee0431
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lib/PDL/Graphics/Simple/Prima.pm
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,22 @@ sub _load_types {
my $dy = 0.5 * ($ymax-$ymin) / ($data->[0]->dim(1) - (($data->[1]->dim(1)==1) ? 0 : 1));
$ymin -= $dy;
$ymax += $dy;
my $dataset;
my $imdata = $data->[2];
my @bounds = (x_bounds=>[ $xmin, $xmax ], y_bounds=>[ $ymin, $ymax ]);
if ($imdata->ndims > 2) {
$imdata = $imdata->mv(-1,0) if $imdata->dim(0) != 3;
$imdata = $imdata->sumover;
}
$plot->dataSets()->{ 1+keys(%{$plot->dataSets()}) } =
ds::Grid($imdata,
x_bounds=>[ $xmin, $xmax ],
y_bounds=>[ $ymin, $ymax ],
plotType=>pgrid::Matrix(palette => bless({crange=>$me->{ipo}{crange},data=>$imdata,co=>$co},'PDL::Graphics::Simple::Prima::Sepia_Palette')),
$dataset = ds::Image($imdata, @bounds);
} else {
$dataset = ds::Grid($imdata,
@bounds,
plotType=>pgrid::Matrix(palette => bless(
{crange=>$me->{ipo}{crange},data=>$imdata,co=>$co},
'PDL::Graphics::Simple::Prima::Sepia_Palette'
)),
);
}
$plot->dataSets()->{ 1+keys(%{$plot->dataSets()}) } = $dataset;
if(!!$ipo->{wedge}) {
print STDERR "Color wedges are not supported (yet) in Prima\n";
}
Expand Down

0 comments on commit 8ee0431

Please sign in to comment.