print "ok 1\n";
init_log("testout/t69rubthru.log", 1);
+my $src_height = 80;
+my $src_width = 80;
+
# raw interface
my $targ = Imager::ImgRaw::new(100, 100, 3);
-my $src = Imager::ImgRaw::new(80, 80, 4);
+my $src = Imager::ImgRaw::new($src_height, $src_width, 4);
my $halfred = NC(255, 0, 0, 128);
i_box_filled($src, 20, 20, 60, 60, $halfred);
-i_rubthru($targ, $src, 10, 10) or print "not ";
+i_rubthru($targ, $src, 10, 10, 0, 0, $src_width, $src_height) or print "not ";
print "ok 2\n";
my $c = Imager::i_get_pixel($targ, 10, 10) or print "not ";
print "ok 3\n";
my $black = NC(0, 0, 0);
# reset the target and try a grey+alpha source
i_box_filled($targ, 0, 0, 100, 100, $black);
-my $gsrc = Imager::ImgRaw::new(80, 80, 2);
+my $gsrc = Imager::ImgRaw::new($src_width, $src_height, 2);
my $halfwhite = NC(255, 128, 0);
i_box_filled($gsrc, 20, 20, 60, 60, $halfwhite);
-i_rubthru($targ, $gsrc, 10, 10) or print "not ";
+i_rubthru($targ, $gsrc, 10, 10, 0, 0, $src_width, $src_height) or print "not ";
print "ok 7\n";
$c = Imager::i_get_pixel($targ, 15, 15) or print "not ";
print "ok 8\n";
# try grey target and grey alpha source
my $gtarg = Imager::ImgRaw::new(100, 100, 1);
-i_rubthru($gtarg, $gsrc, 10, 10) or print "not ";
+i_rubthru($gtarg, $gsrc, 10, 10, 0, 0, $src_width, $src_height) or print "not ";
print "ok 12\n";
$c = Imager::i_get_pixel($gtarg, 10, 10) or print "not ";
print "ok 13\n";
print "ok 15\n";
# an attempt rub a 4 channel image over 1 channel should fail
-i_rubthru($gtarg, $src, 10, 10) and print "not ";
+i_rubthru($gtarg, $src, 10, 10, 0, 0, $src_width, $src_height) and print "not ";
print "ok 16\n";
# simple test for 16-bit/sample images
my $targ16 = Imager::i_img_16_new(100, 100, 3);
-i_rubthru($targ16, $src, 10, 10) or print "not ";
+i_rubthru($targ16, $src, 10, 10, 0, 0, $src_width, $src_height) or print "not ";
print "ok 17\n";
$c = Imager::i_get_pixel($targ16, 30, 30) or print "not ";
print "ok 18\n";
# check the OO interface
my $ootarg = Imager->new(xsize=>100, ysize=>100);
my $oosrc = Imager->new(xsize=>80, ysize=>80, channels=>4);
-$oosrc->box(color=>$halfred, xmin=>20, ymin=>20, xmax=>60, ymax=>60,
+$oosrc->box(color=>$halfred, xmin=>20, ymin=>20, xmax=>60, ymax=>60,
filled=>1);
$ootarg->rubthrough(src=>$oosrc, tx=>10, ty=>10) or print "not ";
print "ok 20\n";