diff --git a/tests/tests/swfs/avm1/bitmap_data_perlinnoise/BitmapPerlinNoise.as b/tests/tests/swfs/avm1/bitmap_data_perlinnoise/BitmapPerlinNoise.as new file mode 100644 index 000000000..358d476b5 --- /dev/null +++ b/tests/tests/swfs/avm1/bitmap_data_perlinnoise/BitmapPerlinNoise.as @@ -0,0 +1,96 @@ +import flash.display.BitmapData; +import flash.geom.Rectangle; +import flash.geom.Point; + +class BitmapPerlinNoise { + + static function plop(mc : MovieClip, sx : Number, sy : Number, + transp : Boolean, + bx : Number, by : Number, + numOctaves : Number, + seed : Number, + stitch: Boolean, + fractalNoise: Boolean, + channelOptions: Number, + grayscale : Boolean + ) { + + var bd:BitmapData = new BitmapData(100, 100, transp, 0x00000000); + bd.fillRect(new Rectangle(30, 40, 10, 20), 0x80808080); + bd.perlinNoise(bx, by, numOctaves, seed, stitch, fractalNoise, channelOptions, grayscale); + + var bdmc:MovieClip = mc.createEmptyMovieClip("bitmap", mc.getNextHighestDepth()); + bdmc.attachBitmap(bd, mc.getNextHighestDepth()); + + bdmc._x = sx; + bdmc._y = sy; + } + + static function plop2(mc : MovieClip, sx : Number, sy : Number, + bx : Number, by : Number, + stitch: Boolean, + offsets + ) { + + var bd:BitmapData = new BitmapData(100, 100, true, 0x00000000); + bd.perlinNoise(bx, by, 3, 137, stitch, true, 7, false, offsets); + + var bdmc:MovieClip = mc.createEmptyMovieClip("bitmap", mc.getNextHighestDepth()); + bdmc.attachBitmap(bd, mc.getNextHighestDepth()); + + bdmc._x = sx; + bdmc._y = sy; + } + + static function main(mc) { + + // different baseX and baseY numbers + BitmapPerlinNoise.plop(mc, 10, 20, true, 100, 100, 1, 42, false, true, 7); + BitmapPerlinNoise.plop(mc, 150, 20, true, 500, 500, 1, 42, false, true, 7); + BitmapPerlinNoise.plop(mc, 310, 20, true, 0, 20, 1, 42, false, true, 7); + BitmapPerlinNoise.plop(mc, 450, 20, true, 30, 150, 1, 42, false, true, 7); + + // different numOctaves numbers + BitmapPerlinNoise.plop(mc, 10, 150, true, 100, 100, 0, 3, false, true, 7); + BitmapPerlinNoise.plop(mc, 150, 150, true, 100, 100, 1, 3, false, true, 7); + BitmapPerlinNoise.plop(mc, 310, 150, true, 100, 100, 2, 3, false, true, 7); + BitmapPerlinNoise.plop(mc, 450, 150, true, 100, 100, 3, 3, false, true, 7); + + // different stitch and fractalSum params + BitmapPerlinNoise.plop(mc, 10, 320, true, 310, 70, 2, 20, false, false, 7); + BitmapPerlinNoise.plop(mc, 150, 320, true, 130, 70, 2, 20, false, true, 7); + BitmapPerlinNoise.plop(mc, 310, 320, true, 130, 70, 2, 20, true, false, 7); + BitmapPerlinNoise.plop(mc, 450, 320, true, 130, 70, 2, 20, true, true, 7); + + // different channelOptions + BitmapPerlinNoise.plop(mc, 10, 450, true, 100, 100, 2, 242, false, true, 1 | 2 | 4, false); + BitmapPerlinNoise.plop(mc, 150, 450, true, 100, 100, 2, 242, false, true, 2, false); + BitmapPerlinNoise.plop(mc, 310, 450, true, 100, 100, 2, 242, false, true, 0, false); + BitmapPerlinNoise.plop(mc, 450, 450, true, 100, 100, 2, 242, false, true, 1 | 2 | 4 | 8, false); + // more channelOptions + BitmapPerlinNoise.plop(mc, 10, 620, true, 100, 100, 2, 578, false, true, 1 | 2 | 8, false); + BitmapPerlinNoise.plop(mc, 150, 620, true, 100, 100, 2, 578, false, true, 1 | 4, false); + BitmapPerlinNoise.plop(mc, 310, 620, true, 100, 100, 2, 578, false, true, 15, false); + BitmapPerlinNoise.plop(mc, 450, 620, true, 100, 100, 2, 578, false, true, 8, false); + + + // different channelOptions, but greyscale + BitmapPerlinNoise.plop(mc, 630, 20, true, 100, 100, 2, 242, false, true, 1 | 2 | 4, true); + BitmapPerlinNoise.plop(mc, 770, 20, true, 100, 100, 2, 242, false, true, 2, true); + BitmapPerlinNoise.plop(mc, 930, 20, true, 100, 100, 2, 242, false, true, 0, true); + BitmapPerlinNoise.plop(mc, 1070, 20, true, 100, 100, 2, 242, false, true, 1 | 2 | 4 | 8, true); + // more channelOptions, but greyscale + BitmapPerlinNoise.plop(mc, 630, 150, true, 100, 100, 2, 578, false, true, 1 | 2 | 8, true); + BitmapPerlinNoise.plop(mc, 770, 150, true, 100, 100, 2, 578, false, true, 1 | 4, true); + BitmapPerlinNoise.plop(mc, 930, 150, true, 100, 100, 2, 578, false, true, 15, true); + BitmapPerlinNoise.plop(mc, 1070, 150, true, 100, 100, 2, 578, false, true, 8, true); + + + // octave offsets + BitmapPerlinNoise.plop2(mc, 630, 320, 100, 100, false, [new Point(10, 20), new Point(-30, -40), new Point(135, 15)]); + BitmapPerlinNoise.plop2(mc, 770, 320, 60, 140, false, [new Point(10, 20)]); + BitmapPerlinNoise.plop2(mc, 930, 320, 100, 100, true, [new Point(10, 20), new Point(30, 70), new Point(135, 15)]); + BitmapPerlinNoise.plop2(mc, 1070, 320, 180, 58, true, [new Point(10, 20), new Point(600, 137)]); + + } +} \ No newline at end of file diff --git a/tests/tests/swfs/avm1/bitmap_data_perlinnoise/expected.png b/tests/tests/swfs/avm1/bitmap_data_perlinnoise/expected.png new file mode 100644 index 000000000..e67a8d5b1 Binary files /dev/null and b/tests/tests/swfs/avm1/bitmap_data_perlinnoise/expected.png differ diff --git a/tests/tests/swfs/avm1/bitmap_data_perlinnoise/output.txt b/tests/tests/swfs/avm1/bitmap_data_perlinnoise/output.txt new file mode 100644 index 000000000..e69de29bb diff --git a/tests/tests/swfs/avm1/bitmap_data_perlinnoise/test.swf b/tests/tests/swfs/avm1/bitmap_data_perlinnoise/test.swf new file mode 100644 index 000000000..3978e9181 Binary files /dev/null and b/tests/tests/swfs/avm1/bitmap_data_perlinnoise/test.swf differ diff --git a/tests/tests/swfs/avm1/bitmap_data_perlinnoise/test.toml b/tests/tests/swfs/avm1/bitmap_data_perlinnoise/test.toml new file mode 100644 index 000000000..db91125db --- /dev/null +++ b/tests/tests/swfs/avm1/bitmap_data_perlinnoise/test.toml @@ -0,0 +1,7 @@ +num_frames = 1 + +[image_comparison] +tolerance = 0 + +[player_options] +with_renderer = { optional = false, sample_count = 1 }