Skip to content

Commit 974738f

Browse files
committed
tests: Add BitmapData.copyPixels image test from PR #2488
1 parent c090fe3 commit 974738f

7 files changed

Lines changed: 67 additions & 0 deletions

File tree

tests/tests/regression_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ swf_tests! {
556556
(bevel_filter, "avm1/bevel_filter", 1),
557557
(bitmap_data, "avm1/bitmap_data", 1),
558558
(bitmap_data_compare, "avm1/bitmap_data_compare", 1),
559+
(bitmap_data_copypixels, "avm1/bitmap_data_copypixels", 2, img = true),
559560
(bitmap_data_max_size_swf10, "avm1/bitmap_data_max_size_swf10", 1),
560561
(bitmap_data_max_size_swf9, "avm1/bitmap_data_max_size_swf9", 1),
561562
(bitmap_data_noise, "avm1/bitmap_data_noise", 1),
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import flash.display.BitmapData;
2+
import flash.geom.Rectangle;
3+
import flash.geom.Point;
4+
5+
class BitmapCopyPixels {
6+
7+
static function plop(mc : MovieClip, sx : Number, sy : Number,
8+
transp_src : Boolean, transp_dest : Boolean, transp_alpha : Boolean,
9+
merge: Boolean) {
10+
11+
var dest:BitmapData = new BitmapData(100, 100, transp_dest, 0xBBFF0000);
12+
dest.fillRect(new Rectangle(20,10, 20, 80), 0x8888FF00);
13+
dest.fillRect(new Rectangle(50,10, 20, 80), 0x220088FF);
14+
15+
var dest_img:MovieClip = mc.createEmptyMovieClip("dest_img", mc.getNextHighestDepth());
16+
dest_img.attachBitmap(dest, mc.getNextHighestDepth());
17+
18+
dest_img._x = sx;
19+
dest_img._y = sy;
20+
21+
22+
var src:BitmapData = new BitmapData(80, 20, transp_src, 0x44888888);
23+
var src_img:MovieClip = mc.createEmptyMovieClip("src_img", mc.getNextHighestDepth());
24+
src_img.attachBitmap(src, mc.getNextHighestDepth());
25+
src.fillRect(new Rectangle(5, 5, 10, 10), 0xAA2288DD);
26+
27+
src_img._x = sx + 110;
28+
src_img._y = sy + 20;
29+
30+
dest.copyPixels(src, new Rectangle(0,0,80,20), new Point(10, 10));
31+
32+
33+
var alpha:BitmapData = new BitmapData(40, 20, transp_alpha, 0x66884422);
34+
var alpha_img:MovieClip = mc.createEmptyMovieClip("alpha_img", mc.getNextHighestDepth());
35+
alpha_img.attachBitmap(alpha, mc.getNextHighestDepth());
36+
alpha.fillRect(new Rectangle(4, 8, 12, 30), 0xEE8844DD);
37+
38+
alpha_img._x = sx + 110;
39+
alpha_img._y = sy + 60;
40+
41+
dest.copyPixels(src, new Rectangle(0,0,80,20), new Point(10, 50), alpha, new Point(0,0), merge);
42+
}
43+
44+
static function main(mc) {
45+
BitmapCopyPixels.plop(mc, 10, 20, true, true, true , false);
46+
BitmapCopyPixels.plop(mc, 210, 20, true, true, false , false);
47+
BitmapCopyPixels.plop(mc, 410, 20, true, false, true , false);
48+
BitmapCopyPixels.plop(mc, 610, 20, true, false, false , false);
49+
50+
BitmapCopyPixels.plop(mc, 10, 220, false, true, true , false);
51+
BitmapCopyPixels.plop(mc, 210, 220, false, true, false , false);
52+
BitmapCopyPixels.plop(mc, 410, 220, false, false, true , false);
53+
BitmapCopyPixels.plop(mc, 610, 220, false, false, false , false);
54+
55+
56+
BitmapCopyPixels.plop(mc, 10, 520, true, true, true , true);
57+
BitmapCopyPixels.plop(mc, 210, 520, true, true, false , true);
58+
BitmapCopyPixels.plop(mc, 410, 520, true, false, true , true);
59+
BitmapCopyPixels.plop(mc, 610, 520, true, false, false , true);
60+
61+
BitmapCopyPixels.plop(mc, 10, 720, false, true, true , true);
62+
BitmapCopyPixels.plop(mc, 210, 720, false, true, false , true);
63+
BitmapCopyPixels.plop(mc, 410, 720, false, false, true , true);
64+
BitmapCopyPixels.plop(mc, 610, 720, false, false, false , true);
65+
}
66+
}
22.5 KB
Loading
22.5 KB
Loading
22.5 KB
Loading

tests/tests/swfs/avm1/bitmap_data_copypixels/output.txt

Whitespace-only changes.
783 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)