• AS3倒影算法


    代码
    function createRef(picSource:DisplayObject):void
    {
        
    // 倒置
        var bd:BitmapData = new BitmapData(picSource.width, picSource.height, true0x12346f);
        var mtx:Matrix 
    = new Matrix();
        mtx.d 
    = -1;
        mtx.ty 
    = bd.height;
        bd.draw(picSource, mtx);
        
    // 添加渐变遮罩
        var int = bd.width;
        var height:
    int = bd.height;
        mtx 
    = new Matrix();
        mtx.createGradientBox(width, height, 
    0.5 * Math.PI);
        var shape:Shape 
    = new Shape();
        shape.graphics.beginGradientFill(GradientType.LINEAR, [
    00], [0.90.2], [00xFF], mtx);
        shape.graphics.drawRect(
    00, width, height);
        shape.graphics.endFill();
        var mask_bd:BitmapData 
    = new BitmapData(width, height, true0);
        mask_bd.draw(shape);
        
    // 生成最终效果
        bd.copyPixels(bd, bd.rect, new Point(00), mask_bd, new Point(00), false);
        
    // 将倒影放置于图片下方
        var ref:Bitmap = new Bitmap();
        ref.y 
    = picSource.height + picSource.y;
        ref.x 
    = picSource.x;
        ref.bitmapData 
    = bd;
        picSource.parent.addChild(ref);
    }
  • 相关阅读:
    CF538H Summer Dichotomy
    CF1558F Strange Sort
    CF429E Points and Segments
    CF986F Oppa Funcan Style Remastered
    [JOI Open 2016] 摩天大楼
    [做题笔记] 浅谈笛卡尔树结构的应用
    CF1383C String Transformation 2
    CF1558E Down Below
    weex打包安卓艰苦之路
    IntelliJ IDEA 推荐15款插件
  • 原文地址:https://www.cnblogs.com/sevenyuan/p/1615510.html
Copyright © 2020-2023  润新知