チェンジセット 2841: as3/ALFluid

差分発生行の前後
無視リスト:
コミット日時:
2009/06/24 12:28:54 (3 年前)
コミッタ:
alumican
ログメッセージ:

--

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/ALFluid/trunk/samples/LiquidVideo/LiquidVideo.as

    r2715 r2841  
    249249                                         
    250250                                        //melt target 
    251                                         _melt = new Melt(_source, false, 20, FLUID_WIDTH, FLUID_HEIGHT, "refrect"); 
     251                                        _melt = new Melt(_source, false, 20, FLUID_WIDTH, FLUID_HEIGHT); 
    252252                                        _melt.x = _video.x; 
    253253                                        _melt.y = _video.y; 
  • as3/ALFluid/trunk/samples/YourFace/classes/DownloadImageThread.as

    r2713 r2841  
    1 package 
     1/** 
     2 * Licensed under the MIT License 
     3 *  
     4 * Copyright (c) 2009 alumican.net (www.alumican.net) and  
     5 *               Spark project (www.libspark.org) 
     6 *  
     7 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     8 * of this software and associated documentation files (the "Software"), to deal 
     9 * in the Software without restriction, including without limitation the rights 
     10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     11 * copies of the Software, and to permit persons to whom the Software is 
     12 * furnished to do so, subject to the following conditions: 
     13 *  
     14 * The above copyright notice and this permission notice shall be included in 
     15 * all copies or substantial portions of the Software. 
     16 *  
     17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     23 * THE SOFTWARE. 
     24 */ 
     25package 
    226{ 
    327        import flash.display.BitmapData; 
     
    1034        import org.libspark.thread.Thread; 
    1135         
     36        /** 
     37         * DownloadImageThread 
     38         * 
     39         * @author alumican.net<Yukiya Okuda> 
     40         */ 
    1241        public class DownloadImageThread extends Thread 
    1342        { 
    1443                private var _data:BitmapData; 
    1544                 
     45                /** 
     46                 * Constructor 
     47                 * @param       data 
     48                 */ 
    1649                public function DownloadImageThread(data:BitmapData):void 
    1750                { 
     
    1952                } 
    2053                 
     54                /** 
     55                 * execute function of thread 
     56                 */ 
    2157                override protected function run():void 
    2258                { 
     
    3369                } 
    3470                 
     71                /** 
     72                 * set error handlers 
     73                 * @param       target 
     74                 */ 
    3575                private function _error(target:*):void 
    3676                { 
  • as3/ALFluid/trunk/samples/YourFace/classes/MainThread.as

    r2713 r2841  
    1 package  
     1/** 
     2 * Licensed under the MIT License 
     3 *  
     4 * Copyright (c) 2009 alumican.net (www.alumican.net) and  
     5 *               Spark project (www.libspark.org) 
     6 *  
     7 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     8 * of this software and associated documentation files (the "Software"), to deal 
     9 * in the Software without restriction, including without limitation the rights 
     10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     11 * copies of the Software, and to permit persons to whom the Software is 
     12 * furnished to do so, subject to the following conditions: 
     13 *  
     14 * The above copyright notice and this permission notice shall be included in 
     15 * all copies or substantial portions of the Software. 
     16 *  
     17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     23 * THE SOFTWARE. 
     24 */ 
     25package  
    226{ 
    327        import flash.display.BitmapData; 
     
    3054                //------------------------------------- 
    3155                 
    32                 private var _root:YourFace
     56                private var _root:FunnyFaceGenerator
    3357                private var _melt:Melt; 
    3458                private var _source:BitmapData; 
     
    6286                /** 
    6387                 * Constructor 
    64                  */ 
    65                 public function MainThread(root:YourFace):void  
     88                 * @param       root 
     89                 */ 
     90                public function MainThread(root:FunnyFaceGenerator):void  
    6691                { 
    6792                        _root = root; 
     
    7297                         
    7398                        //create instance 
    74                         _melt = new Melt(_source, false, 10, 300, 300); 
     99                        _melt = new Melt(_source, false, 10, _root.target.width, _root.target.height); 
    75100                         
    76101                        //config 
     
    112137                } 
    113138                 
     139                /** 
     140                 * set events 
     141                 */ 
    114142                private function _event():void 
    115143                { 
     
    118146                } 
    119147                 
     148                /** 
     149                 * upload your photo 
     150                 * @param       e 
     151                 */ 
    120152                private function _upload(e:MouseEvent):void 
    121153                { 
    122                         _uploader = new UploadImageThread("http://127.0.0.1/crossdomain.xml"); 
     154                        _uploader = new UploadImageThread(); 
    123155                        _uploader.start(); 
    124156                        _uploader.join(); 
     
    129161                } 
    130162                 
     163                /** 
     164                 * upload complete handler 
     165                 * @param       e 
     166                 */ 
    131167                private function _uploaded():void 
    132168                { 
    133169                        var bmd:BitmapData = _uploader.content.bitmapData; 
    134                         var ratioW:Number = 300 / bmd.width; 
    135                         var ratioH:Number = 300 / bmd.height; 
    136                         var ratio:Number = (ratioW > ratioH) ? ratioW : ratioH; 
     170                        var ratioW:Number = _root.target.width / bmd.width; 
     171                        var ratioH:Number = _root.target.height / bmd.height; 
     172                        var ratio:Number   = (ratioW > ratioH) ? ratioW : ratioH; 
    137173                        _source.draw(bmd, new Matrix(ratio, 0, 0, ratio)); 
    138174                         
     
    140176                } 
    141177                 
     178                /** 
     179                 * download fluid picture 
     180                 * @param       e 
     181                 */ 
    142182                private function _download(e:MouseEvent):void 
    143183                { 
    144184                        _melt.fluidUseDecay = false; 
    145185                         
    146                         var data:BitmapData = new BitmapData(360, 360, false); 
    147                         data.draw(_root, new Matrix(1, 0, 0, 1, -70, -70), null, null, new Rectangle(0, 0, 360, 360)); 
     186                        var w:uint = _root.target.width  + 60; 
     187                        var h:uint = _root.target.height + 60; 
     188                         
     189                        var data:BitmapData = new BitmapData(w, h, false); 
     190                        data.draw(_root, new Matrix(1, 0, 0, 1, -_root.frame.x, -_root.frame.y), null, null, new Rectangle(0, 0, w, h)); 
    148191                         
    149192                        _downloader = new DownloadImageThread(data); 
  • as3/ALFluid/trunk/samples/YourFace/classes/UploadImageThread.as

    r2713 r2841  
    1 package 
     1/** 
     2 * Licensed under the MIT License 
     3 *  
     4 * Copyright (c) 2009 alumican.net (www.alumican.net) and  
     5 *               Spark project (www.libspark.org) 
     6 *  
     7 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     8 * of this software and associated documentation files (the "Software"), to deal 
     9 * in the Software without restriction, including without limitation the rights 
     10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     11 * copies of the Software, and to permit persons to whom the Software is 
     12 * furnished to do so, subject to the following conditions: 
     13 *  
     14 * The above copyright notice and this permission notice shall be included in 
     15 * all copies or substantial portions of the Software. 
     16 *  
     17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     23 * THE SOFTWARE. 
     24 */ 
     25package 
    226{ 
    327        import flash.display.Bitmap; 
     
    1337        import org.libspark.thread.Thread; 
    1438         
     39        /** 
     40         * UploadImageThread 
     41         * 
     42         * @author alumican.net<Yukiya Okuda> 
     43         */ 
    1544        public class UploadImageThread extends Thread 
    1645        { 
     46                /** 
     47                 * uploaded bitmapData 
     48                 */ 
    1749                public function get content():Bitmap { return _content; } 
    1850                private var _content:Bitmap; 
    1951                 
     52                /** 
     53                 * Constructor 
     54                 * @param       policyFile 
     55                 */ 
    2056                public function UploadImageThread(policyFile:String = ""):void 
    2157                { 
     
    2359                } 
    2460                 
     61                /** 
     62                 * execute function of thread 
     63                 */ 
    2564                override protected function run():void 
    2665                { 
     
    5897                private function _setBitmap(e:Event):void 
    5998                { 
    60                         var loader:Loader = LoaderInfo(e.target).loader; 
    61                          
    62                         _content = loader.content as Bitmap; 
     99                        _content = LoaderInfo(e.target).loader.content as Bitmap; 
    63100                        next(null); 
    64101                } 
    65102                 
     103                /** 
     104                 * set error handlers 
     105                 * @param       target 
     106                 */ 
    66107                private function _error(target:*):void 
    67108                { 
  • as3/ALFluid/trunk/src/net/alumican/as3/alfluid/Melt.as

    r2715 r2841  
    206206                /** 
    207207                 * Constructor 
     208                 * @param       source 
     209                 * @param       transparent 
     210                 * @param       gridSize 
     211                 * @param       fluidWidth 
     212                 * @param       fluidHeight 
     213                 * @param       edgeMode     "free" or "wrap" 
    208214                 */ 
    209215                public function Melt( 
  • as3/ALFluid/trunk/src/net/alumican/as3/alfluid/core/Fluid.as

    r2716 r2841  
    315315                                                nr = (i == w - 1) ? 1       : (i + 1); 
    316316                                        } 
     317                                        /* 
    317318                                        else if (_edgeMode == "reflect") 
    318319                                        { 
     
    322323                                                nr = (i == w - 1) ? (i - 1) : (i + 1); 
    323324                                        } 
     325                                        */ 
    324326                                        else 
    325327                                        { 
     
    365367                        _mapFilter.componentX = BitmapDataChannel.GREEN; 
    366368                        _mapFilter.componentY = BitmapDataChannel.BLUE; 
    367                         _mapFilter.mode       = DisplacementMapFilterMode.CLAMP; 
     369                        _mapFilter.mode       = (_edgeMode == "wrap") ? DisplacementMapFilterMode.WRAP : DisplacementMapFilterMode.CLAMP; 
    368370                        _mapFilter.scaleX     = magnitude; 
    369371                        _mapFilter.scaleY     = magnitude;