• bitmapdata的功能,不规则图形的遮罩


    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.BitmapDataChannel;
    import flash.geom.Point;
    import flash.geom.Rectangle;
     
    var bmd1:BitmapData = new BitmapData(200, 200, true, 0xFFCCCCCC);
     
    var seed:int = int(Math.random() * int.MAX_VALUE);
    var channels:uint = BitmapDataChannel.RED | BitmapDataChannel.BLUE;
    bmd1.perlinNoise(100, 80, 12, seed, false, true, channels, false, null);
     
    var bitmap1:Bitmap = new Bitmap(bmd1);
    addChild(bitmap1);
     
    var bmd2:BitmapData = new BitmapData(200, 200, true, 0xFFCCCCCC);
    var pt:Point = new Point(0, 0);
    var rect:Rectangle = new Rectangle(0, 0, 200, 200);
    var threshold:uint =  0x00800000; 
    var color:uint = 0x20FF0000;
    var maskColor:uint = 0x00FF0000;
    bmd2.threshold(bmd1, rect, pt, ">", threshold, color, maskColor, true);
     
    var bitmap2:Bitmap = new Bitmap(bmd2);
    bitmap2.x = bitmap1.x + bitmap1.width + 10;
    addChild(bitmap2);
     
     
    bitmapdata的功能,不规则图形的遮罩
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.BitmapDataChannel;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    var bmd:BitmapData =new BitmapData(200,200, true,0xFFFF0000);
    var bmdMask:BitmapData =new BitmapData(200,200, true);
    var seed:int=int(Math.random() *int.MAX_VALUE);
    var channels:uint= BitmapDataChannel.RED | BitmapDataChannel.BLUE;
    bmdMask.perlinNoise(100, 80, 12, seed, false, true,channels, false, null);
    var bitmap:Bitmap =new Bitmap(bmd);
    var bitmapMask:Bitmap =new Bitmap(bmdMask);
    //addChild(bitmap);
    //addChild(bitmapMask);
    var threshold:uint= 0x00800000;
     
    var color:uint= 0x00FFFFFF;
    var maskColor:uint= 0x00FF0000;
    bmdMask.threshold(bmdMask, bmdMask.rect, new Point(), ">",threshold, color, maskColor, true);
    var spriteMask =new Sprite();
    spriteMask.addChild(bitmapMask);
    spriteMask.cacheAsBitmap =true;
    addChild(spriteMask);
     
     
     
    var display =new Sprite();
    display.addChild(bitmap);
    display.cacheAsBitmap =true;
    addChild(display);
    display.mask = spriteMask;
  • 相关阅读:
    centos7安装nginx
    linux经常使用的命令
    linux 安装 VNC
    linux配置yum源
    docker服务器、以及容器设置自动启动
    docker初步学习以及常用命令
    Docker命令详解(run篇)
    Linux scp命令
    Linux常用命令学习31个
    Linux下解压tar.xz文件
  • 原文地址:https://www.cnblogs.com/chenhongyu/p/3342058.html
Copyright © 2020-2023  润新知