チェンジセット 1523
- コミット日時:
- 2008/10/05 20:29:16 (5 年前)
- ファイル:
-
- as3/gunyarapaint/trunk/gunyarapaint/src/gplogplayer.mxml (更新) (1 diff)
- as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint.as (更新) (1 diff)
- as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint.mxml (更新) (1 diff)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/controls/GPLayerWindowControlScript.as (更新) (2 diffs)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/controls/PenDetailControlScript.as (更新) (4 diffs)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLayer.as (更新) (2 diffs)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLayerArray.as (更新) (15 diffs)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLogger.as (更新) (5 diffs)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPPen.as (更新) (1 diff)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/gunyarapaint/trunk/gunyarapaint/src/gplogplayer.mxml
r1515 r1523 163 163 ]]> 164 164 </mx:Script> 165 <mx:Label x="313" y="11" text="ver.200810050 2"/>165 <mx:Label x="313" y="11" text="ver.2008100507"/> 166 166 </mx:Application> as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint.as
r1504 r1523 39 39 40 40 public function init():void { 41 42 41 var width:uint, height:uint, undoBufferSize:uint; 43 42 as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint.mxml
r1516 r1523 12 12 </mx:Script> 13 13 <mx:Canvas id="toolCanvas" x="0" y="0" width="685" height="102"> 14 <mx:Label id="versionLabel" x="238" y="9" text="ver.200810050 3"/>14 <mx:Label id="versionLabel" x="238" y="9" text="ver.2008100507"/> 15 15 <mx:Label x="28" y="7" text="名前"/> 16 16 <mx:TextInput id="fromTextInput" x="55" y="3" maxChars="32" fontSize="14" focusThickness="0"/> as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/controls/GPLayerWindowControlScript.as
r1503 r1523 15 15 blendModeComboBox.dataProvider = [ 16 16 {label: '通常', data: flash.display.BlendMode.NORMAL}, 17 //{label: '消去', data: flash.display.BlendMode.ERASE}, // マスクレイヤでよい。18 17 {label: '比較(暗)', data: flash.display.BlendMode.DARKEN}, 19 18 {label: '乗算', data: flash.display.BlendMode.MULTIPLY}, … … 25 24 {label: '差の絶対値', data: flash.display.BlendMode.DIFFERENCE}, 26 25 {label: '除外', data: flash.display.BlendMode.SUBTRACT}, 27 {label: '反転', data: flash.display.BlendMode.INVERT}]; 26 {label: '反転', data: flash.display.BlendMode.INVERT}, 27 /*{label: '消去', data: flash.display.BlendMode.ERASE}*/]; 28 28 blendModeComboBox.addEventListener(ListEvent.CHANGE, blendModeComboBoxHandler); 29 29 as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/controls/PenDetailControlScript.as
r1505 r1523 52 52 blendModeComboBox.dataProvider = [ 53 53 {label: '通常', data: flash.display.BlendMode.NORMAL}, 54 // {label: '消去', data: flash.display.BlendMode.ERASE}, // eraserButtonで設定させる55 54 {label: '比較(暗)', data: flash.display.BlendMode.DARKEN}, 56 55 {label: '乗算', data: flash.display.BlendMode.MULTIPLY}, … … 62 61 {label: '差の絶対値', data: flash.display.BlendMode.DIFFERENCE}, 63 62 {label: '除外', data: flash.display.BlendMode.SUBTRACT}, 64 {label: '反転', data: flash.display.BlendMode.INVERT}]; 63 {label: '反転', data: flash.display.BlendMode.INVERT}, 64 {label: '消去', data: flash.display.BlendMode.ERASE}]; 65 65 blendModeComboBox.addEventListener(ListEvent.CHANGE, blendModeComboBoxHandler); 66 66 } … … 69 69 _logger = l; 70 70 gridItemPaletteClickHandler(1); 71 // 初期値と設定値が一緒なのでイベントが飛んでこない、明示的に呼んであげる 72 drawPreview(GPPen.PEN_MODE_HAND, 0x000000, 1, 3); 71 73 } 72 74 … … 176 178 177 179 private function thicknessSliderHandler(evt:SliderEvent):void { 178 cancelTool();179 180 _logger.eventLineStyleThickness(evt.value); 180 181 } as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLayer.as
r1503 r1523 26 26 27 27 private var _logger:GPLogger; 28 28 29 29 public function GPLayer(logger:GPLogger, 30 30 source:BitmapData, width:uint, height:uint, index:uint, … … 53 53 public function clone():GPLayer { 54 54 // indexは親で振りなおす 55 return new GPLayer(_logger, _bitmapData .clone(), _width, _height, _index, _show, _lock, _blendMode, _alpha, _name);55 return new GPLayer(_logger, _bitmapData, _width, _height, _index, _show, _lock, _blendMode, _alpha, _name); 56 56 } 57 57 58 58 // 外から与えられたものを_bitmapDataに書き込む 59 59 public function draw(source:IBitmapDrawable, matrix:Matrix = null, colorTransform:ColorTransform = null, blendMode:String = null, clipRect:Rectangle = null, smoothing:Boolean = false):void { 60 // UndoBufferに入っているbitmapDataを上書きしないように、コピーしてから描く。 61 _bitmapData = _bitmapData.clone(); 62 _bitmap.bitmapData = _bitmapData; 60 63 _bitmapData.draw(source, matrix, colorTransform, blendMode, clipRect, smoothing); 61 64 } 62 65 public function floodFill(x:Number, y:Number, color:uint):void { 66 _bitmapData = _bitmapData.clone(); 67 _bitmap.bitmapData = _bitmapData; 63 68 _bitmapData.floodFill(x, y, color); 64 69 } as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLayerArray.as
r1516 r1523 3 3 import com.adobe.images.PNGEncoder; 4 4 5 import flash.display.Bitmap; 5 6 import flash.display.BitmapData; 6 7 import flash.display.BlendMode; … … 19 20 { 20 21 private var _a:Array; 21 private var _targetIndex:uint; // 現在描画対象となっているレイヤ番号 (1 startがいいかな?)22 private var _targetIndex:uint; // 現在描画対象となっているレイヤ番号 22 23 private var _width:uint, _height:uint; // キャンバスサイズ 23 24 … … 100 101 _view.addChildAt(l.bitmap, _targetIndex); 101 102 reindex(); 103 recombine(); 102 104 return true; 103 105 } 104 106 105 107 public function changeVisible(target:uint, b:Boolean):Boolean { 106 if ( _a[target].show == b) {108 if (target >= _a.length || _a[target].show == b) { 107 109 return false; 108 110 } … … 151 153 152 154 public function swap(f:uint, t:uint):Boolean { 153 if (f == t) {155 if (f >= _a.length || t >= _a.length || f == t) { 154 156 return false; 155 157 } … … 164 166 165 167 public function mergeWithBelow():Boolean { 166 var i:uint = _targetIndex; 167 if (i == 0) { 168 if (_targetIndex == 0) { 168 169 Alert.show('統合するひとつ下のレイヤがありません。', 'レイヤツール'); 169 170 return false; 170 171 } 171 this.targetIndex = i - 1; 172 _a[i].drawDest(_a[_targetIndex].bitmapData); 173 _a.splice(i, 1); 174 if (_targetIndex == i) { 175 this.targetIndex = _targetIndex - 1; 176 } 177 _view.removeChildAt(i); 172 _a[_targetIndex].drawDest(_a[_targetIndex - 1].bitmapData); 173 _a.splice(_targetIndex, 1); 174 _view.removeChildAt(_targetIndex); 175 this.targetIndex = _targetIndex - 1; 178 176 reindex(); 179 177 recombine(); … … 182 180 183 181 public function remove():Boolean { 184 var i:uint = _targetIndex;185 182 if (_a.length <= 1) { 186 183 Alert.show('レイヤ全てを削除することはできません。', 'レイヤツール'); 187 184 return false; 188 185 } 189 _a.splice( i, 1);190 if (_targetIndex == i) {191 _targetIndex--;192 }193 _view.removeChildAt(i);186 _a.splice(_targetIndex, 1); 187 _view.removeChildAt(_targetIndex); 188 if (_targetIndex > 0) { 189 this.targetIndex = _targetIndex - 1; 190 } 194 191 reindex(); 195 192 recombine(); … … 200 197 private function recombine():void { 201 198 _combinedBitmapData = new BitmapData(_width, _height, true, 0x00000000); 202 for (var i: String in _a) {199 for (var i:uint = 0; i < _a.length; i++) { 203 200 _a[i].drawDest(_combinedBitmapData); 204 201 } … … 238 235 for (var i:uint = 0; i < _a.length; i++) { 239 236 var lo:Object = _a[i].to_object; 240 // bitmapDataが変わっていないところはcloneせずに省メモリを目指す。 241 if (_targetIndex == i) { 242 lo['bitmap_data'] = _a[i].bitmapData.clone(); 243 } else { 244 lo['bitmap_data'] = _a[i].bitmapData; 245 } 237 lo['bitmap_data'] = _a[i].bitmapData; 246 238 obj['layers'].push(lo); 247 239 } … … 251 243 public function set dataForUndo(obj:Object):void { 252 244 var i:uint; 253 _targetIndex = obj.target_index;254 245 for (i = 0; i < _a.length; i++) { 255 246 try { … … 266 257 _view.addChild(l.bitmap); 267 258 } 259 this.targetIndex = obj.target_index; 268 260 recombine(); 269 261 } … … 277 269 public function floodFill(x:Number, y:Number, color:uint):void { 278 270 _a[_targetIndex].floodFill(x, y, color); 271 recombine(); 279 272 } 280 273 … … 296 289 297 290 public function set targetIndex(i:uint):void { 298 _targetIndex = i; 291 if (i < _a.length) { 292 _targetIndex = i; 293 } 299 294 } 300 295 … … 313 308 recombine(); 314 309 } 310 public function set targetLayerBlendMode(s:String):void { 311 _a[_targetIndex].blendMode = s; 312 recombine(); 313 } 315 314 public function get targetLayerAlpha():Number { 316 315 return _a[_targetIndex].alpha; … … 319 318 return _a[_targetIndex].blendMode; 320 319 } 321 public function set targetLayerBlendMode(s:String):void {322 _a[_targetIndex].blendMode = s;323 recombine();324 }325 320 326 321 public function get view():Sprite { 327 322 return _view; 328 } 329 323 } 330 324 331 325 // 描画用レイヤを一時的に挿入・削除する。 … … 342 336 _a[_targetIndex].blendMode; 343 337 _targetSprite.alpha = _a[_targetIndex].alpha; 344 _a[_targetIndex].blendMode = flash.display.BlendMode.NORMAL; 345 _ a[_targetIndex].alpha = 1;346 /*347 s.blendMode = p.blendMode;348 s.alpha = p.alpha;349 */350 _targetSprite.addChild( _a[_targetIndex].bitmap);338 339 _view.removeChild(_a[_targetIndex].bitmap); 340 var tempTargetLayerBitmap:Bitmap = new Bitmap(_a[_targetIndex].bitmapData); 341 tempTargetLayerBitmap.blendMode = flash.display.BlendMode.NORMAL; 342 tempTargetLayerBitmap.alpha = 1; 343 344 _targetSprite.addChild(tempTargetLayerBitmap); 351 345 _targetSprite.addChild(s); 352 346 _view.addChildAt(_targetSprite, _targetIndex); as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLogger.as
r1516 r1523 5 5 package org.libspark.gunyarapaint.entities 6 6 { 7 import flash.display.Bitmap; 7 8 import flash.display.BitmapData; 8 9 import flash.errors.EOFError; … … 122 123 ret.compatibility_0_0_1 = true; 123 124 break; 124 case '0.0.2:': 125 case '0.0.3:': 125 case '0.0.2:': // 0.5ずれバグの修正、ドット描画バグの修正 126 case '0.0.3:': // レイヤ対応初版、最初の数点は0.0.2versionでレイヤのやつがある 126 127 case '0.0.4:': 127 128 case '0.0.5:': 128 129 case '0.0.6:': 130 case '0.0.7:': 131 case '0.0.8:': // undoの挙動変更、bitmapDataをcloneするように 129 132 break; 130 133 default: … … 144 147 var log:ByteArray = new ByteArray(); 145 148 log.endian = flash.utils.Endian.BIG_ENDIAN; 146 log.writeUTFBytes('GUNYARA_PAINT:0.0. 6:');149 log.writeUTFBytes('GUNYARA_PAINT:0.0.8:'); 147 150 log.writeShort(width); 148 151 log.writeShort(height); … … 150 153 var ret:GPLogger = new GPLogger(log, true, width, height, undoBufferSize, baseLayers, baseInfo); 151 154 ret.createCanvas(); 152 // 初期のペン状態を記録しておく。153 ret.eventLineStyleThickness(ret._pen.thickness);154 ret.eventLineStyleColor(ret._pen.color);155 ret.eventLineStyleAlpha(ret._pen.alpha);156 ret.eventLineStyleBlendMode(ret._pen.blendMode);157 ret.eventLineStyleScaleMode(ret._pen.scaleMode);158 ret.eventLineStyleCapsStyle(ret._pen.capsStyle);159 ret.eventLineStyleJointStyle(ret._pen.jointStyle);160 ret.eventLineStyleMiterLimit(ret._pen.miterLimit);161 ret.eventLineStylePixelHinting(ret._pen.pixelHinting);162 155 163 156 return ret; … … 211 204 212 205 public function drawShapeOnBitmap():void { 213 // 描画214 206 _layerArray.draw(_pen.drawShape, null, null, _pen.blendMode, null, false); 215 207 pushUndoBuffer(); as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPPen.as
r1500 r1523 81 81 } 82 82 83 // これらの初期値は変えないこと!描画ログが崩れます。 83 84 public function GPPen(logger:GPLogger, 84 85 thickness:uint = 3,

