守望者--AIR技术交流

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
热搜: ANE FlasCC 炼金术
查看: 1144|回复: 0

应用窗口镶边(SystemChrome)透明和模糊的ANE(mac-os)

[复制链接]
  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    51838
    钢镚
    1422

    开源英雄守望者

    发表于 2015-2-20 21:36:36 | 显示全部楼层 |阅读模式
    应用下载
    应用名称: AIR-ChromeWindowBlur-ANE
    支持64位: 不支持
    当前版本: 未知
    运行平台: Mac-OS 
    开发语言: Object-C 
    应用类别: ANE-C/C++
    应用简介: A native extension for Adobe AIR for Mac/OSX development that uses Core Graphics to enhance window SystemChrome option with blur/alpha effects
    AIR-ChromeWindowBlur-ANE

    A native extension for Adobe AIR for Mac/OSX development that uses Core Graphics to enhance window SystemChrome option with blur/alpha effects Extension is compiled with XCode 5.1.1 and deployment target is set at 10.8+

    What does it do?

    Since a lot of folks love to build mobile and desktop applications with Adobe AIR, I found that System Chrome option lacks transparency and if you want transparent window background you have to invest quite a bit of time to write Native Window controls to move/control the window in AS3 due to Chromeless Window approach in AIR where it removes native OS's title bar and you end up with an app that doesn't look as native without it.

    With the upcoming arrival of OSX Yosemite, I'm sure a lot of AS3 developers will want their Mac apps to look similar to the native look of the OS, so I created a native extension that overrides some of the properties of AIR Framework and allows Custom Chrome to act as standard System Chrome but with cool visual blurring and transparency effect using Core Graphics API.

    How to use it?

    I tried to allow developers as much freedom as possible and included options for transparency amount, the blur amount and even the color of the background window to play with.

    You just need to get the ANE from this repo, link it with your project and off you go.

    FLASH CC/2014 LINKING:

    • Go to Actionscript 3 setting where you would normally include the SWC files.
    • Hit + and point to the location where you placed the ANE to link it.

    FLASH BUILDER:

    • Open Project Properties
    • Go to Actionscript Build Path
    • Add SWC file
    • Change the file type to .ANE in the dialog box
    • Locate the ANE and add it.

    NOTE: Adobe recommends Link Type for the attached ANEs to be of external type not Merged Into Code.

    *IMPORTANT: * Due to limitations of System Chrome and Chromeless Opaque, you need to use Custom Chrome Transparent option under AIR SDK Settings in order to take advantage of this ANE. The Hardware Acceleration/Render Mode has to be set to AUTO.

    Example Usage:

    Since we are extending Custom Chrome functionality from AIR framework that doesn't have title bar, I've given you the ability to specify custom title alongside other properties like whether or not you want the window to be closable, resizable, maximizable, minimizable in addition to the actual transcluency adjustment properties.

    1. import com.bozzified.extensions.NativeWinBlur;

    2. // create instance for AIR window Core Graphics awesomeness
    3. var win:NativeWinBlur = new NativeWinBlur();


    4. // set window attributes - always goes before enableWindowBlur()
    5. // ARGUMENTS TO PASS
    6. // hasWindowTitle:Boolean=true, windowTitle:String="", maximizable:Boolean=true, minimizable:Boolean=true, closable:Boolean=true, resizable:Boolean=true

    7. win.setWindowAttributes(true, "Core Graphics AIR Chrome Window Blurred", false, true, true, false);

    8. // set effect properties
    9. // ARGUMENTS TO PASS
    10. // alpha:Number=0.5, blurAmount:uint=50, red:uint=0, green:uint=0, blue:uint=0
    11. win.enableWindowBlur(0.4, 30, 255, 255, 255);
    复制代码
    In Action:

    Responsible Use:

    It's important to note that even though Core Graphics is GPU accelerated and the blurring and effects are completely native, abusing the Transparency with a lot of heavy animations and stuff will definitely affect the performance. Due to the nature of AIR's runtime the Render Mode and Hardware Accelerationshould be set to AUTO as it might cause issues for you and interfere with Core Graphics API.

    Planned Additions:

    In this release I really didn't have time to enable full screen mode support even though there are native extensions out there that might do it. If people want it, I can definitely include that in and probably expand a bit more on some additions like (native alert dialogs maybe inside your AIR app? ). I'm waiting for Yosemite to see what type of integration I can expand but for now, your app will hopefully now look cooler than it ever did before with AIR

    Bug Reports/Suggestions:

    If you find bugs, have issues, or suggestions feel free to reach out to me on Twitter or Google Plus. Twitter:@Bozzified Google Plus: +Boz Bundalo







    相关链接:


    https://github.com/Bozzified/AIR-ChromeWindowBlur-ANE


    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?立即注册

    x
    守望者AIR技术交流社区(www.airmyth.com)
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    
    关闭

    站长推荐上一条 /4 下一条

    QQ|手机版|Archiver|网站地图|小黑屋|守望者 ( 京ICP备14061876号

    GMT+8, 2020-5-26 20:40 , Processed in 0.089053 second(s), 36 queries .

    守望者AIR

    守望者AIR技术交流社区

    本站成立于 2014年12月31日

    快速回复 返回顶部 返回列表