チェンジセット 747
- コミット日時:
- 2008/07/02 19:43:08 (2 ヶ月前)
- ファイル:
-
- as3/Frocessing/trunk/src/frocessing/bmp/BmpUtil.as (更新) (2 diffs)
- as3/Frocessing/trunk/src/frocessing/bmp/FBitmapData.as (追加)
- as3/Frocessing/trunk/src/frocessing/color/ColorBlend.as (更新) (3 diffs)
- as3/Frocessing/trunk/src/frocessing/core/F5BitmapData.as (更新) (7 diffs)
- as3/Frocessing/trunk/src/frocessing/core/GraphicsBase.as (更新) (6 diffs)
- as3/Frocessing/trunk/src/frocessing/f3d/model/F3DSphere.as (更新) (1 diff)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/Frocessing/trunk/src/frocessing/bmp/BmpUtil.as
r714 r747 55 55 var mt:Matrix = dobj.transform.matrix; 56 56 var rt:Rectangle = ( dobj.parent ) ? dobj.getBounds( dobj.parent ) : dobj.getBounds( dobj ); 57 var w:uint = Math.ceil( rt.width *scale );57 var w:uint = Math.ceil( rt.width * scale ); 58 58 var h:uint = Math.ceil( rt.height * scale ); 59 59 mt.translate( -rt.x, -rt.y ); … … 61 61 mt.translate( margin, margin ); 62 62 if( bd==null ) 63 bd = new BitmapData( w+margin*2, h+margin*2, true, 0x00 999999);63 bd = new BitmapData( w+margin*2, h+margin*2, true, 0x00000000 ); 64 64 bd.draw( dobj, mt, dobj.transform.colorTransform, null, null, smooth ); 65 65 return bd; as3/Frocessing/trunk/src/frocessing/color/ColorBlend.as
r659 r747 100 100 * 101 101 * @author nutsu 102 * @version 0.1 102 * @version 0.1.4 103 103 */ 104 104 public class ColorBlend { 105 105 106 //ノーマル 107 public static const NORMAL :String = "normal"; 106 108 //加算 107 109 public static const ADD :String = "add"; … … 263 265 * <p>ブレンドモードは以下のモードから指定します.</p> 264 266 * <ul> 267 * <li>ColorBlend.NORMAL : ノーマル</li> 265 268 * <li>ColorBlend.Add : 加算</li> 266 269 * <li>ColorBlend.SUBTRACT : 除算</li> … … 300 303 case BURN: return burn32( c1, c2 ); 301 304 case EXCLUSION: return excl32( c1, c2 ); 302 default: return c2;305 default: return normal32( c1, c2 ); 303 306 } 304 307 } 305 308 306 309 //---------------------------------------------------------------------------------------------------BLEND PRC 310 311 /** 312 * 32bit Color (0xAARRGGBB) を ブレンドします. 313 * @param c1 backcolor 0xAARRGGBB 314 * @param c2 forecolor 0xAARRGGBB 315 * @return 0xAARRGGBB 316 */ 317 public static function normal32( c1:uint, c2:uint ):uint 318 { 319 return normalRGBA( (c1 & 0x00ff0000) >>> 16, (c1 & 0x0000ff00) >>> 8, c1 & 0x000000ff, (c2 & 0x00ff0000) >>> 16, (c2 & 0x0000ff00) >>> 8, c2 & 0x000000ff, (c1 & 0xff000000) >>> 24, (c2 & 0xff000000) >>> 24 ); 320 } 321 /** 322 * RGBA値をブレンドします. 323 * @return 0xAARRGGBB 324 */ 325 public static function normalRGBA( r1:uint, g1:uint, b1:uint, r2:uint, g2:uint, b2:uint, a1:uint=0xff, a2:uint=0xff ):uint 326 { 327 return Math.min( a1 + a2, 0xff ) << 24 | _normal32(r1,r2,a2)>>16 | _normal32(g1,g2,a2)>>8 | _normal32(b1,b2,a2) ; 328 } 329 /** 330 * @private 331 */ 332 private static function _normal32( e1:uint, e2:uint, a2:uint ):uint 333 { 334 return ( e1*(a2^0xff) + e2*a2 )>>8; 335 } 336 337 //------------------------------- 338 307 339 /** 308 340 * 24bit Color (0xRRGGBB) を 加算(ADD) でブレンドします. as3/Frocessing/trunk/src/frocessing/core/F5BitmapData.as
r734 r747 36 36 import flash.display.Shape; 37 37 import flash.geom.Rectangle; 38 import frocessing.bmp.FBitmapData; 38 39 39 40 /** … … 41 42 * 42 43 * @author nutsu 43 * @version 0.1. 244 * @version 0.1.4 44 45 */ 45 46 public class F5BitmapData extends F5Graphics2D{ 46 47 47 private var _bitmapData: BitmapData;48 private var _bitmapData:FBitmapData; 48 49 private var screenRect:Rectangle; 49 50 private var _shape:Shape; … … 57 58 * @param bgcolor BitmapData の 背景色( 32bit Color ) 58 59 */ 59 public function F5BitmapData( width_:uint, height_:uint, transparent_:Boolean= true, bgcolor:uint=0xffcccccc ){60 public function F5BitmapData( width_:uint, height_:uint, transparent_:Boolean=false, bgcolor:uint=0xffcccccc ){ 60 61 super( (_shape = new Shape()).graphics ); 61 62 _width = width_; 62 63 _height = height_; 63 _bitmapData = new BitmapData( _width, _height, transparent_, _background.value32 ); 64 screenRect = new Rectangle( 0, 0, width_, height_ ); 65 _bitmapData = new FBitmapData( _width, _height, transparent_, _background.value32 ); 64 66 } 65 67 … … 69 71 public function get bitmapData():BitmapData { return _bitmapData; } 70 72 73 public override function beginDraw():void 74 { 75 super.beginDraw(); 76 //_bitmapData.lock(); 77 } 78 71 79 /** 72 80 * 描画を終了するときに実行します.このメソッドにより Graphics の内容が BitmapData にドローされます. … … 75 83 { 76 84 _bitmapData.draw( _shape, null, null, null, screenRect, _bmpGc.smooth ); 85 //_bitmapData.unlock(); 77 86 } 78 87 … … 86 95 screenRect = new Rectangle( 0, 0, width_, height_ ); 87 96 _bitmapData.dispose(); 88 _bitmapData = new BitmapData( _width, _height, _bitmapData.transparent, _background.value32 );97 _bitmapData = new FBitmapData( _width, _height, _bitmapData.transparent, _background.value32 ); 89 98 } 90 99 … … 103 112 protected override function $point( x:Number, y:Number, color:uint, alpha_:Number=1.0 ):void 104 113 { 105 if ( alpha_==1.0 ) 114 if ( alpha_ < 1.0 ) 115 _bitmapData.drawPixel( int(x), int(y), color, int(alpha_*0xff) ); 116 else 106 117 _bitmapData.setPixel( int(x), int(y), color ); 107 else 108 _bitmapData.setPixel32( int(x), int(y), (Math.round( alpha_*0xff ) & 0xff ) << 24 | color ); 118 109 119 } 110 120 as3/Frocessing/trunk/src/frocessing/core/GraphicsBase.as
r734 r747 64 64 protected var _fill_alpha:Number; 65 65 66 private var __stroke:Boolean; 67 66 68 /** 67 69 * 新しい GraphicsBase クラスのインスタンスを生成します. … … 74 76 _lastCtrlY = _lastY = _startY = 0.0; 75 77 _gc = gc; 78 __stroke = false; 76 79 } 77 80 … … 247 250 protected function $point( x:Number, y:Number, color:uint, alpha:Number=1.0 ):void 248 251 { 249 _gc.beginFill( color, alpha ); 250 _gc.drawRect( x, y, 1, 1 ); 251 _gc.endFill(); 252 if ( __stroke ) 253 { 254 _gc.lineStyle(); 255 _gc.beginFill( color, alpha ); 256 _gc.drawRect( x, y, 1, 1 ); 257 _gc.endFill(); 258 applyLineStyle(); 259 } 260 else 261 { 262 _gc.beginFill( color, alpha ); 263 _gc.drawRect( x, y, 1, 1 ); 264 _gc.endFill(); 265 } 252 266 } 253 267 … … 265 279 * @private 266 280 */ 281 /* 267 282 protected function $beginBitmapFill(bitmap:BitmapData,matrix:Matrix=null,repeat:Boolean=true,smooth:Boolean=false):void 268 283 { 269 284 _gc.beginBitmapFill( bitmap, matrix, repeat, smooth ); 270 285 } 271 286 */ 272 287 /** 273 288 * @private 274 289 */ 290 /* 275 291 public function $beginGradientFill(type:String, color:Array, alphas:Array, ratios:Array, matrix:Matrix=null, spreadMethod:String="pad", interpolationMethod:String="rgb",focalPointRation:Number=0.0):void 276 292 { 277 293 _gc.beginGradientFill( type, color, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPointRation ); 278 294 } 295 */ 279 296 280 297 //--------------------------------------------------------------------------------------------------- BASIC … … 363 380 public function applyLineStyle():void 364 381 { 382 __stroke = true; 365 383 _gc.lineStyle( _thickness, _stroke_color, _stroke_alpha, _pixelHinting, _scaleMode, _caps, _joints, _miterLimit ); 366 384 } … … 371 389 public function noLineStyle():void 372 390 { 391 __stroke = false; 373 392 _gc.lineStyle(); 374 393 } as3/Frocessing/trunk/src/frocessing/f3d/model/F3DSphere.as
r734 r747 26 26 27 27 package frocessing.f3d.model { 28 29 28 30 29 /**
